Fix whitespace around operators
authorHugh Brown <hbrown@amplify.com>
Thu, 10 Oct 2013 19:47:46 +0000 (15:47 -0400)
committerHugh Brown <hbrown@amplify.com>
Thu, 10 Oct 2013 20:36:40 +0000 (16:36 -0400)
jenkinsapi/__init__.py
jenkinsapi/api.py
jenkinsapi/artifact.py
jenkinsapi/build.py
jenkinsapi/command_line/jenkins_invoke.py
jenkinsapi/exceptions.py
jenkinsapi/fingerprint.py
jenkinsapi/invocation.py
jenkinsapi/jenkins.py
jenkinsapi/jenkinsbase.py
jenkinsapi/utils/requester.py

index b0be722..f8ffab6 100644 (file)
@@ -40,7 +40,7 @@ Project Authors
 Current code lives on github: https://github.com/salimfadhley/jenkinsapi
 
 """
-__all__= ["command_line", "utils",
+__all__ = ["command_line", "utils",
            "api", "artifact", "build", "config", "constants", "exceptions", "fingerprint",
            "jenkins", "jenkinsbase", "job", "node", "result_set", "result", "view"]
 __docformat__ = "epytext"
index 65271e2..220f7b0 100644 (file)
@@ -81,8 +81,8 @@ def search_artifacts(jenkinsurl, jobid, artifact_ids=None):
         build = job.get_build(build_id)
         artifacts = build.get_artifact_dict()
         if set(artifact_ids).issubset(set(artifacts.keys())):
-            return dict((a,artifacts[a]) for a in artifact_ids)
-        missing_artifacts =  set(artifact_ids) - set(artifacts.keys())
+            return dict((a, artifacts[a]) for a in artifact_ids)
+        missing_artifacts = set(artifact_ids) - set(artifacts.keys())
         log.debug("Artifacts %s missing from %s #%i" % (", ".join(missing_artifacts), jobid, build_id))
     #noinspection PyUnboundLocalVariable
     raise ArtifactsMissing(missing_artifacts)
index c657a80..3ed7d9c 100644 (file)
@@ -84,14 +84,14 @@ class Artifact(object):
         fp = Fingerprint(self.build.job.jenkins.baseurl, local_md5, self.build.job.jenkins)
         return fp.validate_for_build(os.path.basename(fspath), self.build.job.name, self.build.buildno)
 
-    def _md5sum(self, fspath, chunksize=2**20):
+    def _md5sum(self, fspath, chunksize=2 ** 20):
         """
         A MD5 hashing function intended to produce the same results as that used by
         Jenkins.
         """
         md5 = hashlib.md5()
         try:
-            with open(fspath,'rb') as f:
+            with open(fspath, 'rb') as f:
                 for chunk in iter(lambda: f.read(chunksize), ''):
                     md5.update(chunk)
         except:
index d603b09..7f02480 100644 (file)
@@ -257,7 +257,7 @@ class Build(JenkinsBase):
         Return the URL for the object which provides the job's result summary.
         """
         url_tpl = r"%stestReport/%s"
-        return  url_tpl % (self._data["url"], config.JENKINS_API)
+        return url_tpl % (self._data["url"], config.JENKINS_API)
 
     def get_resultset(self):
         """
@@ -290,7 +290,7 @@ class Build(JenkinsBase):
         Returns build timestamp in UTC
         '''
         # Java timestamps are given in miliseconds since the epoch start!
-        naive_timestamp = datetime.datetime(*time.gmtime(self._data['timestamp']/1000.0)[:6])
+        naive_timestamp = datetime.datetime(*time.gmtime(self._data['timestamp'] / 1000.0)[:6])
         return pytz.utc.localize(naive_timestamp)
 
     def get_console(self):
index f2ee98e..b466d7a 100644 (file)
@@ -11,7 +11,7 @@ class jenkins_invoke(object):
     @classmethod
     def mkparser(cls):
         parser = optparse.OptionParser()
-        DEFAULT_BASEURL=os.environ.get("JENKINS_URL", "http://localhost/jenkins")
+        DEFAULT_BASEURL = os.environ.get("JENKINS_URL", "http://localhost/jenkins")
         parser.help_text = "Execute a number of jenkins jobs on the server of your choice. Optionally block until the jobs are complete."
         parser.add_option("-J", "--jenkinsbase", dest="baseurl",
                           help="Base URL for the Jenkins server, default is %s" % DEFAULT_BASEURL,
@@ -22,7 +22,7 @@ class jenkins_invoke(object):
                         help="password for jenkins user auth", type='str', default=None)
         parser.add_option("-b", "--block", dest="block", action="store_true", default=False,
                           help="Block until each of the jobs is complete.")
-        parser.add_option("-t", "--token", dest="token",help="Optional security token.",
+        parser.add_option("-t", "--token", dest="token", help="Optional security token.",
                           default=None)
         return parser
 
index 976dbed..65d9aeb 100644 (file)
@@ -76,7 +76,7 @@ class FailedNoResults(NoResults):
     """
 
 
-class BadURL(ValueError,JenkinsAPIException):
+class BadURL(ValueError, JenkinsAPIException):
     """
     A URL appears to be broken
     """
index 065e75e..22ebeea 100644 (file)
@@ -19,7 +19,7 @@ class Fingerprint(JenkinsBase):
         logging.basicConfig()
         self.jenkins_obj = jenkins_obj
         assert self.RE_MD5.search(id), "%s does not look like a valid id" % id
-        url =  "%s/fingerprint/%s/" % (baseurl, id)
+        url = "%s/fingerprint/%s/" % (baseurl, id)
         JenkinsBase.__init__(self, url, poll=False)
         self.id = id
 
index df98078..b305f0a 100644 (file)
@@ -77,7 +77,7 @@ class Invocation(object):
         """
         assert until in ['completed', 'not_queued'], 'Unknown block condition: %s' % until
         self.block_until_not_queued(timeout, delay)
-        if until=='completed':
+        if until == 'completed':
             self.block_until_completed(timeout, delay)
 
     def stop(self):
index c2c091e..58c5d49 100644 (file)
@@ -291,7 +291,7 @@ class Jenkins(JenkinsBase):
         :param exclusive: tied to specific job, boolean
         :return: node obj
         """
-        NODE_TYPE   = 'hudson.slaves.DumbSlave$DescriptorImpl'
+        NODE_TYPE = 'hudson.slaves.DumbSlave$DescriptorImpl'
         MODE = 'NORMAL'
         if self.has_node(name):
             return Node(nodename=name, baseurl=self.get_node_url(nodename=name), jenkins_obj=self)
@@ -300,7 +300,7 @@ class Jenkins(JenkinsBase):
         params = {
             'name': name,
             'type': NODE_TYPE,
-            'json': json.dumps ({
+            'json': json.dumps({
                 'name': name,
                 'nodeDescription': node_description,
                 'numExecutors': num_executors,
index 43a2939..f2b3238 100644 (file)
@@ -68,7 +68,7 @@ class JenkinsBase(object):
             return url
         else:
             if url.endswith(r"/"):
-                fmt="%s%s"
+                fmt = "%s%s"
             else:
                 fmt = "%s/%s"
             return fmt % (url, config.JENKINS_API)
index a2949b1..72b4db4 100644 (file)
@@ -24,7 +24,7 @@ class Requester(object):
     This default class can handle simple authentication only.
     """
 
-    VALID_STATUS_CODES = [200,]
+    VALID_STATUS_CODES = [200, ]
 
     def __init__(self, username=None, password=None, ssl_verify=True):
         if username: