This is an automated email from the ASF dual-hosted git repository.
jdanek pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/qpid-proton.gitThe following commit(s) were added to refs/heads/master by this push:
new 3d9429c PROTON-2320 Apply second round of autopep8 (--aggressive * 3) (#287)
3d9429c is described below
commit 3d9429c6318e8bee247bd444999b7b1cc8da6782
Author: Jiri Daněk <
[hidden email]>
AuthorDate: Fri Jan 15 14:52:45 2021 +0100
PROTON-2320 Apply second round of autopep8 (--aggressive * 3) (#287)
---
c/src/encodings.h.py | 2 +-
c/src/protocol.h.py | 2 +-
c/src/protocol.py | 2 +-
python/examples/colour_send.py | 4 +-
python/examples/direct_send.py | 2 +-
python/examples/simple_send.py | 2 +-
python/examples/test_examples.py | 18 ++++----
python/proton/_data.py | 6 +--
python/proton/_delivery.py | 2 +-
python/proton/_endpoints.py | 2 +-
python/proton/_events.py | 2 +-
python/proton/_handlers.py | 14 +++---
python/proton/_reactor.py | 8 ++--
python/proton/_transport.py | 12 ++---
python/proton/_url.py | 4 +-
python/proton/_utils.py | 2 +-
python/setup.py.in | 18 ++++----
python/tests/proton_tests/codec.py | 6 +--
python/tests/proton_tests/connect.py | 12 ++---
python/tests/proton_tests/engine.py | 80 +++++++++++++++++-----------------
python/tests/proton_tests/interop.py | 4 +-
python/tests/proton_tests/main.py | 6 +--
python/tests/proton_tests/message.py | 10 ++---
python/tests/proton_tests/reactor.py | 10 ++---
python/tests/proton_tests/sasl.py | 25 ++++++-----
python/tests/proton_tests/transport.py | 16 +++----
python/tests/proton_tests/url.py | 2 +-
python/tests/proton_tests/utils.py | 4 +-
tools/python/mllib/dom.py | 8 ++--
tools/python/mllib/parsers.py | 2 +-
tools/python/mllib/transforms.py | 2 +-
31 files changed, 147 insertions(+), 142 deletions(-)
diff --git a/c/src/encodings.h.py b/c/src/encodings.h.py
index c5dd996..405656f 100644
--- a/c/src/encodings.h.py
+++ b/c/src/encodings.h.py
@@ -39,7 +39,7 @@ for enc in doc.query["amqp/section/type/encoding"]:
if name == "ieee-754":
name = enc.parent["@name"]
cname = "PNE_" + name.replace("-", "_").upper()
- print("#define %s%s(%s)" % (cname, " "*(20-len(cname)), enc["@code"]))
+ print("#define %s%s(%s)" % (cname, " " * (20 - len(cname)), enc["@code"]))
print()
print("#endif /* encodings.h */")
diff --git a/c/src/protocol.h.py b/c/src/protocol.h.py
index 7e1bed5..0fecedf 100644
--- a/c/src/protocol.h.py
+++ b/c/src/protocol.h.py
@@ -136,7 +136,7 @@ for i in range(256):
if i < field_min:
field_min = i
-for i in range(field_min, field_max+1):
+for i in range(field_min, field_max + 1):
if i in fields:
name, fnames = fields[i]
if fnames:
diff --git a/c/src/protocol.py b/c/src/protocol.py
index 921bf0b..b112b00 100644
--- a/c/src/protocol.py
+++ b/c/src/protocol.py
@@ -37,7 +37,7 @@ TYPEStmp = doc.query["amqp/section/type", eq("@class", "composite")] + \
mdoc.query["amqp/section/type", eq("@provides", "section")]
TYPES = []
for ty in TYPEStmp:
- if not ty in TYPES:
+ if ty not in TYPES:
TYPES.append(ty)
RESTRICTIONS = {}
COMPOSITES = {}
diff --git a/python/examples/colour_send.py b/python/examples/colour_send.py
index c7442d8..170f227 100755
--- a/python/examples/colour_send.py
+++ b/python/examples/colour_send.py
@@ -42,8 +42,8 @@ class Send(MessagingHandler):
colour = 'red'
else:
colour = 'green'
- content = '%s %d' % (colour, self.sent+1)
- msg = Message(id=(self.sent+1), properties={'colour': colour}, body=content)
+ content = '%s %d' % (colour, self.sent + 1)
+ msg = Message(id=(self.sent + 1), properties={'colour': colour}, body=content)
event.sender.send(msg)
self.sent += 1
diff --git a/python/examples/direct_send.py b/python/examples/direct_send.py
index 8c29f0e..762d0cb 100755
--- a/python/examples/direct_send.py
+++ b/python/examples/direct_send.py
@@ -38,7 +38,7 @@ class Send(MessagingHandler):
def on_sendable(self, event):
while event.sender.credit and self.sent < self.total:
- msg = Message(id=(self.sent+1), body={'sequence': (self.sent+1)})
+ msg = Message(id=(self.sent + 1), body={'sequence': (self.sent + 1)})
event.sender.send(msg)
self.sent += 1
diff --git a/python/examples/simple_send.py b/python/examples/simple_send.py
index 2cff11c..1d36517 100755
--- a/python/examples/simple_send.py
+++ b/python/examples/simple_send.py
@@ -38,7 +38,7 @@ class Send(MessagingHandler):
def on_sendable(self, event):
while event.sender.credit and self.sent < self.total:
- msg = Message(id=(self.sent+1), body={'sequence': (self.sent+1)})
+ msg = Message(id=(self.sent + 1), body={'sequence': (self.sent + 1)})
event.sender.send(msg)
self.sent += 1
diff --git a/python/examples/test_examples.py b/python/examples/test_examples.py
index d46ab01..c40bf1a 100644
--- a/python/examples/test_examples.py
+++ b/python/examples/test_examples.py
@@ -80,8 +80,8 @@ class ExamplesTest(unittest.TestCase):
with Popen([send]):
pass
actual = [remove_unicode_prefix(l.strip()) for l in r.stdout]
- expected_py2 = ["{'sequence': int32(%i)}" % (i+1,) for i in range(100)]
- expected_py3 = ["{'sequence': %i}" % (i+1,) for i in range(100)]
+ expected_py2 = ["{'sequence': int32(%i)}" % (i + 1,) for i in range(100)]
+ expected_py3 = ["{'sequence': %i}" % (i + 1,) for i in range(100)]
self.assertIn(actual, [expected_py2, expected_py3])
def test_client_server(self, client=['client.py'], server=['server.py'], sleep=0):
@@ -123,7 +123,7 @@ class ExamplesTest(unittest.TestCase):
subprocess.check_call(['db_ctrl.py', 'init', './dst_db'])
with Popen(['db_ctrl.py', 'insert', './src_db'], stdin=subprocess.PIPE) as fill:
for i in range(100):
- fill.stdin.write("Message-%i\n" % (i+1))
+ fill.stdin.write("Message-%i\n" % (i + 1))
fill.stdin.close()
# run send and recv
@@ -133,13 +133,13 @@ class ExamplesTest(unittest.TestCase):
r.wait()
# verify output of receive
actual = [l.strip() for l in r.stdout]
- expected = ["inserted message %i" % (i+1) for i in range(100)]
+ expected = ["inserted message %i" % (i + 1) for i in range(100)]
self.assertEqual(actual, expected)
# verify state of databases
with Popen(['db_ctrl.py', 'list', './dst_db']) as v:
v.wait()
- expected = ["(%i, 'Message-%i')" % (i+1, i+1) for i in range(100)]
+ expected = ["(%i, 'Message-%i')" % (i + 1, i + 1) for i in range(100)]
actual = [remove_unicode_prefix(l.strip()) for l in v.stdout]
self.assertEqual(actual, expected)
@@ -154,8 +154,8 @@ class ExamplesTest(unittest.TestCase):
pass
r.wait()
actual = [remove_unicode_prefix(l.strip()) for l in r.stdout]
- expected_py2 = ["{'sequence': int32(%i)}" % (i+1,) for i in range(100)]
- expected_py3 = ["{'sequence': %i}" % (i+1,) for i in range(100)]
+ expected_py2 = ["{'sequence': int32(%i)}" % (i + 1,) for i in range(100)]
+ expected_py3 = ["{'sequence': %i}" % (i + 1,) for i in range(100)]
self.assertIn(actual, [expected_py2, expected_py3])
def test_direct_send_simple_recv(self):
@@ -175,11 +175,11 @@ class ExamplesTest(unittest.TestCase):
with Popen(['selected_recv.py', '-m', '50']) as r:
r.wait()
actual = [l.strip() for l in r.stdout]
- expected = ["green %i" % (i+1) for i in range(100) if i % 2 == 0]
+ expected = ["green %i" % (i + 1) for i in range(100) if i % 2 == 0]
self.assertEqual(actual, expected)
with Popen(['simple_recv.py', '-m', '50']) as r:
r.wait()
actual = [l.strip() for l in r.stdout]
- expected = ["red %i" % (i+1) for i in range(100) if i % 2 == 1]
+ expected = ["red %i" % (i + 1) for i in range(100) if i % 2 == 1]
self.assertEqual(actual, expected)
diff --git a/python/proton/_data.py b/python/proton/_data.py
index 7cfe0bd..b13af94 100644
--- a/python/proton/_data.py
+++ b/python/proton/_data.py
@@ -282,7 +282,7 @@ class Array(object):
:ivar type: Array element type, as an integer. The :class:`Data` class has constants defined
for all the valid AMQP types. For example, for an array of double values, use
:const:`Data.DOUBLE`, which has integer value 14.
- :ivar elements: A Python list of elements of the appropriate type.
+ :ivar elements: A Python list of elements of the appropriate type.
"""
def __init__(self, descriptor, type, *elements):
@@ -958,7 +958,7 @@ class Data:
:param ui: an integral value in the range :math:`0` to :math:`2^{32} - 1` inclusive.
:type ui: ``int``, :class:`uint`
- :raise: * ``AssertionError`` if parameter is out of the range :math:`0` to :math:`2^{32} - 1` inclusive.
+ :raise: * ``AssertionError`` if parameter is out of the range :math:`0` to :math:`2^{32} - 1` inclusive.
* :exc:`DataException` if there is a Proton error.
"""
self._check(pn_data_put_uint(self._data, ui))
@@ -1187,7 +1187,7 @@ class Data:
>>> data.exit()
:return: A tuple containing the number of array elements, the descriptor
- (or ``None`` if no descriptor) and the enumerated array element type.
+ (or ``None`` if no descriptor) and the enumerated array element type.
:rtype: ``tuple`` (``int``, ``str`` or ``None``, ``int``)
"""
count = pn_data_get_array(self._data)
diff --git a/python/proton/_delivery.py b/python/proton/_delivery.py
index 8b7a693..ce474dc 100644
--- a/python/proton/_delivery.py
+++ b/python/proton/_delivery.py
@@ -248,7 +248,7 @@ class Disposition(object):
condition = property(_get_condition, _set_condition, doc="""
The condition object associated with a disposition.
-
+
The :class:`Condition` object retrieved by this operation may be
modified prior to updating a delivery. When a delivery is updated,
the condition described by the disposition is reported to the peer
diff --git a/python/proton/_endpoints.py b/python/proton/_endpoints.py
index acbc745..7602d17 100644
--- a/python/proton/_endpoints.py
+++ b/python/proton/_endpoints.py
@@ -1211,7 +1211,7 @@ class Link(Wrapper, Endpoint):
size is unlimited.
.. warning:: **Unsettled API**
-
+
:type: ``long``
""")
diff --git a/python/proton/_events.py b/python/proton/_events.py
index df1f664..ddac28c 100644
--- a/python/proton/_events.py
+++ b/python/proton/_events.py
@@ -290,7 +290,7 @@ class Event(EventBase):
LINK_LOCAL_OPEN = _core(PN_LINK_LOCAL_OPEN, "on_link_local_open")
"""
The local link endpoint has been opened. Events of this type
- point ot the relevant link.
+ point ot the relevant link.
"""
LINK_LOCAL_CLOSE = _core(PN_LINK_LOCAL_CLOSE, "on_link_local_close")
diff --git a/python/proton/_handlers.py b/python/proton/_handlers.py
index 41df67c..a28b7cb 100644
--- a/python/proton/_handlers.py
+++ b/python/proton/_handlers.py
@@ -324,8 +324,8 @@ class EndpointStateHandler(Handler):
:param peer_close_is_error: If ``True``, a peer endpoint closing will be
treated as an error with an error callback. Otherwise (default), the
- normal callbacks for the closing will occur.
- :type peer_close_is_error: ``bool``
+ normal callbacks for the closing will occur.
+ :type peer_close_is_error: ``bool``
:param delegate: A client handler for the endpoint event
"""
@@ -714,8 +714,8 @@ class MessagingHandler(Handler, Acking):
:type auto_settle: ``bool``
:param peer_close_is_error: If ``True``, a peer endpoint closing will be
treated as an error with an error callback. Otherwise (default), the
- normal callbacks for the closing will occur.
- :type peer_close_is_error: ``bool``
+ normal callbacks for the closing will occur.
+ :type peer_close_is_error: ``bool``
"""
def __init__(self, prefetch=10, auto_accept=True, auto_settle=True, peer_close_is_error=False):
@@ -995,7 +995,7 @@ class TransactionHandler(object):
def on_transaction_commit_failed(self, event):
"""
- Called when the commit of a local transaction fails.
+ Called when the commit of a local transaction fails.
:param event: The underlying event object. Use this to obtain further
information on the event.
@@ -1022,8 +1022,8 @@ class TransactionalClientHandler(MessagingHandler, TransactionHandler):
:type auto_settle: ``bool``
:param peer_close_is_error: If ``True``, a peer endpoint closing will be
treated as an error with an error callback. Otherwise (default), the
- normal callbacks for the closing will occur.
- :type peer_close_is_error: ``bool``
+ normal callbacks for the closing will occur.
+ :type peer_close_is_error: ``bool``
"""
def __init__(self, prefetch=10, auto_accept=False, auto_settle=True, peer_close_is_error=False):
diff --git a/python/proton/_reactor.py b/python/proton/_reactor.py
index d11afd4..5c16d4d 100644
--- a/python/proton/_reactor.py
+++ b/python/proton/_reactor.py
@@ -274,7 +274,7 @@ class Reactor(object):
:param handler:
"""
himpl = self._make_handler(handler)
- task = Task(self, self._now+delay, himpl)
+ task = Task(self, self._now + delay, himpl)
heapq.heappush(self._timerheap, task)
self._timers += 1
deadline = self._timerheap[0]._deadline
@@ -1303,9 +1303,11 @@ class Container(Reactor):
if cert and key:
_ssl_domain.set_credentials(str(cert), str(key), None)
- return self._connect(_url, handler=handler, reconnect=reconnect, heartbeat=heartbeat, ssl_domain=_ssl_domain, **_kwargs)
+ return self._connect(_url, handler=handler, reconnect=reconnect,
+ heartbeat=heartbeat, ssl_domain=_ssl_domain, **_kwargs)
else:
- return self._connect(url=url, urls=urls, handler=handler, reconnect=reconnect, heartbeat=heartbeat, ssl_domain=ssl_domain, **kwargs)
+ return self._connect(url=url, urls=urls, handler=handler, reconnect=reconnect,
+ heartbeat=heartbeat, ssl_domain=ssl_domain, **kwargs)
def _connect(self, url=None, urls=None, handler=None, reconnect=None, heartbeat=None, ssl_domain=None, **kwargs):
conn = self.connection(handler)
diff --git a/python/proton/_transport.py b/python/proton/_transport.py
index 1b8272e..57f75e8 100644
--- a/python/proton/_transport.py
+++ b/python/proton/_transport.py
@@ -846,7 +846,7 @@ class SSLDomain(object):
previous setting.
:param verify_mode: The level of validation to apply to the peer, one of :const:`VERIFY_PEER`,
- :const:`VERIFY_PEER_NAME`, :const:`ANONYMOUS_PEER`,
+ :const:`VERIFY_PEER_NAME`, :const:`ANONYMOUS_PEER`,
:type verify_mode: ``int``
:param trusted_CAs: Path to a database of trusted CAs that the server will advertise.
:type trusted_CAs: ``str``
@@ -877,7 +877,7 @@ class SSLDomain(object):
class SSL(object):
"""
An SSL session associated with a transport. A transport must have
- an SSL object in order to "speak" SSL over its connection.
+ an SSL object in order to "speak" SSL over its connection.
"""
@staticmethod
@@ -995,11 +995,11 @@ class SSL(object):
usually contains the following values:
* :const:`CERT_COUNTRY_NAME`
- * :const:`CERT_STATE_OR_PROVINCE`
+ * :const:`CERT_STATE_OR_PROVINCE`
* :const:`CERT_CITY_OR_LOCALITY`
* :const:`CERT_ORGANIZATION_NAME`
* :const:`CERT_ORGANIZATION_UNIT`
- * :const:`CERT_COMMON_NAME`
+ * :const:`CERT_COMMON_NAME`
:param subfield_name: The enumeration representing the required
sub field listed above
@@ -1207,7 +1207,7 @@ class SSL(object):
Manage the expected name of the remote peer.
The hostname is used for two purposes:
-
+
1. when set on an SSL client, it is sent to the server during the
handshake (if Server Name Indication is supported)
2. it is used to check against the identifying name provided in the
@@ -1215,7 +1215,7 @@ class SSL(object):
SubjectAltName (type DNS name), or the CommonName entry in the
peer's certificate, the peer is considered unauthenticated
(potential imposter), and the SSL connection is aborted.
-
+
.. note:: Verification of the hostname is only done if
:const:`SSLDomain.VERIFY_PEER_NAME` is set using
:meth:`SSLDomain.set_peer_authentication`.
diff --git a/python/proton/_url.py b/python/proton/_url.py
index 2da0001..2794445 100644
--- a/python/proton/_url.py
+++ b/python/proton/_url.py
@@ -160,11 +160,11 @@ class Url(object):
if ':' in afterbrace:
afterbracesplit = afterbrace.split(':')
port = afterbracesplit[1]
- host = (beforebrace+afterbracesplit[0]).lower()
+ host = (beforebrace + afterbracesplit[0]).lower()
if not port:
port = None
else:
- host = (beforebrace+afterbrace).lower()
+ host = (beforebrace + afterbrace).lower()
port = None
if not host:
host = None
diff --git a/python/proton/_utils.py b/python/proton/_utils.py
index ee7c267..52bdfc2 100644
--- a/python/proton/_utils.py
+++ b/python/proton/_utils.py
@@ -343,7 +343,7 @@ class BlockingConnection(Handler):
:type timeout: ``None`` or float
:param container: Container to process the events on the connection. If ``None``,
a new :class:`proton.Container` will be created.
- :param ssl_domain:
+ :param ssl_domain:
:param heartbeat: A value in seconds indicating the desired frequency of
heartbeats used to test the underlying socket is alive.
:type heartbeat: ``float``
diff --git a/python/setup.py.in b/python/setup.py.in
index d7d616d..2005c4c 100644
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -135,13 +135,13 @@ class Configure(build_ext):
# -D flags (None means no value, just define)
macros += [('PROTON_DECLARE_STATIC', None)]
- if self.compiler_type=='msvc':
+ if self.compiler_type == 'msvc':
sources += [
os.path.join(proton_src, 'compiler', 'msvc', 'start.c')
]
- elif self.compiler_type=='unix':
+ elif self.compiler_type == 'unix':
sources += [
- os.path.join(proton_src, 'compiler' , 'gcc', 'start.c')
+ os.path.join(proton_src, 'compiler', 'gcc', 'start.c')
]
# Check whether openssl is installed by poking
@@ -151,7 +151,7 @@ class Configure(build_ext):
libraries += ['ssl', 'crypto']
includes += [misc.pkg_config_get_var('openssl', 'includedir')]
sources.append(os.path.join(proton_src, 'ssl', 'openssl.c'))
- elif os.name=='nt':
+ elif os.name == 'nt':
libraries += ['crypt32', 'secur32']
sources.append(os.path.join(proton_src, 'ssl', 'schannel.cpp'))
else:
@@ -174,7 +174,7 @@ class Configure(build_ext):
# strings there. This is a known issue with CMake and msbuild, see
# *
https://github.com/Microsoft/msbuild/issues/2424 # *
https://cmake.org/pipermail/cmake-developers/2015-October/026775.html- if cc.compiler_type!='msvc':
+ if cc.compiler_type != 'msvc':
if cc.has_function('sasl_client_done', includes=['sasl/sasl.h'], libraries=['sasl2']):
libraries.append('sasl2')
sources.append(os.path.join(proton_src, 'sasl', 'cyrus_sasl.c'))
@@ -195,13 +195,13 @@ class Configure(build_ext):
ds_sys.customize_compiler(cc)
extra = []
- if self.compiler_type=='unix':
+ if self.compiler_type == 'unix':
extra.append('-std=gnu99')
objects = cc.compile(sources,
macros=macros,
include_dirs=[build_include,
proton_include,
- proton_src]+includes,
+ proton_src] + includes,
# compiler command line options:
extra_preargs=extra,
output_dir=self.build_temp)
@@ -217,7 +217,7 @@ class Configure(build_ext):
# lastly replace the libqpid-proton-core dependency with libraries required
# by the Proton objects:
- _cproton.libraries=libraries
+ _cproton.libraries = libraries
def libqpid_proton_installed(self, version):
"""Check to see if the proper version of the Proton development library
@@ -282,7 +282,7 @@ setup(name='python-qpid-proton',
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8"],
- cmdclass = {
+ cmdclass={
'configure': Configure,
'swig': Swig,
'build_py': BuildExtFirst,
diff --git a/python/tests/proton_tests/codec.py b/python/tests/proton_tests/codec.py
index b63e1d6..be0da43 100644
--- a/python/tests/proton_tests/codec.py
+++ b/python/tests/proton_tests/codec.py
@@ -151,7 +151,7 @@ class DataTest(Test):
bits, signed = self.INT_TYPES[dtype]
values = [0, 1, 2, 5, 42]
if signed:
- min, max = -2**(bits-1), 2**(bits-1)-1
+ min, max = -2**(bits - 1), 2**(bits - 1) - 1
values.append(max // 2)
values += [-i for i in values if i]
values += [min, max]
@@ -180,7 +180,7 @@ class DataTest(Test):
if dtype is None:
assert described == False
else:
- assert described == True
+ assert described
assert type == aTYPE, type
assert self.data.enter()
if described:
@@ -432,7 +432,7 @@ class DataTest(Test):
self._test("decimal64", decimal64(0), decimal64(1), decimal64(2), decimal64(3), decimal64(4), decimal64(2**60))
def testDecimal128(self):
- self._test("decimal128", decimal128(b"fdsaasdf;lkjjkl;"), decimal128(b"x"*16))
+ self._test("decimal128", decimal128(b"fdsaasdf;lkjjkl;"), decimal128(b"x" * 16))
def testCopy(self):
self.data.put_described()
diff --git a/python/tests/proton_tests/connect.py b/python/tests/proton_tests/connect.py
index 696da6d..024f69a 100644
--- a/python/tests/proton_tests/connect.py
+++ b/python/tests/proton_tests/connect.py
@@ -74,7 +74,7 @@ class ConnectConfigTest(Test):
write_connect_conf({'port': server.port})
container.connect(handler=client, reconnect=False)
container.run()
- assert client.opened == True
+ assert client.opened
def test_user(self):
ensureCanTestExtendedSASL()
@@ -86,8 +86,8 @@ class ConnectConfigTest(Test):
write_connect_conf({'port': server.port, 'user': user, 'password': password})
container.connect(handler=client, reconnect=False)
container.run()
- assert client.opened == True
- assert server.verified_user == True
+ assert client.opened
+ assert server.verified_user
def test_ssl(self):
ensureCanTestExtendedSASL()
@@ -107,7 +107,7 @@ class ConnectConfigTest(Test):
write_connect_conf(config)
container.connect(handler=client, reconnect=False)
container.run()
- assert client.opened == True
+ assert client.opened
def test_ssl_external(self):
ensureCanTestExtendedSASL()
@@ -137,7 +137,7 @@ class ConnectConfigTest(Test):
write_connect_conf(config)
container.connect(handler=client, reconnect=False)
container.run()
- assert client.opened == True
+ assert client.opened
def test_ssl_plain(self):
ensureCanTestExtendedSASL()
@@ -171,4 +171,4 @@ class ConnectConfigTest(Test):
write_connect_conf(config)
container.connect(handler=client, reconnect=False)
container.run()
- assert client.opened == True
+ assert client.opened
diff --git a/python/tests/proton_tests/engine.py b/python/tests/proton_tests/engine.py
index e20d691..2cf41c6 100644
--- a/python/tests/proton_tests/engine.py
+++ b/python/tests/proton_tests/engine.py
@@ -52,7 +52,7 @@ except:
def bytearray(x):
return b'\x00' * x
-OUTPUT_SIZE = 10*1024
+OUTPUT_SIZE = 10 * 1024
class Test(common.Test):
@@ -293,7 +293,7 @@ class ConnectionTest(Test):
self.c1.open()
self.c2.open()
ssn_0 = self.c2.session()
- assert ssn_0 != None
+ assert ssn_0 is not None
ssn_0.open()
self.pump()
try:
@@ -333,9 +333,9 @@ class ConnectionTest(Test):
self.pump()
assert self.c1.user == "vindaloo", self.c1.user
- assert self.c1.password == None, self.c1.password
+ assert self.c1.password is None, self.c1.password
assert self.c2.user == "leela", self.c2.user
- assert self.c2.password == None, self.c2.password
+ assert self.c2.password is None, self.c2.password
class SessionTest(Test):
@@ -372,7 +372,7 @@ class SessionTest(Test):
ssn = self.c2.session_head(Endpoint.REMOTE_ACTIVE | Endpoint.LOCAL_UNINIT)
- assert ssn != None
+ assert ssn is not None
assert ssn.state == Endpoint.LOCAL_UNINIT | Endpoint.REMOTE_ACTIVE
assert self.ssn.state == Endpoint.LOCAL_ACTIVE | Endpoint.REMOTE_UNINIT
@@ -410,7 +410,7 @@ class SessionTest(Test):
self.ssn.open()
self.pump()
ssn = self.c2.session_head(Endpoint.REMOTE_ACTIVE | Endpoint.LOCAL_UNINIT)
- assert ssn != None
+ assert ssn is not None
ssn.open()
self.pump()
@@ -440,7 +440,7 @@ class SessionTest(Test):
self.ssn.open()
self.pump()
ssn = self.c2.session_head(Endpoint.REMOTE_ACTIVE | Endpoint.LOCAL_UNINIT)
- assert ssn != None
+ assert ssn is not None
ssn.open()
self.pump()
@@ -779,7 +779,7 @@ class LinkTest(Test):
self.pump()
assert self.rcv.remote_properties == sender_props, (self.rcv.remote_properties, sender_props)
- assert self.snd.remote_properties == None, (self.snd.remote_properties, None)
+ assert self.snd.remote_properties is None, (self.snd.remote_properties, None)
def test_cleanup(self):
snd, rcv = self.link("test-link")
@@ -1008,7 +1008,7 @@ class TransferTest(Test):
def test_delivery_id_ordering(self):
self.rcv.flow(1024)
- self.pump(buffer_size=64*1024)
+ self.pump(buffer_size=64 * 1024)
# fill up delivery buffer on sender
for m in range(1024):
@@ -1018,7 +1018,7 @@ class TransferTest(Test):
assert n == len(msg)
assert self.snd.advance()
- self.pump(buffer_size=64*1024)
+ self.pump(buffer_size=64 * 1024)
# receive a session-windows worth of messages and accept them
for m in range(1024):
@@ -1030,7 +1030,7 @@ class TransferTest(Test):
rd.update(Delivery.ACCEPTED)
rd.settle()
- self.pump(buffer_size=64*1024)
+ self.pump(buffer_size=64 * 1024)
# add some new deliveries
for m in range(1024, 1450):
@@ -1057,9 +1057,9 @@ class TransferTest(Test):
assert n == len(msg)
assert self.snd.advance()
- self.pump(buffer_size=64*1024)
+ self.pump(buffer_size=64 * 1024)
self.rcv.flow(1024)
- self.pump(buffer_size=64*1024)
+ self.pump(buffer_size=64 * 1024)
# verify remaining messages can be received and accepted
for m in range(1024, 1500):
@@ -1149,7 +1149,7 @@ class MaxFrameTransferTest(Test):
assert binary == msg
binary = self.rcv.recv(1024)
- assert binary == None
+ assert binary is None
def testOddFrame(self):
"""
@@ -1178,7 +1178,7 @@ class MaxFrameTransferTest(Test):
assert binary == msg
binary = self.rcv.recv(1024)
- assert binary == None
+ assert binary is None
self.rcv.advance()
@@ -1196,7 +1196,7 @@ class MaxFrameTransferTest(Test):
self.pump()
binary = self.rcv.recv(1024)
- assert binary == None
+ assert binary is None
def testSendQueuedMultiFrameMessages(self, sendSingleFrameMsg=False):
"""
@@ -1278,18 +1278,18 @@ class MaxFrameTransferTest(Test):
self.rcv.flow(2)
self.snd.delivery("tag")
- msg = self.message(1024*256)
+ msg = self.message(1024 * 256)
n = self.snd.send(msg)
assert n == len(msg)
assert self.snd.advance()
self.pump()
- binary = self.rcv.recv(1024*256)
+ binary = self.rcv.recv(1024 * 256)
assert binary == msg
binary = self.rcv.recv(1024)
- assert binary == None
+ assert binary is None
def testMaxFrameAbort(self):
self.snd, self.rcv = self.link("test-link", max_frame=[0, 512])
@@ -1412,14 +1412,14 @@ class IdleTimeoutTest(Test):
# at t+1msec, nothing should happen:
clock = 0.001
assert t_snd.tick(clock) == 1.001, "deadline for remote timeout"
- assert t_rcv.tick(clock) == 0.251, "deadline to send keepalive"
+ assert t_rcv.tick(clock) == 0.251, "deadline to send keepalive"
self.pump()
assert sndr_frames_in == t_snd.frames_input, "unexpected received frame"
# at one tick from expected idle frame send, nothing should happen:
clock = 0.250
assert t_snd.tick(clock) == 1.001, "deadline for remote timeout"
- assert t_rcv.tick(clock) == 0.251, "deadline to send keepalive"
+ assert t_rcv.tick(clock) == 0.251, "deadline to send keepalive"
self.pump()
assert sndr_frames_in == t_snd.frames_input, "unexpected received frame"
@@ -1452,7 +1452,7 @@ class IdleTimeoutTest(Test):
class CreditTest(Test):
def setUp(self):
- self.snd, self.rcv = self.link("test-link", max_frame=(16*1024, 16*1024))
+ self.snd, self.rcv = self.link("test-link", max_frame=(16 * 1024, 16 * 1024))
self.c1 = self.snd.session.connection
self.c2 = self.rcv.session.connection
self.snd.open()
@@ -1861,7 +1861,7 @@ class SessionCreditTest(Test):
def tearDown(self):
self.cleanup()
- def testBuffering(self, count=32, size=1024, capacity=16*1024, max_frame=1024):
+ def testBuffering(self, count=32, size=1024, capacity=16 * 1024, max_frame=1024):
snd, rcv = self.link("test-link", max_frame=(max_frame, max_frame))
rcv.session.incoming_capacity = capacity
snd.open()
@@ -1945,7 +1945,7 @@ class SessionCreditTest(Test):
def testCreditWithBuffering(self):
snd, rcv = self.link("test-link", max_frame=(1024, 1024))
- rcv.session.incoming_capacity = 64*1024
+ rcv.session.incoming_capacity = 64 * 1024
snd.open()
rcv.open()
rcv.flow(128)
@@ -1957,7 +1957,7 @@ class SessionCreditTest(Test):
idx = 0
while snd.credit:
d = snd.delivery("tag%s" % idx)
- snd.send(("x"*1024).encode('ascii'))
+ snd.send(("x" * 1024).encode('ascii'))
assert d
assert snd.advance()
self.pump()
@@ -2061,7 +2061,7 @@ class SettlementTest(Test):
for i in range(count):
sd = self.snd.delivery("tag%s" % i)
assert sd
- n = self.snd.send(("x"*size).encode('ascii'))
+ n = self.snd.send(("x" * size).encode('ascii'))
assert n == size, n
assert self.snd.advance()
self.pump()
@@ -2256,13 +2256,13 @@ class NoValue:
pass
def check(self, dlv):
- assert dlv.data == None
+ assert dlv.data is None
assert dlv.section_number == 0
assert dlv.section_offset == 0
- assert dlv.condition == None
+ assert dlv.condition is None
assert dlv.failed == False
assert dlv.undeliverable == False
- assert dlv.annotations == None
+ assert dlv.annotations is None
class RejectValue:
@@ -2273,13 +2273,13 @@ class RejectValue:
dlv.condition = self.condition
def check(self, dlv):
- assert dlv.data == None, dlv.data
+ assert dlv.data is None, dlv.data
assert dlv.section_number == 0
assert dlv.section_offset == 0
assert dlv.condition == self.condition, (dlv.condition, self.condition)
assert dlv.failed == False
assert dlv.undeliverable == False
- assert dlv.annotations == None
+ assert dlv.annotations is None
class ReceivedValue:
@@ -2292,13 +2292,13 @@ class ReceivedValue:
dlv.section_offset = self.section_offset
def check(self, dlv):
- assert dlv.data == None, dlv.data
+ assert dlv.data is None, dlv.data
assert dlv.section_number == self.section_number, (dlv.section_number, self.section_number)
assert dlv.section_offset == self.section_offset
- assert dlv.condition == None
+ assert dlv.condition is None
assert dlv.failed == False
assert dlv.undeliverable == False
- assert dlv.annotations == None
+ assert dlv.annotations is None
class ModifiedValue:
@@ -2313,10 +2313,10 @@ class ModifiedValue:
dlv.annotations = self.annotations
def check(self, dlv):
- assert dlv.data == None, dlv.data
+ assert dlv.data is None, dlv.data
assert dlv.section_number == 0
assert dlv.section_offset == 0
- assert dlv.condition == None
+ assert dlv.condition is None
assert dlv.failed == self.failed
assert dlv.undeliverable == self.undeliverable
assert dlv.annotations == self.annotations, (dlv.annotations, self.annotations)
@@ -2333,10 +2333,10 @@ class CustomValue:
assert dlv.data == self.data, (dlv.data, self.data)
assert dlv.section_number == 0
assert dlv.section_offset == 0
- assert dlv.condition == None
+ assert dlv.condition is None
assert dlv.failed == False
assert dlv.undeliverable == False
- assert dlv.annotations == None
+ assert dlv.annotations is None
class DeliveryTest(Test):
@@ -2581,7 +2581,7 @@ class EventTest(CollectorTest):
self.pump()
self.expect(Event.LINK_FLOW)
rdlv = rcv.current
- assert rdlv != None
+ assert rdlv is not None
assert rdlv.tag == "delivery"
rdlv.update(Delivery.ACCEPTED)
self.pump()
@@ -2767,7 +2767,7 @@ class IdleTimeoutEventTest(PeerTest):
self.half_pump()
t = time()
self.transport.tick(t)
- self.transport.tick(t + self.delay*4)
+ self.transport.tick(t + self.delay * 4)
self.expect(Event.CONNECTION_INIT, Event.CONNECTION_BOUND,
Event.CONNECTION_LOCAL_OPEN, Event.TRANSPORT,
Event.TRANSPORT_ERROR, Event.TRANSPORT_TAIL_CLOSED)
diff --git a/python/tests/proton_tests/interop.py b/python/tests/proton_tests/interop.py
index f57327b..94e43b2 100644
--- a/python/tests/proton_tests/interop.py
+++ b/python/tests/proton_tests/interop.py
@@ -32,7 +32,7 @@ def find_test_interop_dir():
f = dirname(dirname(dirname(dirname(abspath(__file__)))))
f = join(f, "tests", "interop")
if not isdir(f):
- raise Exception("Cannot find tests/interop directory from "+__file__)
+ raise Exception("Cannot find tests/interop directory from " + __file__)
return f
@@ -49,7 +49,7 @@ class InteropTest(common.Test):
self.data = None
def get_data(self, name):
- filename = os.path.join(test_interop_dir, name+".amqp")
+ filename = os.path.join(test_interop_dir, name + ".amqp")
f = open(filename, "rb")
try:
return f.read()
diff --git a/python/tests/proton_tests/main.py b/python/tests/proton_tests/main.py
index c30f282..01c524f 100644
--- a/python/tests/proton_tests/main.py
+++ b/python/tests/proton_tests/main.py
@@ -110,7 +110,7 @@ for d in opts.defines:
try:
idx = d.index("=")
name = d[:idx]
- value = d[idx+1:]
+ value = d[idx + 1:]
config.defines[name] = value
except ValueError:
config.defines[d] = None
@@ -470,7 +470,7 @@ def run_test(name, test, config):
line = part
if line:
- output += "%s %s" % (line, (((WIDTH - ST_WIDTH) - len(line))*"."))
+ output += "%s %s" % (line, (((WIDTH - ST_WIDTH) - len(line)) * "."))
sys.stdout.write(output)
sys.stdout.flush()
interceptor.begin()
@@ -728,7 +728,7 @@ def runthrough():
if opts.time and run > 0:
sys.stdout.write(colorize("Timing:", 1))
timing = [colorize_word("elapsed", "%.2fs elapsed" % (end - start)),
- colorize_word("average", "%.2fs average" % ((end - start)/run))]
+ colorize_word("average", "%.2fs average" % ((end - start) / run))]
print(", ".join(timing))
if xmlr:
diff --git a/python/tests/proton_tests/message.py b/python/tests/proton_tests/message.py
index 9f802e5..ee6f9b0 100644
--- a/python/tests/proton_tests/message.py
+++ b/python/tests/proton_tests/message.py
@@ -247,7 +247,7 @@ class CodecTest(Test):
assert dproperties.descriptor == 0x73, (dproperties.descriptor)
properties = dproperties.value
- assert properties[8] == None, properties[8]
+ assert properties[8] is None, properties[8]
def testCreationEncodeAsNull(self):
self.msg.group_id = "A" # Force creation and expiry fields to be present
@@ -266,7 +266,7 @@ class CodecTest(Test):
assert dproperties.descriptor == 0x73, (dproperties.descriptor)
properties = dproperties.value
- assert properties[9] == None, properties[9]
+ assert properties[9] is None, properties[9]
def testGroupSequenceEncodeAsNull(self):
self.msg.reply_to_group_id = "R" # Force group_id and group_sequence fields to be present
@@ -285,8 +285,8 @@ class CodecTest(Test):
assert dproperties.descriptor == 0x73, (dproperties.descriptor)
properties = dproperties.value
- assert properties[10] == None, properties[10]
- assert properties[11] == None, properties[11]
+ assert properties[10] is None, properties[10]
+ assert properties[11] is None, properties[11]
def testGroupSequenceEncodeAsNonNull(self):
self.msg.group_id = "G"
@@ -345,7 +345,7 @@ class CodecTest(Test):
# Check that the priority field (second field) is encoded as null
headers = dheaders.value
- assert headers[1] == None, (headers[1])
+ assert headers[1] is None, (headers[1])
def testDefaultPriorityDecode(self):
# This is a message with everything filled explicitly as null or zero in LIST32 HEADER and PROPERTIES lists
diff --git a/python/tests/proton_tests/reactor.py b/python/tests/proton_tests/reactor.py
index 4e9b5d6..11b467e 100644
--- a/python/tests/proton_tests/reactor.py
+++ b/python/tests/proton_tests/reactor.py
@@ -210,7 +210,7 @@ class ExceptionTest(Test):
assert event.container == self.parent.container
self.task = self.container.schedule(0, Nothing(self))
self.container.run()
- assert self.triggered == True
+ assert self.triggered
def test_schedule_many_nothings(self):
class Nothing:
@@ -578,7 +578,7 @@ class ContainerTest(Test):
assert client_handler.errors == 10
# Total time for failure should be greater than but close to 3s
# would like to have an upper bound of about 3.2 too - but loaded CI machines can take a loooong time!
- assert 3.0 < end-start, end-start
+ assert 3.0 < end - start, end - start
assert client_handler.server_addr is None, client_handler.server_addr
def test_failover_fail_custom_reconnect(self):
@@ -594,7 +594,7 @@ class ContainerTest(Test):
assert client_handler.errors == 6
# Total time for failure should be greater than but close to 3s
# would like to have an upper bound of about 3.2 too - but loaded CI machines can take a loooong time!
- assert 3.0 < end-start, end-start
+ assert 3.0 < end - start, end - start
assert client_handler.server_addr is None, client_handler.server_addr
def test_reconnect(self):
@@ -615,9 +615,9 @@ class ContainerTest(Test):
container.connect(url="localhost:%s" % (server_handler.port),
handler=client_handler, reconnect=False)
container.run()
- assert server_handler.peer_hostname == None, server_handler.peer_hostname
+ assert server_handler.peer_hostname is None, server_handler.peer_hostname
assert client_handler.connect_failed
- assert client_handler.server_addr == None, client_handler.server_addr
+ assert client_handler.server_addr is None, client_handler.server_addr
class SelectorTest(Test):
diff --git a/python/tests/proton_tests/sasl.py b/python/tests/proton_tests/sasl.py
index 6638d16..55f83f5 100644
--- a/python/tests/proton_tests/sasl.py
+++ b/python/tests/proton_tests/sasl.py
@@ -42,7 +42,8 @@ def _sslCertpath(file):
"ssl_db/%s" % file)
-def _testSaslMech(self, mech, clientUser='user@proton', authUser='user@proton', authzid=None, encrypted=False, authenticated=True):
+def _testSaslMech(self, mech, clientUser='user@proton', authUser='user@proton',
+ authzid=None, encrypted=False, authenticated=True):
self.s1.allowed_mechs(mech)
self.c1.open()
self.c2.open()
@@ -78,9 +79,9 @@ def _testSaslMech(self, mech, clientUser='user@proton', authUser='user@proton',
self.c1.state & Endpoint.LOCAL_ACTIVE, self.c1.state & Endpoint.REMOTE_ACTIVE)
else:
# Server
- assert self.t2.user == None
- assert self.s2.user == None
- assert self.s2.authorization == None, self.s2.authorization
+ assert self.t2.user is None
+ assert self.s2.user is None
+ assert self.s2.authorization is None, self.s2.authorization
assert self.s2.outcome != SASL.OK, self.s2.outcome
# Client
assert self.t1.user == clientUser
@@ -275,11 +276,11 @@ class SaslTest(Test):
self.t1 = Transport()
self.t2.require_auth(False)
self.pump()
- assert self.s2.outcome == None
- assert self.t2.condition == None
+ assert self.s2.outcome is None
+ assert self.t2.condition is None
assert self.t2.authenticated == False
- assert self.s1.outcome == None
- assert self.t1.condition == None
+ assert self.s1.outcome is None
+ assert self.t1.condition is None
assert self.t1.authenticated == False
def testSaslSkippedFail(self):
@@ -287,10 +288,10 @@ class SaslTest(Test):
self.t1 = Transport()
self.t2.require_auth(True)
self.pump()
- assert self.s2.outcome == None
- assert self.t2.condition != None
- assert self.s1.outcome == None
- assert self.t1.condition != None
+ assert self.s2.outcome is None
+ assert self.t2.condition is not None
+ assert self.s1.outcome is None
+ assert self.t1.condition is not None
def testMechNotFound(self):
self.c1 = Connection()
diff --git a/python/tests/proton_tests/transport.py b/python/tests/proton_tests/transport.py
index 1d8af09..77d2138 100644
--- a/python/tests/proton_tests/transport.py
+++ b/python/tests/proton_tests/transport.py
@@ -135,13 +135,13 @@ class ClientTransportTest(Test):
self.transport.push(out)
c = Connection()
- assert c.remote_container == None
- assert c.remote_hostname == None
- assert c.session_head(0) == None
+ assert c.remote_container is None
+ assert c.remote_hostname is None
+ assert c.session_head(0) is None
self.transport.bind(c)
assert c.remote_container == "test-container"
assert c.remote_hostname == "test-hostname"
- assert c.session_head(0) != None
+ assert c.session_head(0) is not None
def testCloseHead(self):
n = self.transport.pending()
@@ -299,13 +299,13 @@ class ServerTransportTest(Test):
self.transport.push(out)
c = Connection()
- assert c.remote_container == None
- assert c.remote_hostname == None
- assert c.session_head(0) == None
+ assert c.remote_container is None
+ assert c.remote_hostname is None
+ assert c.session_head(0) is None
self.transport.bind(c)
assert c.remote_container == "test-container"
assert c.remote_hostname == "test-hostname"
- assert c.session_head(0) != None
+ assert c.session_head(0) is not None
def testCloseHead(self):
n = self.transport.pending()
diff --git a/python/tests/proton_tests/url.py b/python/tests/proton_tests/url.py
index dd67ee4..dba9710 100644
--- a/python/tests/proton_tests/url.py
+++ b/python/tests/proton_tests/url.py
@@ -80,7 +80,7 @@ class UrlTest(common.Test):
self.assertPort(Url.Port('amqp'), 5672, 'amqp')
self.assertPort(Url.Port(5672), 5672, '5672')
self.assertPort(Url.Port(5671), 5671, '5671')
- self.assertEqual(Url.Port(5671)+1, 5672) # Treat as int
+ self.assertEqual(Url.Port(5671) + 1, 5672) # Treat as int
self.assertEqual(str(Url.Port(5672)), '5672')
self.assertPort(Url.Port(Url.Port('amqp')), 5672, 'amqp')
diff --git a/python/tests/proton_tests/utils.py b/python/tests/proton_tests/utils.py
index 4a71d02..5efd740 100644
--- a/python/tests/proton_tests/utils.py
+++ b/python/tests/proton_tests/utils.py
@@ -147,7 +147,9 @@ class SyncRequestResponseTest(Test):
server.start()
server.wait()
try:
- # This will cause an exception because we are specifying allowed_mechs as EXTERNAL. The SASL handshake will fail because the server is not setup to handle EXTERNAL
+ # This will cause an exception because we are specifying allowed_mechs as
+ # EXTERNAL. The SASL handshake will fail because the server is not setup
+ # to handle EXTERNAL
connection = BlockingConnection(server.url, timeout=self.timeout, properties=CONNECTION_PROPERTIES,
offered_capabilities=OFFERED_CAPABILITIES, desired_capabilities=DESIRED_CAPABILITIES, allowed_mechs=EXTERNAL)
self.fail("Expected ConnectionException")
diff --git a/tools/python/mllib/dom.py b/tools/python/mllib/dom.py
index 7f850b1..3650a73 100644
--- a/tools/python/mllib/dom.py
+++ b/tools/python/mllib/dom.py
@@ -75,7 +75,7 @@ class Dispatcher:
def is_type(self, type):
cls = self
- while cls != None:
+ while cls is not None:
if cls.type == type:
return True
cls = cls.base
@@ -83,17 +83,17 @@ class Dispatcher:
def dispatch(self, f, attrs=""):
cls = self
- while cls != None:
+ while cls is not None:
if hasattr(f, cls.type):
return getattr(f, cls.type)(self)
else:
cls = cls.base
cls = self
- while cls != None:
+ while cls is not None:
if attrs:
sep = ", "
- if cls.base == None:
+ if cls.base is None:
sep += "or "
else:
sep = ""
diff --git a/tools/python/mllib/parsers.py b/tools/python/mllib/parsers.py
index c153657..1287642 100644
--- a/tools/python/mllib/parsers.py
+++ b/tools/python/mllib/parsers.py
@@ -82,7 +82,7 @@ class XMLParser(xml.sax.handler.ContentHandler):
self.locator = None
def line(self):
- if self.locator != None:
+ if self.locator is not None:
self.parser.line(self.locator.getSystemId(),
self.locator.getLineNumber(),
self.locator.getColumnNumber())
diff --git a/tools/python/mllib/transforms.py b/tools/python/mllib/transforms.py
index 786861a..57f5a1f 100644
--- a/tools/python/mllib/transforms.py
+++ b/tools/python/mllib/transforms.py
@@ -81,7 +81,7 @@ class Sexp(Identity):
def line(self, s=""):
self.out = self.out.rstrip()
- self.out += "\n" + " "*self.level + s
+ self.out += "\n" + " " * self.level + s
def close(self):
s = self.stack.pop()
---------------------------------------------------------------------
To unsubscribe, e-mail:
[hidden email]
For additional commands, e-mail:
[hidden email]