diff --git a/glance_store/_drivers/s3.py b/glance_store/_drivers/s3.py index 41d87d3f..9c748313 100644 --- a/glance_store/_drivers/s3.py +++ b/glance_store/_drivers/s3.py @@ -926,7 +926,7 @@ def get_s3_location(s3_host): 's3-sa-east-1.amazonaws.com': 'sa-east-1' } # strip off scheme and port if present - key = re.sub('^(https?://)?(?P[^:]+[^/])(:[0-9]+)?/?$', - '\g', + key = re.sub(r'^(https?://)?(?P[^:]+[^/])(:[0-9]+)?/?$', + r'\g', s3_host) return locations.get(key, '') diff --git a/glance_store/_drivers/swift/store.py b/glance_store/_drivers/swift/store.py index 7c1d9e67..9c827188 100644 --- a/glance_store/_drivers/swift/store.py +++ b/glance_store/_drivers/swift/store.py @@ -768,6 +768,7 @@ def Store(conf, backend=None): return MultiTenantStore(conf, backend=backend) return SingleTenantStore(conf, backend=backend) + Store.OPTIONS = _SWIFT_OPTS + sutils.swift_opts + buffered.BUFFERING_OPTS @@ -1122,7 +1123,7 @@ class BaseStore(driver.Store): try: connection.delete_object(obj_container, segment['name']) - except swiftclient.ClientException as e: + except swiftclient.ClientException: msg = _('Unable to delete segment %(segment_name)s') msg = msg % {'segment_name': segment['name']} LOG.exception(msg) diff --git a/glance_store/_drivers/swift/utils.py b/glance_store/_drivers/swift/utils.py index 4a1d8be4..7285ba15 100644 --- a/glance_store/_drivers/swift/utils.py +++ b/glance_store/_drivers/swift/utils.py @@ -223,6 +223,6 @@ class SwiftParams(object): reference['auth_version'] = av account_params[ref] = reference - except (ValueError, SyntaxError, configparser.NoOptionError) as e: + except (ValueError, SyntaxError, configparser.NoOptionError): LOG.exception(_LE("Invalid format of swift store config cfg")) return account_params diff --git a/glance_store/exceptions.py b/glance_store/exceptions.py index ff6377dd..a20440fc 100644 --- a/glance_store/exceptions.py +++ b/glance_store/exceptions.py @@ -51,7 +51,7 @@ class GlanceStoreException(Exception): if kwargs: message = message % kwargs except Exception: - pass + pass self.msg = message super(GlanceStoreException, self).__init__(message) diff --git a/glance_store/tests/unit/test_swift_store.py b/glance_store/tests/unit/test_swift_store.py index aa22e4cd..8d82053e 100644 --- a/glance_store/tests/unit/test_swift_store.py +++ b/glance_store/tests/unit/test_swift_store.py @@ -47,9 +47,9 @@ from glance_store.tests.unit import test_store_capabilities CONF = cfg.CONF -FAKE_UUID = lambda: str(uuid.uuid4()) -FAKE_UUID2 = lambda: str(uuid.uuid4()) -FAKE_UUID3 = lambda: str(uuid.uuid4()) +FAKE_UUID = lambda: str(uuid.uuid4()) # noqa: E731 +FAKE_UUID2 = lambda: str(uuid.uuid4()) # noqa: E731 +FAKE_UUID3 = lambda: str(uuid.uuid4()) # noqa: E731 Store = swift.Store diff --git a/glance_store/tests/unit/test_swift_store_multibackend.py b/glance_store/tests/unit/test_swift_store_multibackend.py index 7d217eae..83b85170 100644 --- a/glance_store/tests/unit/test_swift_store_multibackend.py +++ b/glance_store/tests/unit/test_swift_store_multibackend.py @@ -46,8 +46,8 @@ from glance_store.tests.unit import test_store_capabilities CONF = cfg.CONF -FAKE_UUID = lambda: str(uuid.uuid4()) -FAKE_UUID2 = lambda: str(uuid.uuid4()) +FAKE_UUID = lambda: str(uuid.uuid4()) # noqa: E731 +FAKE_UUID2 = lambda: str(uuid.uuid4()) # noqa: E731 Store = swift.Store FIVE_KB = 5 * units.Ki diff --git a/lower-constraints.txt b/lower-constraints.txt index c00786ab..addb356a 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -17,12 +17,10 @@ eventlet==0.18.2 extras==1.0.0 fasteners==0.14.1 fixtures==3.0.0 -flake8==2.5.5 future==0.16.0 gitdb2==2.0.3 GitPython==2.1.8 greenlet==0.4.13 -hacking==0.12.0 httplib2==0.9.1 idna==2.6 imagesize==1.0.0 @@ -55,9 +53,7 @@ os-testr==1.0.0 packaging==17.1 Parsley==1.3 pbr==3.1.1 -pep8==1.5.7 prettytable==0.7.2 -pyflakes==0.8.1 Pygments==2.2.0 pyparsing==2.2.0 pyperclip==1.6.0 diff --git a/test-requirements.txt b/test-requirements.txt index 1f745a17..38cd8a26 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,7 +2,7 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. # Metrics and style -hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 +hacking>=3.0,<3.1.0 # Apache-2.0 # Documentation style doc8>=0.6.0 # Apache-2.0 diff --git a/tools/install_venv.py b/tools/install_venv.py index cbea89af..e2382155 100644 --- a/tools/install_venv.py +++ b/tools/install_venv.py @@ -69,5 +69,6 @@ def main(argv): 'setup.py', 'develop']) print_help() + if __name__ == '__main__': main(sys.argv) diff --git a/tox.ini b/tox.ini index b4248c16..749937c6 100644 --- a/tox.ini +++ b/tox.ini @@ -59,7 +59,9 @@ ignore-path = .venv,.git,.tox,*glance_store/locale*,*lib/python*,glance_store.eg # H301 one import per line # H404 multi line docstring should start with a summary # H405 multi line docstring summary not separated with an empty line -ignore = H301,H404,H405 +# W503 line break before binary operator +# W504 line break after binary operator +ignore = H301,H404,H405,W503,W504 exclude = .venv,.git,.tox,dist,doc,etc,*glance_store/locale*,*lib/python*,*egg,build [testenv:lower-constraints]