libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [48/51] [abbrv] libcloud git commit: final linting updates
Date Mon, 09 Jan 2017 04:53:08 GMT
final linting updates


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

Branch: refs/heads/trunk
Commit: 6542456d1017e01a7c1318214bd900eb95265087
Parents: bd404be
Author: Anthony Shaw <anthonyshaw@apache.org>
Authored: Mon Jan 9 15:08:19 2017 +1100
Committer: Anthony Shaw <anthonyshaw@apache.org>
Committed: Mon Jan 9 15:08:19 2017 +1100

----------------------------------------------------------------------
 libcloud/test/storage/test_atmos.py       |  9 ++---
 libcloud/test/storage/test_azure_blobs.py |  5 ++-
 libcloud/test/storage/test_base.py        |  8 ++---
 libcloud/test/storage/test_cloudfiles.py  | 34 +++++++++----------
 libcloud/test/storage/test_oss.py         | 26 +++++++--------
 libcloud/test/storage/test_s3.py          | 46 +++++++++++---------------
 libcloud/test/test_connection.py          |  4 +--
 libcloud/test/test_httplib_ssl.py         |  1 -
 8 files changed, 60 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/6542456d/libcloud/test/storage/test_atmos.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_atmos.py b/libcloud/test/storage/test_atmos.py
