Return-Path: X-Original-To: apmail-libcloud-notifications-archive@www.apache.org Delivered-To: apmail-libcloud-notifications-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A504A11EEC for ; Sat, 13 Sep 2014 16:46:18 +0000 (UTC) Received: (qmail 86920 invoked by uid 500); 13 Sep 2014 16:46:18 -0000 Delivered-To: apmail-libcloud-notifications-archive@libcloud.apache.org Received: (qmail 86888 invoked by uid 500); 13 Sep 2014 16:46:18 -0000 Mailing-List: contact notifications-help@libcloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@libcloud.apache.org Delivered-To: mailing list notifications@libcloud.apache.org Received: (qmail 86870 invoked by uid 500); 13 Sep 2014 16:46:18 -0000 Delivered-To: apmail-libcloud-commits@libcloud.apache.org Received: (qmail 86867 invoked by uid 99); 13 Sep 2014 16:46:18 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Sep 2014 16:46:18 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 506BC9C160E; Sat, 13 Sep 2014 16:46:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tomaz@apache.org To: commits@libcloud.apache.org Date: Sat, 13 Sep 2014 16:46:18 -0000 Message-Id: <2b60cbd89e674ad5972cbf2e23d31c32@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: Fix some pylint violations. Repository: libcloud Updated Branches: refs/heads/trunk 49a1b016d -> 688ec7550 Fix some pylint violations. Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ad43fc47 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ad43fc47 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ad43fc47 Branch: refs/heads/trunk Commit: ad43fc476c5d2c11963696400a1c7d7aa958e56b Parents: 49a1b01 Author: Tomaz Muraus Authored: Thu Sep 11 19:02:56 2014 +0200 Committer: Tomaz Muraus Committed: Sat Sep 13 17:45:15 2014 +0200 ---------------------------------------------------------------------- libcloud/common/linode.py | 6 +++++- libcloud/dns/base.py | 3 +++ libcloud/httplib_ssl.py | 6 ++++-- libcloud/pricing.py | 6 +++++- libcloud/storage/drivers/cloudfiles.py | 8 ++++++++ libcloud/storage/drivers/local.py | 6 +++--- libcloud/storage/drivers/nimbus.py | 6 +++--- libcloud/storage/drivers/s3.py | 3 +++ libcloud/utils/py3.py | 2 ++ 9 files changed, 36 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/ad43fc47/libcloud/common/linode.py ---------------------------------------------------------------------- diff --git a/libcloud/common/linode.py b/libcloud/common/linode.py index c547514..2d60500 100644 --- a/libcloud/common/linode.py +++ b/libcloud/common/linode.py @@ -75,7 +75,11 @@ class LinodeResponse(JsonResponse): } libcloud does not take advantage of batching, so a response will always - reflect the above format. A few weird quirks are caught here as well.""" + reflect the above format. A few weird quirks are caught here as well. + """ + + objects = None + def __init__(self, response, connection): """Instantiate a LinodeResponse from the HTTP response http://git-wip-us.apache.org/repos/asf/libcloud/blob/ad43fc47/libcloud/dns/base.py ---------------------------------------------------------------------- diff --git a/libcloud/dns/base.py b/libcloud/dns/base.py index 0e3ac6f..f09ccc1 100644 --- a/libcloud/dns/base.py +++ b/libcloud/dns/base.py @@ -154,6 +154,9 @@ class DNSDriver(BaseDriver): name = None website = None + # Map libcloud record type enum to provider record type name + RECORD_TYPE_MAP = {} + def __init__(self, key, secret=None, secure=True, host=None, port=None, **kwargs): """ http://git-wip-us.apache.org/repos/asf/libcloud/blob/ad43fc47/libcloud/httplib_ssl.py ---------------------------------------------------------------------- diff --git a/libcloud/httplib_ssl.py b/libcloud/httplib_ssl.py index 104bf34..7787e7b 100644 --- a/libcloud/httplib_ssl.py +++ b/libcloud/httplib_ssl.py @@ -136,9 +136,11 @@ class LibcloudBaseConnection(object): if hasattr(self, 'set_tunnel'): # Python 2.7 and higher + # pylint: disable=no-member self.set_tunnel(host=self.host, port=self.port, headers=headers) elif hasattr(self, '_set_tunnel'): # Python 2.6 + # pylint: disable=no-member self._set_tunnel(host=self.host, port=self.port, headers=headers) else: raise ValueError('Unsupported Python version') @@ -147,7 +149,7 @@ class LibcloudBaseConnection(object): def _activate_http_proxy(self, sock): self.sock = sock - self._tunnel() + self._tunnel() # pylint: disable=no-member def _set_hostport(self, host, port): """ @@ -165,7 +167,7 @@ class LibcloudBaseConnection(object): raise httplib.InvalidURL(msg) host = host[:i] else: - port = self.default_port + port = self.default_port # pylint: disable=no-member if host and host[0] == '[' and host[-1] == ']': host = host[1:-1] self.host = host http://git-wip-us.apache.org/repos/asf/libcloud/blob/ad43fc47/libcloud/pricing.py ---------------------------------------------------------------------- diff --git a/libcloud/pricing.py b/libcloud/pricing.py index ebe99a8..1dbdf20 100644 --- a/libcloud/pricing.py +++ b/libcloud/pricing.py @@ -23,8 +23,10 @@ from os.path import join as pjoin try: import simplejson as json + JSONDecodeError = json.JSONDecodeError except ImportError: import json + JSONDecodeError = ValueError from libcloud.utils.connection import get_response_object @@ -95,6 +97,7 @@ def get_pricing(driver_type, driver_name, pricing_file_path=None): size_pricing = pricing_data[driver_type][driver_name] for driver_type in VALID_PRICING_DRIVER_TYPES: + # pylint: disable=maybe-no-member pricing = pricing_data.get(driver_type, None) if pricing: PRICING_DATA[driver_type] = pricing @@ -203,10 +206,11 @@ def download_pricing_file(file_url=DEFAULT_FILE_URL, # Verify pricing file is valid try: data = json.loads(body) - except json.decoder.JSONDecodeError: + except JSONDecodeError: msg = 'Provided URL doesn\'t contain valid pricing data' raise Exception(msg) + # pylint: disable=maybe-no-member if not data.get('updated', None): msg = 'Provided URL doesn\'t contain valid pricing data' raise Exception(msg) http://git-wip-us.apache.org/repos/asf/libcloud/blob/ad43fc47/libcloud/storage/drivers/cloudfiles.py ---------------------------------------------------------------------- diff --git a/libcloud/storage/drivers/cloudfiles.py b/libcloud/storage/drivers/cloudfiles.py index b0694ac..a2189c1 100644 --- a/libcloud/storage/drivers/cloudfiles.py +++ b/libcloud/storage/drivers/cloudfiles.py @@ -307,6 +307,7 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin): raise LibcloudError('Unexpected status code: %s' % (response.status)) def get_container_cdn_url(self, container): + # pylint: disable=unexpected-keyword-arg container_name_encoded = self._encode_container_name(container.name) response = self.connection.request('/%s' % (container_name_encoded), method='HEAD', @@ -339,6 +340,7 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin): if ex_ttl: headers['X-TTL'] = ex_ttl + # pylint: disable=unexpected-keyword-arg response = self.connection.request('/%s' % (container_name), method='PUT', headers=headers, @@ -467,6 +469,7 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin): object_name = self._encode_object_name(obj.name) headers = {'X-Purge-Email': email} if email else {} + # pylint: disable=unexpected-keyword-arg response = self.connection.request('/%s/%s' % (container_name, object_name), method='DELETE', @@ -538,6 +541,7 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin): container_name = container.name headers = {'X-Container-Meta-Web-Index': index_file} + # pylint: disable=unexpected-keyword-arg response = self.connection.request('/%s' % (container_name), method='POST', headers=headers, @@ -561,6 +565,7 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin): container_name = container.name headers = {'X-Container-Meta-Web-Error': file_name} + # pylint: disable=unexpected-keyword-arg response = self.connection.request('/%s' % (container_name), method='POST', headers=headers, @@ -580,6 +585,7 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin): """ headers = {'X-Account-Meta-Temp-URL-Key': key} + # pylint: disable=unexpected-keyword-arg response = self.connection.request('', method='POST', headers=headers, @@ -607,6 +613,7 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin): :rtype: ``bool`` """ + # pylint: disable=no-member self.connection._populate_hosts_and_request_paths() expires = int(time() + timeout) path = '%s/%s/%s' % (self.connection.request_path, @@ -654,6 +661,7 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin): object_name_encoded = self._encode_object_name(object_name) request_path = '/%s/%s' % (container_name_encoded, object_name_encoded) + # pylint: disable=no-member headers = {'X-Auth-Token': self.connection.auth_token, 'X-Object-Manifest': '%s/%s/' % (container_name_encoded, http://git-wip-us.apache.org/repos/asf/libcloud/blob/ad43fc47/libcloud/storage/drivers/local.py ---------------------------------------------------------------------- diff --git a/libcloud/storage/drivers/local.py b/libcloud/storage/drivers/local.py index 5e326f9..985243d 100644 --- a/libcloud/storage/drivers/local.py +++ b/libcloud/storage/drivers/local.py @@ -90,9 +90,9 @@ class LocalStorageDriver(StorageDriver): if not os.path.isdir(self.base_path): raise LibcloudError('The base path is not a directory') - super(StorageDriver, self).__init__(key=key, secret=secret, - secure=secure, host=host, - port=port, **kwargs) + super(LocalStorageDriver, self).__init__(key=key, secret=secret, + secure=secure, host=host, + port=port, **kwargs) def _make_path(self, path, ignore_existing=True): """ http://git-wip-us.apache.org/repos/asf/libcloud/blob/ad43fc47/libcloud/storage/drivers/nimbus.py ---------------------------------------------------------------------- diff --git a/libcloud/storage/drivers/nimbus.py b/libcloud/storage/drivers/nimbus.py index b649e8b..583aefb 100644 --- a/libcloud/storage/drivers/nimbus.py +++ b/libcloud/storage/drivers/nimbus.py @@ -41,7 +41,7 @@ class NimbusResponse(JsonResponse): if self.status in [httplib.UNAUTHORIZED]: raise InvalidCredsError(self.body) raise LibcloudError('Unknown error. Status code: %d' % (self.status), - driver=self.driver) + driver=self.connection.driver) class NimbusConnection(ConnectionUserAndKey): @@ -89,13 +89,13 @@ class NimbusStorageDriver(StorageDriver): def iterate_containers(self): response = self.connection.request('/customers/%s/collections' % - (self.connection.user_id)) + (self.user_id)) return self._to_containers(response.object) def create_container(self, container_name): params = {'action': 'create', 'name': container_name} response = self.connection.request('/customers/%s/collections' % - (self.connection.user_id), + (self.user_id), params=params, method='POST') return self._to_container(response.object) http://git-wip-us.apache.org/repos/asf/libcloud/blob/ad43fc47/libcloud/storage/drivers/s3.py ---------------------------------------------------------------------- diff --git a/libcloud/storage/drivers/s3.py b/libcloud/storage/drivers/s3.py index 9577f98..862f076 100644 --- a/libcloud/storage/drivers/s3.py +++ b/libcloud/storage/drivers/s3.py @@ -602,6 +602,7 @@ class BaseS3StorageDriver(StorageDriver): if response.status != httplib.OK: element = response.object + # pylint: disable=maybe-no-member code, message = response._parse_error_details(element=element) msg = 'Error in multipart commit: %s (%s)' % (message, code) raise LibcloudError(msg, driver=self) @@ -730,6 +731,7 @@ class BaseS3StorageDriver(StorageDriver): driver=self) body = response.parse_body() + # pylint: disable=maybe-no-member for node in body.findall(fixxpath(xpath='Upload', namespace=self.namespace)): @@ -748,6 +750,7 @@ class BaseS3StorageDriver(StorageDriver): initiator, owner) # Check if this is the last entry in the listing + # pylint: disable=maybe-no-member is_truncated = body.findtext(fixxpath(xpath='IsTruncated', namespace=self.namespace)) http://git-wip-us.apache.org/repos/asf/libcloud/blob/ad43fc47/libcloud/utils/py3.py ---------------------------------------------------------------------- diff --git a/libcloud/utils/py3.py b/libcloud/utils/py3.py index 2e4fc38..4e05419 100644 --- a/libcloud/utils/py3.py +++ b/libcloud/utils/py3.py @@ -58,6 +58,7 @@ if PY3: from io import StringIO import urllib import urllib as urllib2 + # pylint: disable=no-name-in-module import urllib.parse as urlparse import xmlrpc.client as xmlrpclib @@ -180,6 +181,7 @@ if PY25: # Taken from http://jimmyg.org/work/code/barenecessities/index.html # (MIT license) + # pylint: disable=function-redefined def relpath(path, start=posixpath.curdir): # NOQA """Return a relative version of a path""" if not path: