summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.com>2020-04-02 15:22:04 +0200
committerAndreas Jaeger <aj@suse.com>2020-04-02 15:26:13 +0200
commit279ea4766ede074662ff29dde86a885458ec501f (patch)
treeb7341f2f1070a52fb5d602071cfd4611e09e6f21
parentbf64eb26dad37f86e83d6910f474db3c619ab4dc (diff)
downloadglance_store-279ea4766ede074662ff29dde86a885458ec501f.tar.gz
Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which supports Python 3. Fix problems found. Remove hacking and friends from lower-constraints, they are not needed for installation. Change-Id: I99b8b24f714858f6b289e5e7b5976e519bb81c11
-rw-r--r--glance_store/_drivers/s3.py4
-rw-r--r--glance_store/_drivers/swift/store.py3
-rw-r--r--glance_store/_drivers/swift/utils.py2
-rw-r--r--glance_store/exceptions.py2
-rw-r--r--glance_store/tests/unit/test_swift_store.py6
-rw-r--r--glance_store/tests/unit/test_swift_store_multibackend.py4
-rw-r--r--lower-constraints.txt4
-rw-r--r--test-requirements.txt2
-rw-r--r--tools/install_venv.py1
-rw-r--r--tox.ini4
10 files changed, 16 insertions, 16 deletions
diff --git a/glance_store/_drivers/s3.py b/glance_store/_drivers/s3.py
index 41d87d3..9c74831 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<host>[^:]+[^/])(:[0-9]+)?/?$',
- '\g<host>',
+ key = re.sub(r'^(https?://)?(?P<host>[^:]+[^/])(:[0-9]+)?/?$',
+ r'\g<host>',
s3_host)
return locations.get(key, '')
diff --git a/glance_store/_drivers/swift/store.py b/glance_store/_drivers/swift/store.py
index 7c1d9e6..9c82718 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 4a1d8be..7285ba1 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 ff6377d..a20440f 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 aa22e4c..8d82053 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 7d217ea..83b8517 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 c00786a..addb356 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 1f745a1..38cd8a2 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 cbea89a..e238215 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 b4248c1..749937c 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]