index 1371b5a..7f6baf2 100644
--- a/libcloud/test/storage/test_atmos.py
+++ b/libcloud/test/storage/test_atmos.py
@@ -291,11 +291,11 @@ class AtmosTests(unittest.TestCase):
 
     def test_upload_object_success(self):
         def upload_file(self, object_name=None, content_type=None,
-            request_path=None, request_method=None,
-            headers=None, file_path=None, stream=None):
+                        request_path=None, request_method=None,
+                        headers=None, file_path=None, stream=None):
             return {'response': MockResponse(200, headers={'etag': '0cc175b9c0f1b6a831c399e269772661'}),
-                'bytes_transferred': 1000,
-                'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
+                    'bytes_transferred': 1000,
+                    'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
 
         old_func = AtmosDriver._upload_object
         AtmosDriver._upload_object = upload_file
@@ -750,6 +750,7 @@ class AtmosMockHttp(StorageMockHttp, unittest.TestCase):
     def _rest_namespace_fbc_ftu(self, method, url, body, headers):
         return (httplib.CREATED, '', {}, httplib.responses[httplib.CREATED])
 
+
 class AtmosMockRawResponse(MockRawResponse):
     fixtures = StorageFileFixtures('atmos')
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/6542456d/libcloud/test/storage/test_azure_blobs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_azure_blobs.py b/libcloud/test/storage/test_azure_blobs.py
index 356c31d..5eefbaa 100644
--- a/libcloud/test/storage/test_azure_blobs.py
+++ b/libcloud/test/storage/test_azure_blobs.py
@@ -38,7 +38,6 @@ from libcloud.storage.types import ObjectHashMismatchError
 from libcloud.storage.drivers.azure_blobs import AzureBlobsStorageDriver
 from libcloud.storage.drivers.azure_blobs import AZURE_BLOCK_MAX_SIZE
 from libcloud.storage.drivers.azure_blobs import AZURE_PAGE_CHUNK_SIZE
-from libcloud.storage.drivers.dummy import DummyIterator
 
 from libcloud.test import StorageMockHttp, MockRawResponse  # pylint: disable-msg=E0611
 from libcloud.test import MockHttpTestCase  # pylint: disable-msg=E0611
@@ -879,7 +878,7 @@ class AzureBlobsTests(unittest.TestCase):
 
         object_name = 'foo_test_upload'
         blob_size = AZURE_PAGE_CHUNK_SIZE
-        iterator = BytesIO(b('1'*blob_size))
+        iterator = BytesIO(b('1' * blob_size))
         extra = {'content_type': 'text/plain'}
         obj = self.driver.upload_object_via_stream(container=container,
                                                    object_name=object_name,
@@ -899,7 +898,7 @@ class AzureBlobsTests(unittest.TestCase):
 
         object_name = 'foo_test_upload'
         blob_size = AZURE_PAGE_CHUNK_SIZE
-        iterator = BytesIO(b('1'*blob_size))
+        iterator = BytesIO(b('1' * blob_size))
         extra = {'content_type': 'text/plain'}
         obj = self.driver.upload_object_via_stream(container=container,
                                                    object_name=object_name,

http://git-wip-us.apache.org/repos/asf/libcloud/blob/6542456d/libcloud/test/storage/test_base.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_base.py b/libcloud/test/storage/test_base.py
index 071fbae..66f0ae1 100644
--- a/libcloud/test/storage/test_base.py
+++ b/libcloud/test/storage/test_base.py
@@ -14,18 +14,14 @@
 # limitations under the License.
 
 import sys
-import hashlib
+
 from libcloud.utils.py3 import httplib
 from io import BytesIO
 
 from mock import Mock
 
 from libcloud.utils.py3 import StringIO
-from libcloud.utils.py3 import PY3
-from libcloud.utils.py3 import b, u
-
-if PY3:
-    from io import FileIO as file
+from libcloud.utils.py3 import b
 
 from libcloud.storage.base import StorageDriver
 from libcloud.storage.base import DEFAULT_CONTENT_TYPE

http://git-wip-us.apache.org/repos/asf/libcloud/blob/6542456d/libcloud/test/storage/test_cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_cloudfiles.py b/libcloud/test/storage/test_cloudfiles.py
index 32bf479..80fd697 100644
--- a/libcloud/test/storage/test_cloudfiles.py
+++ b/libcloud/test/storage/test_cloudfiles.py
@@ -38,7 +38,6 @@ from libcloud.storage.types import ObjectDoesNotExistError
 from libcloud.storage.types import ObjectHashMismatchError
 from libcloud.storage.types import InvalidContainerNameError
 from libcloud.storage.drivers.cloudfiles import CloudFilesStorageDriver
-from libcloud.storage.drivers.dummy import DummyIterator
 
 from libcloud.test import StorageMockHttp, MockRawResponse, MockResponse  # pylint: disable-msg=E0611
 from libcloud.test import MockHttpTestCase  # pylint: disable-msg=E0611
@@ -367,11 +366,11 @@ class CloudFilesTests(unittest.TestCase):
 
     def test_upload_object_success(self):
         def upload_file(self, object_name=None, content_type=None,
-            request_path=None, request_method=None,
-            headers=None, file_path=None, stream=None):
+                        request_path=None, request_method=None,
+                        headers=None, file_path=None, stream=None):
             return {'response': MockResponse(201, headers={'etag': '0cc175b9c0f1b6a831c399e269772661'}),
-                'bytes_transferred': 1000,
-                'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
+                    'bytes_transferred': 1000,
+                    'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
 
         old_func = CloudFilesStorageDriver._upload_object
         CloudFilesStorageDriver._upload_object = upload_file
@@ -389,11 +388,11 @@ class CloudFilesTests(unittest.TestCase):
 
     def test_upload_object_zero_size_object(self):
         def upload_file(self, object_name=None, content_type=None,
-            request_path=None, request_method=None,
-            headers=None, file_path=None, stream=None):
+                        request_path=None, request_method=None,
+                        headers=None, file_path=None, stream=None):
             return {'response': MockResponse(201, headers={'etag': '0cc175b9c0f1b6a831c399e269772661'}),
-                'bytes_transferred': 0,
-                'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
+                    'bytes_transferred': 0,
+                    'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
 
         old_func = CloudFilesStorageDriver._upload_object
         CloudFilesStorageDriver._upload_object = upload_file
@@ -422,12 +421,13 @@ class CloudFilesTests(unittest.TestCase):
 
     def test_upload_object_invalid_hash(self):
         CloudFilesMockRawResponse.type = 'INVALID_HASH'
+
         def upload_file(self, object_name=None, content_type=None,
-            request_path=None, request_method=None,
-            headers=None, file_path=None, stream=None):
+                        request_path=None, request_method=None,
+                        headers=None, file_path=None, stream=None):
             return {'response': MockResponse(201, headers={'etag': '0cc175b9c0f1b6a831c399e269772661'}),
-                'bytes_transferred': 1000,
-                'data_hash': 'blah blah'}
+                    'bytes_transferred': 1000,
+                    'data_hash': 'blah blah'}
 
         old_func = CloudFilesStorageDriver._upload_object
         CloudFilesStorageDriver._upload_object = upload_file
@@ -796,11 +796,11 @@ class CloudFilesTests(unittest.TestCase):
 
     def test_create_container_put_object_name_encoding(self):
         def upload_file(self, object_name=None, content_type=None,
-            request_path=None, request_method=None,
-            headers=None, file_path=None, stream=None):
+                        request_path=None, request_method=None,
+                        headers=None, file_path=None, stream=None):
             return {'response': MockResponse(201, headers={'etag': '0cc175b9c0f1b6a831c399e269772661'}),
-                'bytes_transferred': 1000,
-                'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
+                    'bytes_transferred': 1000,
+                    'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
 
         old_func = CloudFilesStorageDriver._upload_object
         CloudFilesStorageDriver._upload_object = upload_file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/6542456d/libcloud/test/storage/test_oss.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_oss.py b/libcloud/test/storage/test_oss.py
index 863817d..304b809 100644
--- a/libcloud/test/storage/test_oss.py
+++ b/libcloud/test/storage/test_oss.py
@@ -651,11 +651,11 @@ class OSSStorageDriverTestCase(unittest.TestCase):
 
     def test_upload_object_invalid_hash1(self):
         def upload_file(self, object_name=None, content_type=None,
-            request_path=None, request_method=None,
-            headers=None, file_path=None, stream=None):
-            return {'response': MockResponse(200, headers={'etag':'2345'}),
-                'bytes_transferred': 1000,
-                'data_hash': 'hash343hhash89h932439jsaa89'}
+                        request_path=None, request_method=None,
+                        headers=None, file_path=None, stream=None):
+            return {'response': MockResponse(200, headers={'etag': '2345'}),
+                    'bytes_transferred': 1000,
+                    'data_hash': 'hash343hhash89h932439jsaa89'}
 
         self.mock_raw_response_klass.type = 'INVALID_HASH1'
 
@@ -679,12 +679,12 @@ class OSSStorageDriverTestCase(unittest.TestCase):
 
     def test_upload_object_success(self):
         def upload_file(self, object_name=None, content_type=None,
-            request_path=None, request_method=None,
-            headers=None, file_path=None, stream=None):
+                        request_path=None, request_method=None,
+                        headers=None, file_path=None, stream=None):
             return {'response': MockResponse(200,
                                              headers={'etag': '0cc175b9c0f1b6a831c399e269772661'}),
-                'bytes_transferred': 1000,
-                'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
+                    'bytes_transferred': 1000,
+                    'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
         self.mock_response_klass.type = None
         old_func = self.driver_type._upload_object
         self.driver_type._upload_object = upload_file
@@ -705,11 +705,11 @@ class OSSStorageDriverTestCase(unittest.TestCase):
 
     def test_upload_object_with_acl(self):
         def upload_file(self, object_name=None, content_type=None,
-            request_path=None, request_method=None,
-            headers=None, file_path=None, stream=None):
+                        request_path=None, request_method=None,
+                        headers=None, file_path=None, stream=None):
             return {'response': MockResponse(200, headers={'etag': '0cc175b9c0f1b6a831c399e269772661'}),
-                'bytes_transferred': 1000,
-                'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
+                    'bytes_transferred': 1000,
+                    'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
 
         self.mock_response_klass.type = None
         old_func = self.driver_type._upload_object

http://git-wip-us.apache.org/repos/asf/libcloud/blob/6542456d/libcloud/test/storage/test_s3.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_s3.py b/libcloud/test/storage/test_s3.py
index d0cd255..1edbc46 100644
--- a/libcloud/test/storage/test_s3.py
+++ b/libcloud/test/storage/test_s3.py
@@ -46,7 +46,6 @@ from libcloud.storage.drivers.s3 import S3EUWestStorageDriver
 from libcloud.storage.drivers.s3 import S3APSEStorageDriver
 from libcloud.storage.drivers.s3 import S3APNEStorageDriver
 from libcloud.storage.drivers.s3 import CHUNK_SIZE
-from libcloud.storage.drivers.dummy import DummyIterator
 from libcloud.utils.py3 import b
 
 from libcloud.test import StorageMockHttp, MockRawResponse, MockResponse  # pylint: disable-msg=E0611
@@ -245,15 +244,10 @@ class S3MockHttp(StorageMockHttp, MockHttpTestCase):
     def _foo_bar_container_foo_test_stream_data_MULTIPART(self, method, url,
                                                           body, headers):
         headers = {'etag': '"0cc175b9c0f1b6a831c399e269772661"'}
-        TEST_ID = 'VXBsb2FkIElEIGZvciA2aWWpbmcncyBteS1tb3ZpZS5tMnRzIHVwbG9hZA'
-
-        query_string = urlparse.urlsplit(url).query
-        query = parse_qs(query_string)
-
         return (httplib.OK,
-                    body,
-                    headers,
-                    httplib.responses[httplib.OK])
+                body,
+                headers,
+                httplib.responses[httplib.OK])
 
     def _foo_bar_container_LIST_MULTIPART(self, method, url, body, headers):
         query_string = urlparse.urlsplit(url).query
