From 718082ee70b422504b7cc26e8bfd947af5037b7c Mon Sep 17 00:00:00 2001 From: Hugh Brown Date: Thu, 10 Oct 2013 16:08:46 -0400 Subject: [PATCH] Fix indentation of block --- jenkinsapi/artifact.py | 4 +--- jenkinsapi/build.py | 7 +++++-- jenkinsapi/jenkins.py | 4 ++-- jenkinsapi/job.py | 3 +-- jenkinsapi/queue.py | 7 ++----- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/jenkinsapi/artifact.py b/jenkinsapi/artifact.py index 3ed7d9c..e4cccab 100644 --- a/jenkinsapi/artifact.py +++ b/jenkinsapi/artifact.py @@ -112,6 +112,4 @@ class Artifact(object): """ Produce a handy repr-string. """ - return """<%s.%s %s>""" % (self.__class__.__module__, - self.__class__.__name__, - self.url) + return """<%s.%s %s>""" % (self.__class__.__module__, self.__class__.__name__, self.url) diff --git a/jenkinsapi/build.py b/jenkinsapi/build.py index 6bcfae7..4e9c7d3 100644 --- a/jenkinsapi/build.py +++ b/jenkinsapi/build.py @@ -56,8 +56,11 @@ class Build(JenkinsBase): def _get_git_rev(self): # Sometimes we have None as part of actions. Filter those actions # which have lastBuiltRevision in them - _actions = [x for x in self._data['actions'] if x \ - and "lastBuiltRevision" in x] + _actions = [x for x in self._data['actions'] + if x and "lastBuiltRevision" in x] + # FIXME So this code returns the first item found in the filtered + # list. Why not just: + # `return _actions[0]["lastBuiltRevision"]["SHA1"]` for item in _actions: revision = item["lastBuiltRevision"]["SHA1"] return revision diff --git a/jenkinsapi/jenkins.py b/jenkinsapi/jenkins.py index 58c5d49..877def2 100644 --- a/jenkinsapi/jenkins.py +++ b/jenkinsapi/jenkins.py @@ -134,8 +134,8 @@ class Jenkins(JenkinsBase): :return: new Job obj """ params = {'name': newjobname, - 'mode': 'copy', - 'from': jobname} + 'mode': 'copy', + 'from': jobname} self.requester.post_and_confirm_status( self.get_create_url(), diff --git a/jenkinsapi/job.py b/jenkinsapi/job.py index 0a7ccc2..548de72 100644 --- a/jenkinsapi/job.py +++ b/jenkinsapi/job.py @@ -228,8 +228,7 @@ class Job(JenkinsBase, MutableJenkinsThing): # FIXME SO how is this supposed to work if build is false-y? # I don't think that builds *can* be false here, so I don't # understand the test above. - return dict((build["number"], build["url"]) - for build in builds) + return dict((build["number"], build["url"]) for build in builds) def get_revision_dict(self): """ diff --git a/jenkinsapi/queue.py b/jenkinsapi/queue.py index 43d2aa1..308a526 100644 --- a/jenkinsapi/queue.py +++ b/jenkinsapi/queue.py @@ -51,7 +51,7 @@ class Queue(JenkinsBase): return [QueueItem(**item) for item in self._data['items']] else: return [QueueItem(**item) for item in self._data['items'] - if item['task']['name'] == job_name] + if item['task']['name'] == job_name] def delete_item(self, queue_item): self.delete_item_by_id(queue_item.id) @@ -78,10 +78,7 @@ class QueueItem(object): return self.jenkins[self.task['name']] def __repr__(self): - return "<%s.%s %s>" % ( - self.__class__.__module__, - self.__class__.__name__, - str(self)) + return "<%s.%s %s>" % (self.__class__.__module__, self.__class__.__name__, str(self)) def __str__(self): return "%s #%i" % (self.task['name'], self.id) -- 2.34.1