I don't like playing devils advocate, but globals should really be avoided - I would personally prefer:
_JENKINS_API = None
def get_jenkinsapi_jenkins(): if _JENKINS_API is None: _JENKINS_API = Jenkins(JENKINS_URL) else: ...
This way the _JENKINS_API singleton can only be accessed by jenkins_pull._JENKINS_API, which is clear it is not meant to be used directly.
« Back to merge proposal
I don't like playing devils advocate, but globals should really be avoided - I would personally prefer:
_JENKINS_API = None
def get_jenkinsapi_ jenkins( ):
_JENKINS_ API = Jenkins( JENKINS_ URL)
if _JENKINS_API is None:
else:
...
This way the _JENKINS_API singleton can only be accessed by jenkins_ pull._JENKINS_ API, which is clear it is not meant to be used directly.