From 1d9a681b8320686b5b99761221b57c9009688b1a Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Thu, 2 Apr 2020 10:01:27 +0200 Subject: [PATCH] Update hacking for Python3 The repo is Python 3 now, so update hacking to version 3.0 which supports Python 3. Fix problems found. Update local hacking checks for new flake8. Remove hacking and friends from lower-constraints, they are not needed to be installed at run-time. Change-Id: I602e3f3dd3f158799f910d73ac9c759efe15fcc0 --- lower-constraints.txt | 3 -- .../html/confirmation_web_service_sample.py | 1 + samples/zaqar/subscriber_service_sample.py | 1 + test-requirements.txt | 2 +- tox.ini | 15 ++++++- zaqar/api/v1/response.py | 32 +++++++-------- zaqar/api/v1_1/response.py | 38 +++++++++--------- zaqar/api/v2/endpoints.py | 2 +- zaqar/api/v2/response.py | 40 +++++++++---------- zaqar/cmd/status.py | 1 + zaqar/hacking/checks.py | 6 +-- zaqar/storage/redis/messages.py | 3 +- zaqar/storage/redis/utils.py | 1 + .../migration/alembic_migrations/env.py | 1 + zaqar/transport/validation.py | 6 +-- zaqar/transport/wsgi/v1_0/stats.py | 2 +- zaqar/transport/wsgi/v1_1/stats.py | 2 +- zaqar/transport/wsgi/v2_0/messages.py | 2 +- zaqar/transport/wsgi/v2_0/queues.py | 2 +- zaqar/transport/wsgi/v2_0/stats.py | 2 +- zaqar/transport/wsgi/v2_0/topic.py | 2 +- zaqar/transport/wsgi/v2_0/topic_stats.py | 2 +- 22 files changed, 89 insertions(+), 77 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index 413eac4ba..17fa41058 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -8,10 +8,8 @@ dogpile.cache==0.6.2 enum34==1.0.4;python_version=='2.7' falcon==1.1.0 fixtures==3.0.0 -flake8==2.5.5 future==0.16.0 futurist==1.2.0 -hacking==0.12.0 iso8601==0.1.11 jsonschema==2.6.0 keystoneauth1==3.4.0 @@ -39,7 +37,6 @@ oslo.utils==3.33.0 oslotest==3.2.0 osprofiler==1.4.0 pbr==2.0.0 -pep8==1.5.7 Pygments==2.2.0 pymongo==3.6.0 PyMySQL==0.7.6 diff --git a/samples/html/confirmation_web_service_sample.py b/samples/html/confirmation_web_service_sample.py index 0470eef51..c7bb09172 100644 --- a/samples/html/confirmation_web_service_sample.py +++ b/samples/html/confirmation_web_service_sample.py @@ -81,6 +81,7 @@ class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): data = {'confirmed': confirmed_value} requests.put(url=url, data=json.dumps(data), headers=headers) + Handler = ServerHandler httpd = SocketServer.TCPServer(("", PORT), Handler) httpd.serve_forever() diff --git a/samples/zaqar/subscriber_service_sample.py b/samples/zaqar/subscriber_service_sample.py index 2c4d38dd7..9a19872c1 100644 --- a/samples/zaqar/subscriber_service_sample.py +++ b/samples/zaqar/subscriber_service_sample.py @@ -74,6 +74,7 @@ class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): data = {'confirmed': True} requests.put(url=url, data=json.dumps(data), headers=headers) + Handler = ServerHandler httpd = SocketServer.TCPServer(("", PORT), Handler) httpd.serve_forever() diff --git a/test-requirements.txt b/test-requirements.txt index 1c0f32568..ab39b5d5d 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 # Packaging mock>=2.0.0 # BSD diff --git a/tox.ini b/tox.ini index f2edc28c8..e6a224b2f 100644 --- a/tox.ini +++ b/tox.ini @@ -92,6 +92,15 @@ exclude = .venv*,.git,.tox,dist,doc,*lib/python*,*.egg,.update-venv max-complexity = 20 # [H904] Delay string interpolations at logging calls. enable-extensions=H904 +# Ignored extensions, might be enabled again after review: +# E123 closing bracket does not match indentation of opening bracket's line +# E226 missing whitespace around arithmetic operator +# E241 multiple spaces after ',' +# E402 module level import not at top of file +# E731 do not assign a lambda expression, use a def +# W503 line break before binary operator +# W504 line break after binary operator +ignore = E123,E226,E241,E402,E731,W503,W504 [doc8] # File extensions to check @@ -100,8 +109,10 @@ extensions = .rst, .yaml # Let's not get far more in. max-line-length = 80 -[hacking] -local-check-factory = zaqar.hacking.checks.factory +[flake8:local-plugins] +extension = + N537 = checks:no_translate_logs +paths = ./zaqar/hacking [testenv:lower-constraints] deps = diff --git a/zaqar/api/v1/response.py b/zaqar/api/v1/response.py index 6b0fe19de..c7d807b01 100644 --- a/zaqar/api/v1/response.py +++ b/zaqar/api/v1/response.py @@ -34,8 +34,8 @@ class ResponseSchema(api.Api): "properties": { "href": { "type": "string", - "pattern": "^(/v1/queues/[a-zA-Z0-9_-]" - "{1,64}/messages/[a-zA-Z0-9_-]+)$" + "pattern": r"^(/v1/queues/[a-zA-Z0-9_-]" + r"{1,64}/messages/[a-zA-Z0-9_-]+)$" }, "age": age, "ttl": { @@ -54,9 +54,9 @@ class ResponseSchema(api.Api): claim_href = { "type": "string", - "pattern": "^(/v1/queues/[a-zA-Z0-9_-]{1,64}" - "/messages/[a-zA-Z0-9_-]+)" - "\?claim_id=[a-zA-Z0-9_-]+$" + "pattern": r"^(/v1/queues/[a-zA-Z0-9_-]{1,64}" + r"/messages/[a-zA-Z0-9_-]+)" + r"\?claim_id=[a-zA-Z0-9_-]+$" } self.schema = { @@ -74,7 +74,7 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - "pattern": "^/v1/queues\?", + "pattern": r"^/v1/queues\?", } }, 'required': ['rel', 'href'], @@ -90,12 +90,12 @@ class ResponseSchema(api.Api): 'properties': { 'name': { 'type': 'string', - 'pattern': '^[a-zA-Z0-9_-]{1,64}$' + 'pattern': r'^[a-zA-Z0-9_-]{1,64}$' }, 'href': { 'type': 'string', - 'pattern': '^/v1/queues/' - '[a-zA-Z0-9_-]{1,64}$', + 'pattern': r'^/v1/queues/' + r'[a-zA-Z0-9_-]{1,64}$', }, 'metadata': { 'type': 'object', @@ -158,7 +158,7 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - 'pattern': '^/v1/pools\?' + 'pattern': r'^/v1/pools\?' } }, 'required': ['rel', 'href'], @@ -172,8 +172,8 @@ class ResponseSchema(api.Api): 'properties': { 'href': { 'type': 'string', - 'pattern': '^/v1/' - 'pools/[a-zA-Z0-9_-]{1,64}$' + 'pattern': r'^/v1/' + r'pools/[a-zA-Z0-9_-]{1,64}$' }, 'weight': { 'type': 'number', @@ -212,8 +212,8 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - 'pattern': '^/v1/queues/[a-zA-Z0-9_-]+' - '/messages\?(.)*$' + 'pattern': r'^/v1/queues/[a-zA-Z0-9_-]+' + r'/messages\?(.)*$' } }, 'required': ['rel', 'href'], @@ -269,8 +269,8 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - 'pattern': '^/v1/queues/[a-zA-Z0-9_-]+' - '/claims/[a-zA-Z0-9_-]+$' + 'pattern': r'^/v1/queues/[a-zA-Z0-9_-]+' + r'/claims/[a-zA-Z0-9_-]+$' }, 'messages': { "type": "array", diff --git a/zaqar/api/v1_1/response.py b/zaqar/api/v1_1/response.py index e1d8cf96e..ae1995f41 100644 --- a/zaqar/api/v1_1/response.py +++ b/zaqar/api/v1_1/response.py @@ -37,8 +37,8 @@ class ResponseSchema(api.Api): }, "href": { "type": "string", - "pattern": "^(/v1\.1/queues/[a-zA-Z0-9_-]{1,64}" - "/messages/[a-zA-Z0-9_-]+)(\?claim_id=[a-zA-Z0-9_-]+)?$" + "pattern": r"^(/v1\.1/queues/[a-zA-Z0-9_-]{1,64}" + r"/messages/[a-zA-Z0-9_-]+)(\?claim_id=[a-zA-Z0-9_-]+)?$" }, "age": age, "ttl": { @@ -60,9 +60,9 @@ class ResponseSchema(api.Api): claim_href = { "type": "string", - "pattern": "^(/v1\.1/queues/[a-zA-Z0-9_-]{1,64}" - "/messages/[a-zA-Z0-9_-]+)" - "\?claim_id=[a-zA-Z0-9_-]+$" + "pattern": r"^(/v1\.1/queues/[a-zA-Z0-9_-]{1,64}" + r"/messages/[a-zA-Z0-9_-]+)" + r"\?claim_id=[a-zA-Z0-9_-]+$" } flavor = { @@ -70,7 +70,7 @@ class ResponseSchema(api.Api): 'properties': { 'href': { 'type': 'string', - 'pattern': '^/v1\.1/flavors/[a-zA-Z0-9_-]{1,64}$' + 'pattern': r'^/v1\.1/flavors/[a-zA-Z0-9_-]{1,64}$' }, 'pool': { 'type': 'string', @@ -116,7 +116,7 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - "pattern": "^/v1\.1/queues\?", + "pattern": r"^/v1\.1/queues\?", } }, 'required': ['rel', 'href'], @@ -137,8 +137,8 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - 'pattern': '^/v1\.1/queues/' - '[a-zA-Z0-9_-]{1,64}$', + 'pattern': r'^/v1\.1/queues/' + r'[a-zA-Z0-9_-]{1,64}$', }, 'metadata': { 'type': 'object', @@ -202,7 +202,7 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - 'pattern': '^/v1\.1/pools\?' + 'pattern': r'^/v1\.1/pools\?' } }, 'required': ['rel', 'href'], @@ -216,8 +216,8 @@ class ResponseSchema(api.Api): 'properties': { 'href': { 'type': 'string', - 'pattern': '^/v1\.1/' - 'pools/[a-zA-Z0-9_-]{1,64}$' + 'pattern': r'^/v1\.1/' + r'pools/[a-zA-Z0-9_-]{1,64}$' }, 'weight': { 'type': 'number', @@ -259,8 +259,8 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - 'pattern': '^/v1\.1/queues/[a-zA-Z0-9_-]+' - '/messages\?(.)*$' + 'pattern': r'^/v1\.1/queues/[a-zA-Z0-9_-]+' + r'/messages\?(.)*$' } }, 'required': ['rel', 'href'], @@ -293,8 +293,8 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - 'pattern': '^/v1\.1/pools/' - '[a-zA-Z0-9_\-]+$' + 'pattern': r'^/v1\.1/pools/' + r'[a-zA-Z0-9_\-]+$' }, 'options': { 'type': 'object', @@ -352,8 +352,8 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - 'pattern': '^/v1\.1/queues/[a-zA-Z0-9_-]+' - '/claims/[a-zA-Z0-9_-]+$' + 'pattern': r'^/v1\.1/queues/[a-zA-Z0-9_-]+' + r'/claims/[a-zA-Z0-9_-]+$' }, 'messages': { "type": "array", @@ -398,7 +398,7 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - 'pattern': '^/v1\.1/flavors\?' + 'pattern': r'^/v1\.1/flavors\?' } }, 'required': ['rel', 'href'], diff --git a/zaqar/api/v2/endpoints.py b/zaqar/api/v2/endpoints.py index 40723eeef..b0224f8f1 100644 --- a/zaqar/api/v2/endpoints.py +++ b/zaqar/api/v2/endpoints.py @@ -434,7 +434,7 @@ class Endpoints(object): try: queue_meta = self._queue_controller.get_metadata(queue_name, project_id) - except storage_errors.DoesNotExist as ex: + except storage_errors.DoesNotExist: self._validate.queue_identification(queue_name, project_id) self._queue_controller.create(queue_name, project=project_id) # NOTE(flwang): Queue is created in lazy mode, so no metadata diff --git a/zaqar/api/v2/response.py b/zaqar/api/v2/response.py index d21d69c7c..a28c7f3ce 100644 --- a/zaqar/api/v2/response.py +++ b/zaqar/api/v2/response.py @@ -37,8 +37,8 @@ class ResponseSchema(api.Api): }, "href": { "type": "string", - "pattern": "^(/v1/queues/[a-zA-Z0-9_-]{1,64}" - "/messages/[a-zA-Z0-9_-]+)(\?claim_id=[a-zA-Z0-9_-]+)?$" + "pattern": r"^(/v1/queues/[a-zA-Z0-9_-]{1,64}" + r"/messages/[a-zA-Z0-9_-]+)(\?claim_id=[a-zA-Z0-9_-]+)?$" }, "age": age, "ttl": { @@ -61,9 +61,9 @@ class ResponseSchema(api.Api): claim_href = { "type": "string", - "pattern": "^(/v2/queues/[a-zA-Z0-9_-]{1,64}" - "/messages/[a-zA-Z0-9_-]+)" - "\?claim_id=[a-zA-Z0-9_-]+$" + "pattern": r"^(/v2/queues/[a-zA-Z0-9_-]{1,64}" + r"/messages/[a-zA-Z0-9_-]+)" + r"\?claim_id=[a-zA-Z0-9_-]+$" } flavor = { @@ -71,7 +71,7 @@ class ResponseSchema(api.Api): 'properties': { 'href': { 'type': 'string', - 'pattern': '^/v2/flavors/[a-zA-Z0-9_-]{1,64}$' + 'pattern': r'^/v2/flavors/[a-zA-Z0-9_-]{1,64}$' }, 'pool': { 'type': 'string', @@ -117,7 +117,7 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - "pattern": "^/v2/queues\?", + "pattern": r"^/v2/queues\?", } }, 'required': ['rel', 'href'], @@ -134,12 +134,12 @@ class ResponseSchema(api.Api): 'properties': { 'name': { 'type': 'string', - 'pattern': '^[a-zA-Z0-9_-]{1,64}$' + 'pattern': r'^[a-zA-Z0-9_-]{1,64}$' }, 'href': { 'type': 'string', - 'pattern': '^/v2/queues/' - '[a-zA-Z0-9_-]{1,64}$', + 'pattern': r'^/v2/queues/' + r'[a-zA-Z0-9_-]{1,64}$', }, 'metadata': { 'type': 'object', @@ -203,7 +203,7 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - 'pattern': '^/v2/pools\?' + 'pattern': r'^/v2/pools\?' } }, 'required': ['rel', 'href'], @@ -217,8 +217,8 @@ class ResponseSchema(api.Api): 'properties': { 'href': { 'type': 'string', - 'pattern': '^/v2/' - 'pools/[a-zA-Z0-9_-]{1,64}$' + 'pattern': r'^/v2/' + r'pools/[a-zA-Z0-9_-]{1,64}$' }, 'weight': { 'type': 'number', @@ -260,8 +260,8 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - 'pattern': '^/v2/queues/[a-zA-Z0-9_-]+' - '/messages\?(.)*$' + 'pattern': r'^/v2/queues/[a-zA-Z0-9_-]+' + r'/messages\?(.)*$' } }, 'required': ['rel', 'href'], @@ -294,8 +294,8 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - 'pattern': '^/v2/pools/' - '[a-zA-Z0-9_\-]+$' + 'pattern': r'^/v2/pools/' + r'[a-zA-Z0-9_\-]+$' }, 'options': { 'type': 'object', @@ -353,8 +353,8 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - 'pattern': '^/v2/queues/[a-zA-Z0-9_-]+' - '/claims/[a-zA-Z0-9_-]+$' + 'pattern': r'^/v2/queues/[a-zA-Z0-9_-]+' + r'/claims/[a-zA-Z0-9_-]+$' }, 'messages': { "type": "array", @@ -399,7 +399,7 @@ class ResponseSchema(api.Api): }, 'href': { 'type': 'string', - 'pattern': '^/v2/flavors\?' + 'pattern': r'^/v2/flavors\?' } }, 'required': ['rel', 'href'], diff --git a/zaqar/cmd/status.py b/zaqar/cmd/status.py index c1551e278..efb8d0431 100644 --- a/zaqar/cmd/status.py +++ b/zaqar/cmd/status.py @@ -50,5 +50,6 @@ def main(): return upgradecheck.main( cfg.CONF, project='zaqar', upgrade_command=Checks()) + if __name__ == '__main__': sys.exit(main()) diff --git a/zaqar/hacking/checks.py b/zaqar/hacking/checks.py index b8007f264..efaa253fc 100644 --- a/zaqar/hacking/checks.py +++ b/zaqar/hacking/checks.py @@ -14,6 +14,7 @@ import re +from hacking import core _all_log_levels = {'critical', 'error', 'exception', 'info', 'warning', 'debug'} @@ -28,6 +29,7 @@ _log_translation_hint = re.compile( }) +@core.flake8ext def no_translate_logs(logical_line): """N537 - Don't translate logs. @@ -45,7 +47,3 @@ def no_translate_logs(logical_line): """ if _log_translation_hint.match(logical_line): yield (0, "N537: Log messages should not be translated!") - - -def factory(register): - register(no_translate_logs) diff --git a/zaqar/storage/redis/messages.py b/zaqar/storage/redis/messages.py index 183f0fb51..51f4eb38f 100644 --- a/zaqar/storage/redis/messages.py +++ b/zaqar/storage/redis/messages.py @@ -404,7 +404,7 @@ class MessageController(storage.Message, scripting.Mixin): # for performance. with self._client.pipeline() as pipe: for mid in message_ids: - pipe.hgetall(mid) + pipe.hgetall(mid) messages = pipe.execute() @@ -578,6 +578,7 @@ def _filter_messages(messages, filters, to_basic, marker): else: yield msg + QUEUES_SET_STORE_NAME = 'queues_set' diff --git a/zaqar/storage/redis/utils.py b/zaqar/storage/redis/utils.py index 7669cb162..c9519af1f 100644 --- a/zaqar/storage/redis/utils.py +++ b/zaqar/storage/redis/utils.py @@ -69,6 +69,7 @@ def scope_queue_name(queue=None, project=None): # TODO(prashanthr_) : Try to reuse this utility. Violates DRY return normalize_none_str(project) + '.' + normalize_none_str(queue) + # NOTE(prashanthr_): Aliase the scope_queue_name function # to be used in the pools and claims controller as similar # functionality is required to scope redis id's. diff --git a/zaqar/storage/sqlalchemy/migration/alembic_migrations/env.py b/zaqar/storage/sqlalchemy/migration/alembic_migrations/env.py index 7a667c26e..76cb241f2 100644 --- a/zaqar/storage/sqlalchemy/migration/alembic_migrations/env.py +++ b/zaqar/storage/sqlalchemy/migration/alembic_migrations/env.py @@ -90,6 +90,7 @@ def run_migrations_online(): finally: connection.close() + if context.is_offline_mode(): run_migrations_offline() else: diff --git a/zaqar/transport/validation.py b/zaqar/transport/validation.py index e66784b3f..bcb271c2d 100644 --- a/zaqar/transport/validation.py +++ b/zaqar/transport/validation.py @@ -34,7 +34,7 @@ MIN_SUBSCRIPTION_TTL = 60 _PURGBLE_RESOURCE_TYPES = {'messages', 'subscriptions'} # NOTE(kgriffs): Don't use \w because it isn't guaranteed to match # only ASCII characters. -QUEUE_NAME_REGEX = re.compile('^[a-zA-Z0-9_\-.]+$') +QUEUE_NAME_REGEX = re.compile(r'^[a-zA-Z0-9_\-.]+$') QUEUE_NAME_MAX_LEN = 64 PROJECT_ID_MAX_LEN = 256 @@ -125,7 +125,7 @@ class Validator(object): if not pointer.startswith('/'): msg = _('Pointer `%s` does not start with "/".') % pointer raise ValidationFailed(msg) - if re.search('/\s*?/', pointer[1:]): + if re.search(r'/\s*?/', pointer[1:]): msg = _('Pointer `%s` contains adjacent "/".') % pointer raise ValidationFailed(msg) if len(pointer) > 1 and pointer.endswith('/'): @@ -134,7 +134,7 @@ class Validator(object): if pointer[1:].strip() == '/': msg = _('Pointer `%s` does not contains valid token.') % pointer raise ValidationFailed(msg) - if re.search('~[^01]', pointer) or pointer.endswith('~'): + if re.search(r'~[^01]', pointer) or pointer.endswith('~'): msg = _('Pointer `%s` contains "~" not part of' ' a recognized escape sequence.') % pointer raise ValidationFailed(msg) diff --git a/zaqar/transport/wsgi/v1_0/stats.py b/zaqar/transport/wsgi/v1_0/stats.py index fd45076ae..00fae43ed 100644 --- a/zaqar/transport/wsgi/v1_0/stats.py +++ b/zaqar/transport/wsgi/v1_0/stats.py @@ -54,7 +54,7 @@ class Resource(object): resp.body = utils.to_json(resp_dict) # status defaults to 200 - except storage_errors.QueueIsEmpty as ex: + except storage_errors.QueueIsEmpty: resp_dict = { 'messages': { 'claimed': 0, diff --git a/zaqar/transport/wsgi/v1_1/stats.py b/zaqar/transport/wsgi/v1_1/stats.py index 646312eb8..d1bf76bc6 100644 --- a/zaqar/transport/wsgi/v1_1/stats.py +++ b/zaqar/transport/wsgi/v1_1/stats.py @@ -54,7 +54,7 @@ class Resource(object): # status defaults to 200 except (storage_errors.QueueDoesNotExist, - storage_errors.QueueIsEmpty) as ex: + storage_errors.QueueIsEmpty): resp_dict = { 'messages': { 'claimed': 0, diff --git a/zaqar/transport/wsgi/v2_0/messages.py b/zaqar/transport/wsgi/v2_0/messages.py index e61b136c9..57d5fc466 100644 --- a/zaqar/transport/wsgi/v2_0/messages.py +++ b/zaqar/transport/wsgi/v2_0/messages.py @@ -177,7 +177,7 @@ class CollectionResource(object): try: queue_meta = self._queue_controller.get_metadata(queue_name, project_id) - except storage_errors.DoesNotExist as ex: + except storage_errors.DoesNotExist: self._validate.queue_identification(queue_name, project_id) self._queue_controller.create(queue_name, project=project_id) # NOTE(flwang): Queue is created in lazy mode, so no metadata diff --git a/zaqar/transport/wsgi/v2_0/queues.py b/zaqar/transport/wsgi/v2_0/queues.py index ac0437dcd..014bbeb13 100644 --- a/zaqar/transport/wsgi/v2_0/queues.py +++ b/zaqar/transport/wsgi/v2_0/queues.py @@ -208,7 +208,7 @@ class ItemResource(object): except validation.ValidationFailed as ex: LOG.debug(ex) raise wsgi_errors.HTTPBadRequestBody(six.text_type(ex)) - except wsgi_errors.HTTPConflict as ex: + except wsgi_errors.HTTPConflict: raise except Exception: description = _(u'Queue could not be updated.') diff --git a/zaqar/transport/wsgi/v2_0/stats.py b/zaqar/transport/wsgi/v2_0/stats.py index d8dbfce86..1bdcef448 100644 --- a/zaqar/transport/wsgi/v2_0/stats.py +++ b/zaqar/transport/wsgi/v2_0/stats.py @@ -58,7 +58,7 @@ class Resource(object): # status defaults to 200 except (storage_errors.QueueDoesNotExist, - storage_errors.QueueIsEmpty) as ex: + storage_errors.QueueIsEmpty): resp_dict = { 'messages': { 'claimed': 0, diff --git a/zaqar/transport/wsgi/v2_0/topic.py b/zaqar/transport/wsgi/v2_0/topic.py index 6fb7aad2c..7f1bc3b08 100644 --- a/zaqar/transport/wsgi/v2_0/topic.py +++ b/zaqar/transport/wsgi/v2_0/topic.py @@ -205,7 +205,7 @@ class ItemResource(object): except validation.ValidationFailed as ex: LOG.debug(ex) raise wsgi_errors.HTTPBadRequestBody(six.text_type(ex)) - except wsgi_errors.HTTPConflict as ex: + except wsgi_errors.HTTPConflict: raise except Exception: description = _(u'Topic could not be updated.') diff --git a/zaqar/transport/wsgi/v2_0/topic_stats.py b/zaqar/transport/wsgi/v2_0/topic_stats.py index 0c42fb61e..bd0d84547 100644 --- a/zaqar/transport/wsgi/v2_0/topic_stats.py +++ b/zaqar/transport/wsgi/v2_0/topic_stats.py @@ -58,7 +58,7 @@ class Resource(object): # status defaults to 200 except (storage_errors.TopicDoesNotExist, - storage_errors.TopicIsEmpty) as ex: + storage_errors.TopicIsEmpty): resp_dict = { 'messages': { 'claimed': 0,