You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2017/01/09 04:52:36 UTC
[16/51] [abbrv] libcloud git commit: pylint issues
pylint issues
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/33a8d06a
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/33a8d06a
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/33a8d06a
Branch: refs/heads/trunk
Commit: 33a8d06a1bec9f463054467e6a3da7ceefd824cb
Parents: 5f25565
Author: Anthony Shaw <an...@apache.org>
Authored: Wed Jan 4 13:19:40 2017 +1100
Committer: Anthony Shaw <an...@apache.org>
Committed: Wed Jan 4 13:19:40 2017 +1100
----------------------------------------------------------------------
libcloud/common/base.py | 9 ++++++---
libcloud/common/ovh.py | 2 +-
libcloud/httplib_ssl.py | 3 ++-
libcloud/utils/loggingconnection.py | 4 ++--
requirements-tests.txt | 2 +-
5 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/33a8d06a/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index dce2f73..bff343e 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -193,6 +193,8 @@ class Response(object):
:rtype: ``bool``
:return: ``True`` or ``False``
"""
+ # See - https://github.com/kennethreitz/requests/issues/2417
+ #pylint: disable=E1101
return self.status in [requests.codes.ok, requests.codes.created,
httplib.OK, httplib.CREATED, httplib.ACCEPTED]
@@ -429,7 +431,8 @@ class Connection(object):
if getattr(self, 'base_url', None) and base_url is None:
(host, port,
- secure, request_path) = self._tuple_from_url(self.base_url)
+ secure, request_path) = \
+ self._tuple_from_url(getattr(self, 'base_url'))
elif base_url is not None:
(host, port,
secure, request_path) = self._tuple_from_url(base_url)
@@ -447,10 +450,10 @@ class Connection(object):
kwargs.update({'port': port})
if not hasattr(kwargs, 'key_file') and hasattr(self, 'key_file'):
- kwargs.update({'key_file': self.key_file})
+ kwargs.update({'key_file': getattr(self, 'key_file')})
if not hasattr(kwargs, 'cert_file') and hasattr(self, 'cert_file'):
- kwargs.update({'cert_file': self.cert_file})
+ kwargs.update({'cert_file': getattr(self, 'cert_file')})
# kwargs = {'host': host, 'port': int(port)}
http://git-wip-us.apache.org/repos/asf/libcloud/blob/33a8d06a/libcloud/common/ovh.py
----------------------------------------------------------------------
diff --git a/libcloud/common/ovh.py b/libcloud/common/ovh.py
index 0b342ab..0eae99b 100644
--- a/libcloud/common/ovh.py
+++ b/libcloud/common/ovh.py
@@ -102,7 +102,7 @@ class OvhConnection(ConnectionUserAndKey):
'Content-Type': 'application/json',
'X-Ovh-Application': user_id,
}
- httpcon = LibcloudConnection(self.host)
+ httpcon = LibcloudConnection(host=self.host, port=443)
httpcon.request(method='POST', url=action, body=data, headers=headers)
response = httpcon.getresponse()
http://git-wip-us.apache.org/repos/asf/libcloud/blob/33a8d06a/libcloud/httplib_ssl.py
----------------------------------------------------------------------
diff --git a/libcloud/httplib_ssl.py b/libcloud/httplib_ssl.py
index 5e78391..313db10 100644
--- a/libcloud/httplib_ssl.py
+++ b/libcloud/httplib_ssl.py
@@ -24,6 +24,7 @@ import socket
import requests
import libcloud.security
+from libcloud.utils.py3 import httplib
from libcloud.utils.py3 import urlparse
@@ -154,7 +155,7 @@ class LibcloudBaseConnection(object):
self.ca_cert = libcloud.security.CA_CERTS_PATH
-class LibcloudConnection(LibcloudBaseConnection):
+class LibcloudConnection(httplib.HTTPSConnection, LibcloudBaseConnection):
timeout = None
host = None
response = None
http://git-wip-us.apache.org/repos/asf/libcloud/blob/33a8d06a/libcloud/utils/loggingconnection.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/loggingconnection.py b/libcloud/utils/loggingconnection.py
index 71931b0..8577da4 100644
--- a/libcloud/utils/loggingconnection.py
+++ b/libcloud/utils/loggingconnection.py
@@ -39,7 +39,7 @@ from libcloud.utils.misc import lowercase_keys
from libcloud.utils.compression import decompress_data
-class LoggingBaseConnection():
+class LoggingBaseConnection(LibcloudConnection):
"""
Debug class to log all HTTP(s) requests as they could be made
with the curl command.
@@ -169,7 +169,7 @@ class LoggingBaseConnection():
return " ".join(cmd)
-class LoggingConnection(LoggingBaseConnection, LibcloudConnection):
+class LoggingConnection(LoggingBaseConnection):
"""
Utility Class for logging HTTPS connections
"""
http://git-wip-us.apache.org/repos/asf/libcloud/blob/33a8d06a/requirements-tests.txt
----------------------------------------------------------------------
diff --git a/requirements-tests.txt b/requirements-tests.txt
index 35db592..0fb1567 100644
--- a/requirements-tests.txt
+++ b/requirements-tests.txt
@@ -5,5 +5,5 @@ pylint>=1.5.5,<1.6
mock>=1.0.1,<1.1
coveralls
coverage<4.0
-requests
+requests<=1.12.4
requests_mock
\ No newline at end of file