summaryrefslogtreecommitdiff
path: root/jenkinsapi
diff options
context:
space:
mode:
authorSalim Fadhley <sal@stodge.org>2014-07-30 01:14:29 +0100
committerSalim Fadhley <sal@stodge.org>2014-07-30 01:14:29 +0100
commit7b6cdb5ebcd92bae7d6e18edd5196af58703f1d5 (patch)
treef329399cdbe242da4623b24c56a7a3d6a8145e52 /jenkinsapi
parent404a5ccbe960c16904862ae74f3f87c9311987c8 (diff)
downloadpython-jenkinsapi-7b6cdb5ebcd92bae7d6e18edd5196af58703f1d5.tar.gz
python-jenkinsapi-7b6cdb5ebcd92bae7d6e18edd5196af58703f1d5.tar.bz2
python-jenkinsapi-7b6cdb5ebcd92bae7d6e18edd5196af58703f1d5.zip
pep8 tidyup and example of plugin querying
Diffstat (limited to 'jenkinsapi')
-rw-r--r--jenkinsapi/custom_exceptions.py2
-rw-r--r--jenkinsapi/plugin.py5
-rw-r--r--jenkinsapi/plugins.py2
-rw-r--r--jenkinsapi/utils/krb_requester.py4
-rw-r--r--jenkinsapi/utils/requester.py6
5 files changed, 11 insertions, 8 deletions
diff --git a/jenkinsapi/custom_exceptions.py b/jenkinsapi/custom_exceptions.py
index 1b323b6..ce536fa 100644
--- a/jenkinsapi/custom_exceptions.py
+++ b/jenkinsapi/custom_exceptions.py
@@ -51,12 +51,14 @@ class UnknownQueueItem(KeyError, NotFound):
"""
pass
+
class UnknownPlugin(KeyError, NotFound):
"""
Jenkins does not recognize the plugin requested.
"""
pass
+
class NoBuildData(NotFound):
"""
A job has no build data.
diff --git a/jenkinsapi/plugin.py b/jenkinsapi/plugin.py
index df4384f..2225dde 100644
--- a/jenkinsapi/plugin.py
+++ b/jenkinsapi/plugin.py
@@ -14,14 +14,13 @@ class Plugin(object):
def __eq__(self, other):
return self.__dict__ == other.__dict__
-
+
def __str__(self):
return self.shortName
-
+
def __repr__(self):
return "<%s.%s %s>" % (
self.__class__.__module__,
self.__class__.__name__,
str(self)
)
-
diff --git a/jenkinsapi/plugins.py b/jenkinsapi/plugins.py
index 996e291..a6c992b 100644
--- a/jenkinsapi/plugins.py
+++ b/jenkinsapi/plugins.py
@@ -54,7 +54,7 @@ class Plugins(JenkinsBase):
return self.get_plugins_dict()[plugin_name]
except KeyError:
raise UnknownPlugin(plugin_name)
-
+
def __contains__(self, plugin_name):
"""
True if plugin_name is the name of a defined plugin
diff --git a/jenkinsapi/utils/krb_requester.py b/jenkinsapi/utils/krb_requester.py
index 79fd77d..a9c4e7a 100644
--- a/jenkinsapi/utils/krb_requester.py
+++ b/jenkinsapi/utils/krb_requester.py
@@ -4,8 +4,10 @@ Kerberos aware Requester
from jenkinsapi.utils.requester import Requester
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
-#pylint: disable=W0222
+
+# pylint: disable=W0222
class KrbRequester(Requester):
+
"""
A class which carries out HTTP requests with Kerberos/GSSAPI authentication.
"""
diff --git a/jenkinsapi/utils/requester.py b/jenkinsapi/utils/requester.py
index d7a994f..e818f7a 100644
--- a/jenkinsapi/utils/requester.py
+++ b/jenkinsapi/utils/requester.py
@@ -63,7 +63,7 @@ class Requester(object):
requestKwargs['verify'] = self.ssl_verify
- if not data is None:
+ if data:
# It may seem odd, but some Jenkins operations require posting
# an empty string.
requestKwargs['data'] = data
@@ -112,7 +112,7 @@ class Requester(object):
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
response = self.post_url(url, params, data, files, headers)
- if not response.status_code in valid:
+ if response.status_code not in valid:
raise JenkinsAPIException('Operation failed. url={0}, data={1}, headers={2}, status={3}, text={4}'.format(
response.url, data, headers, response.status_code, response.text.encode('UTF-8')))
return response
@@ -120,7 +120,7 @@ class Requester(object):
def get_and_confirm_status(self, url, params=None, headers=None, valid=None):
valid = valid or self.VALID_STATUS_CODES
response = self.get_url(url, params, headers)
- if not response.status_code in valid:
+ if response.status_code not in valid:
if response.status_code == 405: # POST required
raise PostRequired('POST required for url {0}'.format(url))
else: