You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/09/28 13:24:34 UTC
git commit: pep8 style fixes and add some missing docstrings.
Updated Branches:
refs/heads/trunk f01e06373 -> 14eba1d25
pep8 style fixes and add some missing docstrings.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/14eba1d2
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/14eba1d2
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/14eba1d2
Branch: refs/heads/trunk
Commit: 14eba1d2536a8e5c789fdc566ea4dc7757457e45
Parents: f01e063
Author: Tomaz Muraus <to...@apache.org>
Authored: Sat Sep 28 13:21:34 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sat Sep 28 13:21:34 2013 +0200
----------------------------------------------------------------------
libcloud/common/types.py | 4 ++--
libcloud/utils/connection.py | 13 ++++++++++++-
libcloud/utils/dist.py | 8 +++++---
libcloud/utils/publickey.py | 3 +--
4 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/14eba1d2/libcloud/common/types.py
----------------------------------------------------------------------
diff --git a/libcloud/common/types.py b/libcloud/common/types.py
index 09ae697..98250c1 100644
--- a/libcloud/common/types.py
+++ b/libcloud/common/types.py
@@ -138,7 +138,7 @@ class LazyList(object):
def _load_all(self):
while not self._exhausted:
newdata, self._last_key, self._exhausted = \
- self._get_more(last_key=self._last_key,
- value_dict=self._value_dict)
+ self._get_more(last_key=self._last_key,
+ value_dict=self._value_dict)
self._data.extend(newdata)
self._all_loaded = True
http://git-wip-us.apache.org/repos/asf/libcloud/blob/14eba1d2/libcloud/utils/connection.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/connection.py b/libcloud/utils/connection.py
index bd2b50d..db381a3 100644
--- a/libcloud/utils/connection.py
+++ b/libcloud/utils/connection.py
@@ -22,10 +22,21 @@ __all__ = [
def get_response_object(url):
+ """
+ Utility function which uses libcloud's connection class to issue an HTTP
+ request.
+
+ :param url: URL to send the request to.
+ :type url: ``str``
+
+ :return: Response object.
+ :rtype: :class:`Response`.
+ """
parsed_url = urlparse.urlparse(url)
parsed_qs = parse_qs(parsed_url.query)
secure = parsed_url.scheme == 'https'
con = Connection(secure=secure, host=parsed_url.netloc)
- response = con.request(method='GET', action=parsed_url.path, params=parsed_qs)
+ response = con.request(method='GET', action=parsed_url.path,
+ params=parsed_qs)
return response
http://git-wip-us.apache.org/repos/asf/libcloud/blob/14eba1d2/libcloud/utils/dist.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/dist.py b/libcloud/utils/dist.py
index 1b426cf..3b9b8a7 100644
--- a/libcloud/utils/dist.py
+++ b/libcloud/utils/dist.py
@@ -40,6 +40,7 @@ def _filter_names(names):
and (not n.endswith('.py'))]
return names
+
def relative_to(base, relativee):
"""
Gets 'relativee' relative to 'basepath'.
@@ -48,7 +49,7 @@ def relative_to(base, relativee):
>>> relative_to('/home/', '/home/radix/')
'radix'
- >>> relative_to('.', '/home/radix/Projects/Twisted') # curdir is /home/radix
+ >>> relative_to('.', '/home/radix/Projects/Twisted')
'Projects/Twisted'
The 'relativee' must be a child of 'basepath'.
@@ -62,6 +63,7 @@ def relative_to(base, relativee):
return os.path.join(base, relative)
raise ValueError("%s is not a subpath of %s" % (relativee, basepath))
+
def get_packages(dname, pkgname=None, results=None, ignore=None, parent=None):
"""
Get all packages which are under dname. This is necessary for
@@ -87,8 +89,8 @@ def get_packages(dname, pkgname=None, results=None, ignore=None, parent=None):
results.append(prefix + pkgname + [bname])
for subdir in filter(os.path.isdir, abssubfiles):
get_packages(subdir, pkgname=pkgname + [bname],
- results=results, ignore=ignore,
- parent=parent)
+ results=results, ignore=ignore,
+ parent=parent)
res = ['.'.join(result) for result in results]
return res
http://git-wip-us.apache.org/repos/asf/libcloud/blob/14eba1d2/libcloud/utils/publickey.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/publickey.py b/libcloud/utils/publickey.py
index a0915d5..d9e59b9 100644
--- a/libcloud/utils/publickey.py
+++ b/libcloud/utils/publickey.py
@@ -15,7 +15,6 @@
import base64
import hashlib
-import struct
__all__ = [
'get_pubkey_openssh_fingerprint',
@@ -24,7 +23,7 @@ __all__ = [
]
try:
- from Crypto.Util.asn1 import DerSequence, DerObject, DerNull
+ from Crypto.Util.asn1 import DerSequence, DerObject
from Crypto.PublicKey.RSA import algorithmIdentifier, importKey
pycrypto_available = True
except ImportError: