From b216cb4e78ccd1bde31e4fa5577689ebbf6cd86b Mon Sep 17 00:00:00 2001 From: Lionel Cons Date: Wed, 14 Feb 2024 10:58:02 +0100 Subject: [PATCH] fixed pycodestyle E275 warnings --- example/generator_example.py | 12 ++++++------ example/message_example.py | 12 ++++++------ example/queue_example.py | 8 ++++---- messaging/message.py | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/example/generator_example.py b/example/generator_example.py index 74c1a02..fd3f505 100644 --- a/example/generator_example.py +++ b/example/generator_example.py @@ -40,8 +40,8 @@ def generate_messages(): header_value_size=-32, header_name_prefix="rnd-") msg = gen.message() - assert(len(msg.body) == 1024) - assert(len(msg.header) == 6) + assert (len(msg.body) == 1024) + assert (len(msg.header) == 6) print("...message generation OK!") @@ -56,7 +56,7 @@ def generate_int(): index = 100 for counter in range(1000): # pylint: disable=W0612 integer = generator.rndint(100) - assert(integer >= 0 and integer <= index * 2) + assert (integer >= 0 and integer <= index * 2) print("...integers generation OK!") @@ -67,7 +67,7 @@ def generate_bin(): print("generating binary string") length = 1024 binstr = generator.rndbin(length) - assert(len(binstr) == length) + assert (len(binstr) == length) print("...binary string generation OK!") @@ -78,7 +78,7 @@ def generate_b64(): print("generating base64 string") length = 1024 b64str = generator.rndb64(length) - assert(len(b64str) == length) + assert (len(b64str) == length) print("...base64 string generation OK!") @@ -89,7 +89,7 @@ def generate_str(): print("generating string") length = 1024 string = generator.rndstr(length) - assert(len(string) == length) + assert (len(string) == length) print("...string generation OK!") diff --git a/example/message_example.py b/example/message_example.py index a0e1f92..a7ebe95 100644 --- a/example/message_example.py +++ b/example/message_example.py @@ -27,22 +27,22 @@ def handle_message(): msg1 = Message(body="hello world!".encode("utf-8"), header={"h1": "val1"}) msg2 = Message(body="hello world!".encode("utf-8"), header={"h1": "val1"}) - assert(msg1 == msg2) + assert (msg1 == msg2) msg2 = msg1.serialize() msg2 = deserialize(msg2) - assert(msg1 == msg2) + assert (msg1 == msg2) msg3 = deserialize('{"body": "hello world!", "header": {"h1": "val1"}}') - assert(msg1 == msg3) + assert (msg1 == msg3) tmp = msg1.stringify() msg4 = destringify(tmp) - assert(msg1 == msg4) + assert (msg1 == msg4) msg5 = msg1.jsonify() - assert(isinstance(msg5, dict)) + assert (isinstance(msg5, dict)) msg5 = dejsonify(msg5) - assert(msg1 == msg5) + assert (msg1 == msg5) print("...handle message OK!") diff --git a/example/queue_example.py b/example/queue_example.py index 15fc3ec..89046db 100644 --- a/example/queue_example.py +++ b/example/queue_example.py @@ -46,11 +46,11 @@ def dirq_normal(): post_msg2 = None if dirq.lock(element2): post_msg2 = dirq.get_message(element2) - assert(post_msg2 == msg2) + assert (post_msg2 == msg2) post_msg1 = None if dirq.lock(element1): post_msg1 = dirq.get_message(element1) - assert(post_msg1 == msg1) + assert (post_msg1 == msg1) print("...dirq normal OK!") @@ -76,11 +76,11 @@ def dirq_simple(): post_msg2 = None if dirq.lock(element2): post_msg2 = dirq.get_message(element2) - assert(post_msg2 == msg2) + assert (post_msg2 == msg2) post_msg1 = None if dirq.lock(element1): post_msg1 = dirq.get_message(element1) - assert(post_msg1 == msg1) + assert (post_msg1 == msg1) print("...dirq simple OK!") diff --git a/messaging/message.py b/messaging/message.py index 02bef95..702b3da 100644 --- a/messaging/message.py +++ b/messaging/message.py @@ -464,7 +464,7 @@ def jsonify(self, option=dict()): _base64_it(obj) else: obj["body"] = self.body - del(obj["encoding"]) + del (obj["encoding"]) else: # binary body obj["encoding"] = dict() if compression: @@ -474,7 +474,7 @@ def jsonify(self, option=dict()): if obj["encoding"]: obj["encoding"] = "+".join(obj["encoding"].keys()) else: - del(obj["encoding"]) + del (obj["encoding"]) return obj def stringify(self, option=dict()):