diff --git a/swiftclient/authv1.py b/swiftclient/authv1.py index 705dcb40..84bc38ae 100644 --- a/swiftclient/authv1.py +++ b/swiftclient/authv1.py @@ -68,7 +68,7 @@ UTC = _UTC() del _UTC -class ServiceCatalogV1(object): +class ServiceCatalogV1: def __init__(self, auth_url, storage_url, account): self.auth_url = auth_url self._storage_url = storage_url @@ -148,7 +148,7 @@ class ServiceCatalogV1(object): raise exceptions.EndpointNotFound(msg) -class AccessInfoV1(object): +class AccessInfoV1: """An object for encapsulating a raw v1 auth token.""" def __init__(self, auth_url, storage_url, account, username, auth_token, diff --git a/swiftclient/client.py b/swiftclient/client.py index df5344df..a9130ab5 100644 --- a/swiftclient/client.py +++ b/swiftclient/client.py @@ -217,7 +217,7 @@ def encode_meta_headers(headers): return ret -class _ObjectBody(object): +class _ObjectBody: """ Readable and iterable object body response wrapper. """ @@ -331,7 +331,7 @@ class _RetryBody(_ObjectBody): return buf -class HTTPConnection(object): +class HTTPConnection: def __init__(self, url, proxy=None, cacert=None, insecure=False, cert=None, cert_key=None, ssl_compression=False, default_user_agent=None, timeout=None): @@ -1634,7 +1634,7 @@ def get_capabilities(http_conn): return parse_api_response(resp_headers, body) -class Connection(object): +class Connection: """ Convenience class to make requests that will also retry the request diff --git a/swiftclient/multithreading.py b/swiftclient/multithreading.py index cf72360e..eaccec68 100644 --- a/swiftclient/multithreading.py +++ b/swiftclient/multithreading.py @@ -19,7 +19,7 @@ from concurrent.futures import ThreadPoolExecutor from queue import PriorityQueue -class OutputManager(object): +class OutputManager: """ One object to manage and provide helper functions for output. @@ -108,7 +108,7 @@ class OutputManager(object): self.error_print_pool.submit(self._print_error, msg, count=0) -class MultiThreadingManager(object): +class MultiThreadingManager: """ One object to manage context for multi-threading. This should make bin/swift less error-prone and allow us to test this code. diff --git a/swiftclient/service.py b/swiftclient/service.py index 289e29e8..4a7b1205 100644 --- a/swiftclient/service.py +++ b/swiftclient/service.py @@ -315,7 +315,7 @@ def split_headers(options, prefix=''): return headers -class SwiftUploadObject(object): +class SwiftUploadObject: """ Class for specifying an object upload, allowing the object source, name and options to be specified separately for each individual object. @@ -341,7 +341,7 @@ class SwiftUploadObject(object): self.source = source -class SwiftPostObject(object): +class SwiftPostObject: """ Class for specifying an object post, allowing the headers/metadata to be specified separately for each individual object. @@ -355,7 +355,7 @@ class SwiftPostObject(object): self.options = options -class SwiftDeleteObject(object): +class SwiftDeleteObject: """ Class for specifying an object delete, allowing the headers/metadata to be specified separately for each individual object. @@ -369,7 +369,7 @@ class SwiftDeleteObject(object): self.options = options -class SwiftCopyObject(object): +class SwiftCopyObject: """ Class for specifying an object copy, allowing the destination/headers/metadata/fresh_metadata to be specified @@ -405,7 +405,7 @@ class SwiftCopyObject(object): ) -class _SwiftReader(object): +class _SwiftReader: """ Class for downloading objects from swift and raising appropriate errors on failures caused by either invalid md5sum or size of the @@ -470,7 +470,7 @@ class _SwiftReader(object): return self._actual_read -class SwiftService(object): +class SwiftService: """ Service for performing swift operations """ diff --git a/swiftclient/utils.py b/swiftclient/utils.py index 03e5e7b2..e99ed37f 100644 --- a/swiftclient/utils.py +++ b/swiftclient/utils.py @@ -254,7 +254,7 @@ def report_traceback(): return None, None -class NoopMD5(object): +class NoopMD5: def __init__(self, *a, **kw): pass @@ -265,7 +265,7 @@ class NoopMD5(object): return '' -class ReadableToIterable(object): +class ReadableToIterable: """ Wrap a filelike object and act as an iterator. @@ -314,7 +314,7 @@ class ReadableToIterable(object): return self -class LengthWrapper(object): +class LengthWrapper: """ Wrap a filelike object with a maximum length. diff --git a/test/unit/test_authv1.py b/test/unit/test_authv1.py index 2ddf24b3..c16227fb 100644 --- a/test/unit/test_authv1.py +++ b/test/unit/test_authv1.py @@ -22,7 +22,7 @@ from keystoneauth1 import exceptions from swiftclient import authv1 -class TestDataNoAccount(object): +class TestDataNoAccount: options = dict( auth_url='http://saio:8080/auth/v1.0', username='test:tester', @@ -32,7 +32,7 @@ class TestDataNoAccount(object): token = 'token' -class TestDataWithAccount(object): +class TestDataWithAccount: options = dict( auth_url='http://saio:8080/auth/v1.0', username='test2:tester2', diff --git a/test/unit/test_swiftclient.py b/test/unit/test_swiftclient.py index 55c18fab..673f65fc 100644 --- a/test/unit/test_swiftclient.py +++ b/test/unit/test_swiftclient.py @@ -101,7 +101,7 @@ class TestClientException(unittest.TestCase): self.assertIn('(txn: some-other-id)', str(exc)) -class MockHttpResponse(object): +class MockHttpResponse: def __init__(self, status=0, headers=None, verify=False): self.status = status self.status_code = status @@ -115,7 +115,7 @@ class MockHttpResponse(object): self.headers.update(headers) self.closed = False - class Raw(object): + class Raw: def __init__(self, headers): self.headers = headers @@ -586,10 +586,10 @@ class TestGetAuth(MockHttpTest): "application_credential_id": "proejct_id", "application_credential_secret": "secret"} - class FakeEndpointData(object): + class FakeEndpointData: catalog_url = 'http://swift.cluster/v1/KEY_project_id' - class FakeKeystoneuth1v3Session(object): + class FakeKeystoneuth1v3Session: def __init__(self, auth): self.auth = auth @@ -2543,7 +2543,7 @@ class TestConnection(MockHttpTest): def test_reset_stream(self): - class LocalContents(object): + class LocalContents: def __init__(self, tell_value=0): self.data = io.BytesIO(string.ascii_letters.encode() * 10) @@ -2565,7 +2565,7 @@ class TestConnection(MockHttpTest): self.reads.append((size, read_data)) return read_data - class LocalConnection(object): + class LocalConnection: def __init__(self, parsed_url=None): self.reason = "" diff --git a/test/unit/test_utils.py b/test/unit/test_utils.py index 02d19f3c..007b91e8 100644 --- a/test/unit/test_utils.py +++ b/test/unit/test_utils.py @@ -641,7 +641,7 @@ class TestGetBody(unittest.TestCase): self.assertEqual({'test': u'\u2603'}, result) -class JSONTracker(object): +class JSONTracker: def __init__(self, data): self.data = data self.calls = []