@@ -709,11 +703,11 @@ class S3Tests(unittest.TestCase):
         # Invalid hash is detected on the amazon side and BAD_REQUEST is
         # returned
         def upload_file(self, object_name=None, content_type=None,
-            request_path=None, request_method=None,
-            headers=None, file_path=None, stream=None):
+                        request_path=None, request_method=None,
+                        headers=None, file_path=None, stream=None):
             return {'response': MockResponse(200),
-                'bytes_transferred': 1000,
-                'data_hash': 'hash343hhash89h932439jsaa89'}
+                    'bytes_transferred': 1000,
+                    'data_hash': 'hash343hhash89h932439jsaa89'}
 
         self.mock_raw_response_klass.type = 'INVALID_HASH1'
 
@@ -739,11 +733,11 @@ class S3Tests(unittest.TestCase):
         # Invalid hash is detected when comparing hash provided in the response
         # ETag header
         def upload_file(self, object_name=None, content_type=None,
-            request_path=None, request_method=None,
-            headers=None, file_path=None, stream=None):
+                        request_path=None, request_method=None,
+                        headers=None, file_path=None, stream=None):
             return {'response': MockResponse(200, headers={'etag': 'woopwoopwoop'}),
-                'bytes_transferred': 1000,
-                'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
+                    'bytes_transferred': 1000,
+                    'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
 
         self.mock_raw_response_klass.type = 'INVALID_HASH2'
 
@@ -768,12 +762,12 @@ class S3Tests(unittest.TestCase):
 
     def test_upload_object_success(self):
         def upload_file(self, object_name=None, content_type=None,
-            request_path=None, request_method=None,
-            headers=None, file_path=None, stream=None):
+                        request_path=None, request_method=None,
+                        headers=None, file_path=None, stream=None):
             return {'response': MockResponse(200,
                                              headers={'etag': '0cc175b9c0f1b6a831c399e269772661'}),
-                'bytes_transferred': 1000,
-                'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
+                    'bytes_transferred': 1000,
+                    'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
         self.mock_response_klass.type = None
         old_func = self.driver_type._upload_object
         self.driver_type._upload_object = upload_file
@@ -794,11 +788,11 @@ class S3Tests(unittest.TestCase):
 
     def test_upload_object_with_acl(self):
         def upload_file(self, object_name=None, content_type=None,
-            request_path=None, request_method=None,
-            headers=None, file_path=None, stream=None):
+                        request_path=None, request_method=None,
+                        headers=None, file_path=None, stream=None):
             return {'response': MockResponse(200, headers={'etag': '0cc175b9c0f1b6a831c399e269772661'}),
-                'bytes_transferred': 1000,
-                'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
+                    'bytes_transferred': 1000,
+                    'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
 
         self.mock_response_klass.type = None
         old_func = self.driver_type._upload_object
@@ -872,7 +866,7 @@ class S3Tests(unittest.TestCase):
         container = Container(name='foo_bar_container', extra={},
                               driver=self.driver)
         object_name = 'foo_test_stream_data'
-        iterator = BytesIO(b('234'*CHUNK_SIZE))
+        iterator = BytesIO(b('234' * CHUNK_SIZE))
         extra = {'content_type': 'text/plain'}
         obj = self.driver.upload_object_via_stream(container=container,
                                                    object_name=object_name,

http://git-wip-us.apache.org/repos/asf/libcloud/blob/6542456d/libcloud/test/test_connection.py
----------------------------------------------------------------------
diff --git a/libcloud/test/test_connection.py b/libcloud/test/test_connection.py
index d2bbbd0..b4743c3 100644
--- a/libcloud/test/test_connection.py
+++ b/libcloud/test/test_connection.py
@@ -19,7 +19,7 @@ import socket
 import sys
 import ssl
 
-from mock import Mock, call, patch
+from mock import Mock, patch
 
 from libcloud.test import unittest
 from libcloud.common.base import Connection
@@ -27,8 +27,6 @@ from libcloud.httplib_ssl import LibcloudBaseConnection
 from libcloud.httplib_ssl import LibcloudConnection
 from libcloud.utils.misc import retry
 
-import requests_mock
-
 
 class BaseConnectionClassTestCase(unittest.TestCase):
     def test_parse_proxy_url(self):

http://git-wip-us.apache.org/repos/asf/libcloud/blob/6542456d/libcloud/test/test_httplib_ssl.py
----------------------------------------------------------------------
diff --git a/libcloud/test/test_httplib_ssl.py b/libcloud/test/test_httplib_ssl.py
index da0ba53..55c705e 100644
--- a/libcloud/test/test_httplib_ssl.py
+++ b/libcloud/test/test_httplib_ssl.py
@@ -16,7 +16,6 @@
 import os
 import sys
 import os.path
-import mock
 from mock import patch
 
 import libcloud.security


Mime
View raw message