Run pyupgrade to clean up Python 2 syntaxes
... because Python 2 is no longer supported. Change-Id: Ia011f0a320dc4a818a70a5a6137478381e1ab9b9 Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
@@ -18,3 +18,8 @@ repos:
|
||||
- id: hacking
|
||||
additional_dependencies: []
|
||||
exclude: '^(doc|releasenotes|tools)/.*$'
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v3.20.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: [--py3-only]
|
||||
|
||||
@@ -69,7 +69,7 @@ source_suffix = '.rst'
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
copyright = u'2010-present, OpenStack Foundation'
|
||||
copyright = '2010-present, OpenStack Foundation'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
@@ -200,8 +200,8 @@ htmlhelp_basename = 'zaqarclientdoc'
|
||||
# (source start file, target name, title, author, documentclass
|
||||
# [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'Zaqarclient.tex', u'Zaqar Library Documentation',
|
||||
u'Anso Labs, LLC', 'manual'),
|
||||
('index', 'Zaqarclient.tex', 'Zaqar Library Documentation',
|
||||
'Anso Labs, LLC', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
|
||||
@@ -54,8 +54,8 @@ source_suffix = '.rst'
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'ZaqarClientReleaseNotes'
|
||||
copyright = u'2016, OpenStack Foundation'
|
||||
project = 'ZaqarClientReleaseNotes'
|
||||
copyright = '2016, OpenStack Foundation'
|
||||
|
||||
# Release notes are version independent.
|
||||
# The short X.Y version.
|
||||
@@ -203,8 +203,8 @@ latex_elements = {}
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
('index', 'ZaqarClientReleaseNotes.tex',
|
||||
u'ZaqarClient ReleaseNotes Documentation',
|
||||
u'OpenStack Foundation', 'manual'),
|
||||
'ZaqarClient ReleaseNotes Documentation',
|
||||
'OpenStack Foundation', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
@@ -234,8 +234,8 @@ latex_documents = [
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'ZaqarClientReleaseNotes',
|
||||
u'ZaqarClient ReleaseNotes Documentation',
|
||||
[u'OpenStack Foundation'], 1)
|
||||
'ZaqarClient ReleaseNotes Documentation',
|
||||
['OpenStack Foundation'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
@@ -249,8 +249,8 @@ man_pages = [
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'ZaqarClientReleaseNotes',
|
||||
u'ZaqarClient ReleaseNotes Documentation',
|
||||
u'OpenStack Foundation', 'ZaqarClientReleaseNotes',
|
||||
'ZaqarClient ReleaseNotes Documentation',
|
||||
'OpenStack Foundation', 'ZaqarClientReleaseNotes',
|
||||
'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
@@ -26,7 +26,7 @@ from zaqarclient.transport import request
|
||||
class TestKeystoneAuth(base.TestBase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestKeystoneAuth, self).setUp()
|
||||
super().setUp()
|
||||
|
||||
self.auth = auth.get_backend(options=self.conf)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ from zaqarclient.tests import base
|
||||
class TestCommonHttp(base.TestBase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestCommonHttp, self).setUp()
|
||||
super().setUp()
|
||||
self.client = http.Client()
|
||||
|
||||
def test_data_serialization(self):
|
||||
|
||||
@@ -27,7 +27,7 @@ from zaqarclient.transport import response
|
||||
class TestV2Core(base.TestBase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestV2Core, self).setUp()
|
||||
super().setUp()
|
||||
self.transport = dummy.DummyTransport(self.conf)
|
||||
|
||||
def test_queue_create(self):
|
||||
|
||||
@@ -21,7 +21,7 @@ from zaqarclient.tests.transport import api as tapi
|
||||
class TestApi(base.TestBase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestApi, self).setUp()
|
||||
super().setUp()
|
||||
self.api = tapi.FakeApi()
|
||||
|
||||
def test_valid_params(self):
|
||||
|
||||
@@ -29,7 +29,7 @@ class TestHttpTransport(base.TestBase):
|
||||
"""Tests for the HTTP transport."""
|
||||
|
||||
def setUp(self):
|
||||
super(TestHttpTransport, self).setUp()
|
||||
super().setUp()
|
||||
self.api = api.FakeApi()
|
||||
self.transport = http.HttpTransport(self.conf)
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ from zaqarclient.transport import ws
|
||||
class TestWsTransport(base.TestBase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestWsTransport, self).setUp()
|
||||
super().setUp()
|
||||
os_opts = {
|
||||
'os_auth_token': 'FAKE_TOKEN',
|
||||
'os_auth_url': 'http://127.0.0.0:5000/v3',
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import abc
|
||||
|
||||
|
||||
class AuthBackend(object, metaclass=abc.ABCMeta):
|
||||
class AuthBackend(metaclass=abc.ABCMeta):
|
||||
|
||||
def __init__(self, conf):
|
||||
self.conf = conf
|
||||
|
||||
@@ -18,7 +18,7 @@ import json
|
||||
import requests
|
||||
|
||||
|
||||
class Client(object):
|
||||
class Client:
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.session = requests.session(*args, **kwargs)
|
||||
|
||||
@@ -27,7 +27,7 @@ class DriverLoadFailure(ZaqarError):
|
||||
def __init__(self, driver, ex):
|
||||
msg = (_('Failed to load transport driver "%(driver)s": %(error)s') %
|
||||
{'driver': driver, 'error': ex})
|
||||
super(DriverLoadFailure, self).__init__(msg)
|
||||
super().__init__(msg)
|
||||
self.driver = driver
|
||||
self.ex = ex
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ from zaqarclient.queues.v2 import iterator
|
||||
from zaqarclient.queues.v2 import message
|
||||
|
||||
|
||||
class Claim(object):
|
||||
class Claim:
|
||||
def __init__(self, queue, id=None,
|
||||
ttl=None, grace=None, limit=None):
|
||||
self._queue = queue
|
||||
|
||||
@@ -35,7 +35,7 @@ class CreateQueue(command.ShowOne):
|
||||
log = logging.getLogger(__name__ + ".CreateQueue")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateQueue, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -57,7 +57,7 @@ class DeleteQueue(command.Command):
|
||||
log = logging.getLogger(__name__ + ".DeleteQueue")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteQueue, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -77,7 +77,7 @@ class ListQueues(command.Lister):
|
||||
log = logging.getLogger(__name__ + ".ListQueues")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListQueues, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"--marker",
|
||||
metavar="<queue_id>",
|
||||
@@ -125,7 +125,7 @@ class GetQueueStats(command.ShowOne):
|
||||
log = logging.getLogger(__name__ + ".GetQueueStats")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(GetQueueStats, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -154,7 +154,7 @@ class SetQueueMetadata(command.Command):
|
||||
log = logging.getLogger(__name__ + ".SetQueueMetadata")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetQueueMetadata, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -188,7 +188,7 @@ class GetQueueMetadata(command.ShowOne):
|
||||
log = logging.getLogger(__name__ + ".GetQueueMetadata")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(GetQueueMetadata, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -212,7 +212,7 @@ class PostMessages(command.Command):
|
||||
log = logging.getLogger(__name__ + ".PostMessages")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(PostMessages, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -252,7 +252,7 @@ class ListMessages(command.Lister):
|
||||
log = logging.getLogger(__name__ + ".ListMessages")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListMessages, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -327,7 +327,7 @@ class PurgeQueue(command.Command):
|
||||
log = logging.getLogger(__name__ + ".PurgeQueue")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(PurgeQueue, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -354,7 +354,7 @@ class CreatePool(command.ShowOne):
|
||||
log = logging.getLogger(__name__ + ".CreatePool")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreatePool, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"pool_name",
|
||||
metavar="<pool_name>",
|
||||
@@ -410,7 +410,7 @@ class ShowPool(command.ShowOne):
|
||||
log = logging.getLogger(__name__ + ".ShowPool")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowPool, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"pool_name",
|
||||
metavar="<pool_name>",
|
||||
@@ -434,7 +434,7 @@ class UpdatePool(command.ShowOne):
|
||||
log = logging.getLogger(__name__ + ".UpdatePool")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UpdatePool, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"pool_name",
|
||||
metavar="<pool_name>",
|
||||
@@ -487,7 +487,7 @@ class DeletePool(command.Command):
|
||||
log = logging.getLogger(__name__ + ".DeletePool")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeletePool, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"pool_name",
|
||||
metavar="<pool_name>",
|
||||
@@ -507,7 +507,7 @@ class ListPools(command.Lister):
|
||||
log = logging.getLogger(__name__ + ".ListPools")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListPools, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"--marker",
|
||||
metavar="<pool_name>",
|
||||
@@ -549,7 +549,7 @@ class DeleteFlavor(command.Command):
|
||||
log = logging.getLogger(__name__ + ".DeleteFlavor")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteFlavor, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"flavor_name",
|
||||
metavar="<flavor_name>",
|
||||
@@ -569,7 +569,7 @@ class ShowFlavor(command.ShowOne):
|
||||
log = logging.getLogger(__name__ + ".ShowFlavor")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowFlavor, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"flavor_name",
|
||||
metavar="<flavor_name>",
|
||||
@@ -593,7 +593,7 @@ class ListFlavors(command.Lister):
|
||||
log = logging.getLogger(__name__ + ".ListFlavors")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListFlavors, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"--marker",
|
||||
metavar="<flavor_name>",
|
||||
@@ -633,7 +633,7 @@ class UpdateFlavor(command.ShowOne):
|
||||
log = logging.getLogger(__name__ + ".UpdateFlavor")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UpdateFlavor, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"flavor_name",
|
||||
metavar="<flavor_name>",
|
||||
@@ -673,7 +673,7 @@ class CreateFlavor(command.ShowOne):
|
||||
log = logging.getLogger(__name__ + ".CreateFlavor")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateFlavor, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"flavor_name",
|
||||
metavar="<flavor_name>",
|
||||
@@ -706,7 +706,7 @@ class CreateSubscription(command.ShowOne):
|
||||
log = logging.getLogger(__name__ + ".CreateSubscription")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateSubscription, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -754,7 +754,7 @@ class UpdateSubscription(command.ShowOne):
|
||||
log = logging.getLogger(__name__ + ".UpdateSubscription")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UpdateSubscription, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -805,7 +805,7 @@ class DeleteSubscription(command.Command):
|
||||
log = logging.getLogger(__name__ + ".DeleteSubscription")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteSubscription, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -831,7 +831,7 @@ class ShowSubscription(command.ShowOne):
|
||||
log = logging.getLogger(__name__ + ".ShowSubscription")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowSubscription, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -860,7 +860,7 @@ class ListSubscriptions(command.Lister):
|
||||
log = logging.getLogger(__name__ + ".ListSubscriptions")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListSubscriptions, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -900,7 +900,7 @@ class CreateClaim(command.Lister):
|
||||
log = logging.getLogger(__name__ + ".CreateClaim")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateClaim, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -953,7 +953,7 @@ class QueryClaim(command.Lister):
|
||||
log = logging.getLogger(__name__ + ".QueryClaim")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(QueryClaim, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -984,7 +984,7 @@ class RenewClaim(command.Lister):
|
||||
log = logging.getLogger(__name__ + ".RenewClaim")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RenewClaim, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -1033,7 +1033,7 @@ class ReleaseClaim(command.Command):
|
||||
log = logging.getLogger(__name__ + ".ReleaseClaim")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ReleaseClaim, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
@@ -1059,7 +1059,7 @@ class CreateSignedUrl(command.ShowOne):
|
||||
log = logging.getLogger(__name__ + ".CreateSignedUrl")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateSignedUrl, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"queue_name",
|
||||
metavar="<queue_name>",
|
||||
|
||||
@@ -24,7 +24,7 @@ from zaqarclient import transport
|
||||
from zaqarclient.transport import request
|
||||
|
||||
|
||||
class Client(object):
|
||||
class Client:
|
||||
"""Client base class
|
||||
|
||||
:param url: Zaqar's instance base url.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
from zaqarclient.queues.v2 import core
|
||||
|
||||
|
||||
class Flavor(object):
|
||||
class Flavor:
|
||||
|
||||
def __init__(self, client, name,
|
||||
pool_list=None, auto_create=True,
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
class _Iterator(object):
|
||||
class _Iterator:
|
||||
"""Base Iterator
|
||||
|
||||
This iterator is not meant to be used outside
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
from zaqarclient.queues.v2 import core
|
||||
|
||||
|
||||
class Message(object):
|
||||
class Message:
|
||||
"""A handler for Zaqar server Message resources.
|
||||
|
||||
Attributes are only downloaded once - at creation time.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
from zaqarclient.queues.v2 import core
|
||||
|
||||
|
||||
class Pool(object):
|
||||
class Pool:
|
||||
|
||||
def __init__(self, client, name,
|
||||
weight=None, uri=None,
|
||||
|
||||
@@ -26,7 +26,7 @@ from zaqarclient.queues.v2 import message
|
||||
QUEUE_NAME_REGEX = re.compile(r'^[a-zA-Z0-9_\-]+$')
|
||||
|
||||
|
||||
class Queue(object):
|
||||
class Queue:
|
||||
|
||||
message_module = message
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
from zaqarclient.queues.v2 import core
|
||||
|
||||
|
||||
class Subscription(object):
|
||||
class Subscription:
|
||||
|
||||
def __init__(self, client, queue_name, subscriber=None, ttl=60, id=None,
|
||||
auto_create=True, **kwargs):
|
||||
|
||||
@@ -31,7 +31,7 @@ class TestBase(testtools.TestCase):
|
||||
is_functional = False
|
||||
|
||||
def setUp(self):
|
||||
super(TestBase, self).setUp()
|
||||
super().setUp()
|
||||
|
||||
self.conf = {
|
||||
'auth_opts': {
|
||||
|
||||
@@ -36,7 +36,7 @@ class QueuesTestBase(base.TestBase):
|
||||
version = 2
|
||||
|
||||
def setUp(self):
|
||||
super(QueuesTestBase, self).setUp()
|
||||
super().setUp()
|
||||
self.transport = self.transport_cls(self.conf)
|
||||
|
||||
self.client = client.Client(self.url, self.version,
|
||||
|
||||
@@ -23,10 +23,13 @@ from zaqarclient.transport import response
|
||||
class QueuesV2HealthUnitTest(base.QueuesTestBase):
|
||||
|
||||
def test_health(self):
|
||||
expect_health = {u'catalog_reachable': True,
|
||||
u'redis': {u'operation_status': {},
|
||||
u'storage_reachable': True}
|
||||
}
|
||||
expect_health = {
|
||||
'catalog_reachable': True,
|
||||
'redis': {
|
||||
'operation_status': {},
|
||||
'storage_reachable': True
|
||||
}
|
||||
}
|
||||
|
||||
with mock.patch.object(self.transport, 'send',
|
||||
autospec=True) as send_method:
|
||||
|
||||
@@ -417,9 +417,9 @@ class QueuesV2QueueFunctionalTest(base.QueuesTestBase):
|
||||
messages = list(messages)
|
||||
length = len(messages)
|
||||
if length == 3:
|
||||
bodies = set(message.body for message in messages)
|
||||
bodies = {message.body for message in messages}
|
||||
self.assertEqual(
|
||||
set(['Post It 1!', 'Post It 2!', 'Post It 3!']), bodies)
|
||||
{'Post It 1!', 'Post It 2!', 'Post It 3!'}, bodies)
|
||||
elif length == 1:
|
||||
# FIXME(therve): Old broken behavior, remove it as some point
|
||||
pass
|
||||
|
||||
@@ -53,7 +53,7 @@ class QueuesV2SubscriptionUnitTest(base.QueuesTestBase):
|
||||
with mock.patch.object(self.transport.client, 'request',
|
||||
autospec=True) as request_method:
|
||||
|
||||
class FakeRawResponse(object):
|
||||
class FakeRawResponse:
|
||||
def __init__(self):
|
||||
self.text = ''
|
||||
self.headers = {}
|
||||
@@ -182,7 +182,7 @@ class QueuesV2SubscriptionUnitTest(base.QueuesTestBase):
|
||||
class QueuesV2SubscriptionFunctionalTest(base.QueuesTestBase):
|
||||
|
||||
def setUp(self):
|
||||
super(QueuesV2SubscriptionFunctionalTest, self).setUp()
|
||||
super().setUp()
|
||||
|
||||
self.queue_name = 'beijing'
|
||||
queue = self.client.queue(self.queue_name, force_create=True)
|
||||
|
||||
@@ -34,7 +34,7 @@ def get_transport(transport='http', version=2, options=None):
|
||||
:rtype: `zaqarclient.transport.Transport`
|
||||
"""
|
||||
|
||||
entry_point = '{0}.v{1}'.format(transport, version)
|
||||
entry_point = '{}.v{}'.format(transport, version)
|
||||
|
||||
try:
|
||||
namespace = 'zaqarclient.transport'
|
||||
|
||||
@@ -19,7 +19,7 @@ from jsonschema import validators
|
||||
from zaqarclient import errors
|
||||
|
||||
|
||||
class Api(object):
|
||||
class Api:
|
||||
|
||||
schema = {}
|
||||
label = None
|
||||
@@ -52,7 +52,7 @@ class Api(object):
|
||||
return self.schema[operation]
|
||||
except KeyError:
|
||||
# TODO(flaper87): gettext support
|
||||
msg = '{0} is not a valid operation'.format(operation)
|
||||
msg = '{} is not a valid operation'.format(operation)
|
||||
raise errors.InvalidOperation(msg)
|
||||
|
||||
def validate(self, operation, params):
|
||||
|
||||
@@ -18,7 +18,7 @@ import abc
|
||||
from zaqarclient.transport import errors
|
||||
|
||||
|
||||
class Transport(object, metaclass=abc.ABCMeta):
|
||||
class Transport(metaclass=abc.ABCMeta):
|
||||
|
||||
# common HTTP codes used by multiple transports
|
||||
http_to_zaqar = {
|
||||
|
||||
@@ -33,14 +33,14 @@ class TransportError(errors.ZaqarError):
|
||||
code = None
|
||||
|
||||
def __init__(self, title=None, description=None, text=None):
|
||||
msg = 'Error response from Zaqar. Code: {0}.'.format(self.code)
|
||||
msg = 'Error response from Zaqar. Code: {}.'.format(self.code)
|
||||
if title:
|
||||
msg += ' Title: {0}.'.format(title)
|
||||
msg += ' Title: {}.'.format(title)
|
||||
if description:
|
||||
msg += ' Description: {0}.'.format(description)
|
||||
msg += ' Description: {}.'.format(description)
|
||||
if text:
|
||||
msg += ' Text: {0}.'.format(text)
|
||||
super(TransportError, self).__init__(msg)
|
||||
msg += ' Text: {}.'.format(text)
|
||||
super().__init__(msg)
|
||||
|
||||
|
||||
class ResourceNotFound(TransportError):
|
||||
|
||||
@@ -27,7 +27,7 @@ osprofiler_web = importutils.try_import("osprofiler.web")
|
||||
class HttpTransport(base.Transport):
|
||||
|
||||
def __init__(self, options):
|
||||
super(HttpTransport, self).__init__(options)
|
||||
super().__init__(options)
|
||||
self.client = http.Client()
|
||||
|
||||
def _prepare(self, request):
|
||||
@@ -66,9 +66,9 @@ class HttpTransport(base.Transport):
|
||||
|
||||
ref_params[param] = value
|
||||
|
||||
url = '{0}/{1}/{2}'.format(request.endpoint.rstrip('/'),
|
||||
request.api.label,
|
||||
ref.format(**ref_params))
|
||||
url = '{}/{}/{}'.format(request.endpoint.rstrip('/'),
|
||||
request.api.label,
|
||||
ref.format(**ref_params))
|
||||
return url, schema.get('method', 'GET'), request
|
||||
|
||||
def send(self, request):
|
||||
|
||||
@@ -65,7 +65,7 @@ def prepare_request(auth_opts=None, data=None, **kwargs):
|
||||
return req
|
||||
|
||||
|
||||
class Request(object):
|
||||
class Request:
|
||||
"""General data for a Zaqar request
|
||||
|
||||
The idea is to be declarative i.e. specify *what* is desired. It's up to
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import json
|
||||
|
||||
|
||||
class Response(object):
|
||||
class Response:
|
||||
"""Common response class for Zaqarclient.
|
||||
|
||||
All `zaqarclient.transport.base.Transport` implementations
|
||||
|
||||
@@ -56,7 +56,7 @@ class WebsocketTransport(base.Transport):
|
||||
|
||||
"""
|
||||
def __init__(self, options):
|
||||
super(WebsocketTransport, self).__init__(options)
|
||||
super().__init__(options)
|
||||
option = options['auth_opts']['options']
|
||||
# TODO(wangxiyuan): To keep backwards compatibility, we leave
|
||||
# "os_project_id" here. Remove it in the next release.
|
||||
|
||||
Reference in New Issue
Block a user