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 2015/02/07 23:04:10 UTC

[2/2] libcloud git commit: Fix pep8 violations which were exposed / reported by new version of pep8.

Fix pep8 violations which were exposed / reported by new version of pep8.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/afed2cbd
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/afed2cbd
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/afed2cbd

Branch: refs/heads/trunk
Commit: afed2cbdec632441f95641b0c649fd78ecc18761
Parents: 9fa921e
Author: Tomaz Muraus <to...@apache.org>
Authored: Sat Feb 7 22:54:36 2015 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sat Feb 7 22:54:36 2015 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/ec2.py            | 10 +++++-----
 libcloud/compute/drivers/profitbricks.py   |  2 +-
 libcloud/dns/drivers/softlayer.py          |  2 +-
 libcloud/httplib_ssl.py                    |  4 ++--
 libcloud/loadbalancer/drivers/brightbox.py |  4 +++-
 libcloud/storage/drivers/azure_blobs.py    |  2 +-
 libcloud/storage/drivers/s3.py             |  5 +++--
 libcloud/test/compute/test_dreamhost.py    |  4 ++--
 libcloud/test/compute/test_openstack.py    |  2 +-
 9 files changed, 19 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/afed2cbd/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index c070d79..df71eb6 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -2530,7 +2530,7 @@ class BaseEC2NodeDriver(NodeDriver):
         """
         params = {'Action': 'CopyImage',
                   'SourceRegion': source_region,
-                  'SourceImageId':    image.id}
+                  'SourceImageId': image.id}
 
         if name is not None:
             params['Name'] = name
@@ -2791,7 +2791,7 @@ class BaseEC2NodeDriver(NodeDriver):
         """
         params = {'Action': 'CreateVpc',
                   'CidrBlock': cidr_block,
-                  'InstanceTenancy':  instance_tenancy}
+                  'InstanceTenancy': instance_tenancy}
 
         response = self.connection.request(self.path, params=params).object
         element = response.findall(fixxpath(xpath='vpc',
@@ -5422,9 +5422,9 @@ class BaseEC2NodeDriver(NodeDriver):
                             xpath='groupSet/item',
                             namespace=NAMESPACE):
             groups.append({
-                'group_id':   findtext(element=item,
-                                       xpath='groupId',
-                                       namespace=NAMESPACE),
+                'group_id': findtext(element=item,
+                                     xpath='groupId',
+                                     namespace=NAMESPACE),
                 'group_name': findtext(element=item,
                                        xpath='groupName',
                                        namespace=NAMESPACE)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/afed2cbd/libcloud/compute/drivers/profitbricks.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/profitbricks.py b/libcloud/compute/drivers/profitbricks.py
index 7b23cab..fa33f0c 100644
--- a/libcloud/compute/drivers/profitbricks.py
+++ b/libcloud/compute/drivers/profitbricks.py
@@ -96,7 +96,7 @@ class ProfitBricksConnection(ConnectionUserAndKey):
         soap_env = ET.Element('soapenv:Envelope', {
             'xmlns:soapenv': 'http://schemas.xmlsoap.org/soap/envelope/',
             'xmlns:ws': 'http://ws.api.profitbricks.com/'
-            })
+        })
         ET.SubElement(soap_env, 'soapenv:Header')
         soap_body = ET.SubElement(soap_env, 'soapenv:Body')
         soap_req_body = ET.SubElement(soap_body, 'ws:%s' % (data['action']))

http://git-wip-us.apache.org/repos/asf/libcloud/blob/afed2cbd/libcloud/dns/drivers/softlayer.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/softlayer.py b/libcloud/dns/drivers/softlayer.py
index 43a537c..04b4a8c 100644
--- a/libcloud/dns/drivers/softlayer.py
+++ b/libcloud/dns/drivers/softlayer.py
@@ -200,7 +200,7 @@ class SoftLayerDNSDriver(DNSDriver):
             'mxPriority': item['mxPriority'],
             'refresh': item['refresh'],
             'retry': item['retry'],
-            }
+        }
         record = Record(
             id=item['id'],
             name=item['host'],

http://git-wip-us.apache.org/repos/asf/libcloud/blob/afed2cbd/libcloud/httplib_ssl.py
----------------------------------------------------------------------
diff --git a/libcloud/httplib_ssl.py b/libcloud/httplib_ssl.py
index bd138a7..52d1ed1 100644
--- a/libcloud/httplib_ssl.py
+++ b/libcloud/httplib_ssl.py
@@ -164,9 +164,9 @@ class LibcloudBaseConnection(object):
             j = host.rfind(']')         # ipv6 addresses have [...]
             if i > j:
                 try:
-                    port = int(host[i+1:])
+                    port = int(host[i + 1:])
                 except ValueError:
-                    msg = "nonnumeric port: '%s'" % host[i+1:]
+                    msg = "nonnumeric port: '%s'" % (host[i + 1:])
                     raise httplib.InvalidURL(msg)
                 host = host[:i]
             else:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/afed2cbd/libcloud/loadbalancer/drivers/brightbox.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/brightbox.py b/libcloud/loadbalancer/drivers/brightbox.py
index 22310d4..9788a1e 100644
--- a/libcloud/loadbalancer/drivers/brightbox.py
+++ b/libcloud/loadbalancer/drivers/brightbox.py
@@ -102,7 +102,9 @@ class BrightboxLBDriver(Driver):
 
         data = self.connection.request(path).object
 
-        func = lambda data: self._node_to_member(data, balancer)
+        def func(data):
+            return self._node_to_member(data, balancer)
+
         return list(map(func, data['nodes']))
 
     def _post(self, path, data={}):

http://git-wip-us.apache.org/repos/asf/libcloud/blob/afed2cbd/libcloud/storage/drivers/azure_blobs.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/azure_blobs.py b/libcloud/storage/drivers/azure_blobs.py
index 8d00a8d..13d42f6 100644
--- a/libcloud/storage/drivers/azure_blobs.py
+++ b/libcloud/storage/drivers/azure_blobs.py
@@ -654,7 +654,7 @@ class AzureBlobsStorageDriver(StorageDriver):
             else:
                 headers['x-ms-page-write'] = 'update'
                 headers['x-ms-range'] = 'bytes=%d-%d' % \
-                    (offset, bytes_transferred-1)
+                    (offset, (bytes_transferred - 1))
 
             # Renew lease before updating
             lease.renew()

http://git-wip-us.apache.org/repos/asf/libcloud/blob/afed2cbd/libcloud/storage/drivers/s3.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/s3.py b/libcloud/storage/drivers/s3.py
index cd7eb8a..60e5562 100644
--- a/libcloud/storage/drivers/s3.py
+++ b/libcloud/storage/drivers/s3.py
@@ -720,8 +720,9 @@ class BaseS3StorageDriver(StorageDriver):
         if delimiter:
             params['delimiter'] = delimiter
 
-        finder = lambda node, text: node.findtext(fixxpath(xpath=text,
-                                                  namespace=self.namespace))
+        def finder(node, text):
+            return node.findtext(fixxpath(xpath=text,
+                                          namespace=self.namespace))
 
         while True:
             response = self.connection.request(request_path, params=params)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/afed2cbd/libcloud/test/compute/test_dreamhost.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_dreamhost.py b/libcloud/test/compute/test_dreamhost.py
index d9cef5c..eed6469 100644
--- a/libcloud/test/compute/test_dreamhost.py
+++ b/libcloud/test/compute/test_dreamhost.py
@@ -236,7 +236,7 @@ class DreamhostMockHttp(MockHttp):
                 'ps': 'ps22175',
                 'start_date': '2010-02-25',
                 'type': 'mysql'
-            }]
+        }]
         result = 'success'
         body = json.dumps({'data': data, 'result': result})
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
@@ -249,7 +249,7 @@ class DreamhostMockHttp(MockHttp):
             {
                 'description': 'Private MySQL server',
                 'image': 'mysql'
-            }]
+        }]
         result = 'success'
         body = json.dumps({'data': data, 'result': result})
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])

http://git-wip-us.apache.org/repos/asf/libcloud/blob/afed2cbd/libcloud/test/compute/test_openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_openstack.py b/libcloud/test/compute/test_openstack.py
index 0640898..7a20d04 100644
--- a/libcloud/test/compute/test_openstack.py
+++ b/libcloud/test/compute/test_openstack.py
@@ -616,7 +616,7 @@ class OpenStackMockHttp(MockHttpTestCase):
         return (httplib.OK, body, self.json_content_headers, httplib.responses[httplib.OK])
 
     def _v1_1_auth_INTERNAL_SERVER_ERROR(self, method, url, body, headers):
-        return (httplib.INTERNAL_SERVER_ERROR, "<h1>500: Internal Server Error</h1>",  {'content-type': 'text/html'},
+        return (httplib.INTERNAL_SERVER_ERROR, "<h1>500: Internal Server Error</h1>", {'content-type': 'text/html'},
                 httplib.responses[httplib.INTERNAL_SERVER_ERROR])