Browse Source

Update hacking for Python3

The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Change-Id: I3062215fcfc2e448e0f29402104496f80945aeee
changes/31/715631/4
Andreas Jaeger 1 year ago
parent
commit
d7c3cb9799
  1. 1
      examples/claims.py
  2. 1
      examples/management.py
  3. 1
      examples/simple.py
  4. 2
      test-requirements.txt
  5. 2
      tox.ini
  6. 2
      zaqarclient/_i18n.py
  7. 4
      zaqarclient/queues/v1/cli.py
  8. 2
      zaqarclient/queues/v1/queues.py
  9. 4
      zaqarclient/tests/base.py

1
examples/claims.py

@ -46,6 +46,7 @@ def process_jobs():
msg.delete()
time.sleep(0.5)
if __name__ == '__main__':
while True:
send_jobs()

1
examples/management.py

@ -25,5 +25,6 @@ def healthy():
cli = client.Client(url=URL, version=2)
return True if cli.health() else False
if __name__ == '__main__':
healthy()

1
examples/simple.py

@ -44,6 +44,7 @@ def create_post_delete(queue_name, messages):
queue.delete()
if __name__ == '__main__':
messages = [{'body': {'id': idx}, 'ttl': 360}
for idx in range(20)]

2
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.
# Hacking already pins down pep8, pyflakes and flake8
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
hacking>=3.0,<3.1.0 # Apache-2.0
# Unit testing
fixtures>=3.0.0 # Apache-2.0/BSD

2
tox.ini

@ -50,6 +50,8 @@ commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenote
[flake8]
builtins = _
exclude = .venv,.git,.tox,dist,doc,*.egg
# W504 line break after binary operator
ignore = W504
[testenv:lower-constraints]
deps =

2
zaqarclient/_i18n.py

@ -15,7 +15,7 @@
from oslo_i18n import * # noqa
_translators = TranslatorFactory(domain='zaqarclient')
_translators = TranslatorFactory(domain='zaqarclient') # noqa: F405
# The primary translation function using the well-known name "_"
_ = _translators.primary

4
zaqarclient/queues/v1/cli.py

@ -476,7 +476,7 @@ class UpdatePool(command.ShowOne):
"""Update a pool attribute"""
_description = _("Update a pool attribute")
log = logging.getLogger(__name__+".UpdatePool")
log = logging.getLogger(__name__ + ".UpdatePool")
def get_parser(self, prog_name):
parser = super(UpdatePool, self).get_parser(prog_name)
@ -648,7 +648,7 @@ class UpdateFlavor(command.ShowOne):
"""Update a flavor's attributes"""
_description = _("Update a flavor's attributes")
log = logging.getLogger(__name__+".UpdateFlavor")
log = logging.getLogger(__name__ + ".UpdateFlavor")
def get_parser(self, prog_name):
parser = super(UpdateFlavor, self).get_parser(prog_name)

2
zaqarclient/queues/v1/queues.py

@ -24,7 +24,7 @@ from zaqarclient.queues.v1 import message
# NOTE(wanghao): This is copied from Zaqar server side, so if server have
# updated it someday, we should update it here to keep consistent.
QUEUE_NAME_REGEX = re.compile('^[a-zA-Z0-9_\-]+$')
QUEUE_NAME_REGEX = re.compile(r'^[a-zA-Z0-9_\-]+$')
class Queue(object):

4
zaqarclient/tests/base.py

@ -102,6 +102,6 @@ class TestBase(testtools.TestCase):
If a group argument is supplied, the overrides are applied to
the specified configuration option group.
"""
parent = (group and self.conf.setdefault(group, {})
or self.conf)
parent = (group and self.conf.setdefault(group, {}) or
self.conf)
parent.update(kw)
Loading…
Cancel
Save