From c324d6507c51c1f3c670e4681c67b0540a56bdc8 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Sun, 10 Nov 2019 16:06:24 +0100 Subject: [PATCH] [python/pep8] Use "not in" to test for membership. Also break long lines. --- examples/deprecated/java/app/bittorrent/generate.py | 9 +++++---- examples/deprecated/msg/dht-kademlia/generate.py | 2 +- examples/deprecated/msg/dht-pastry/generate.py | 10 ++++++---- examples/s4u/dht-kademlia/generate.py | 2 +- teshsuite/msg/app-bittorrent/generate.py | 2 +- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/examples/deprecated/java/app/bittorrent/generate.py b/examples/deprecated/java/app/bittorrent/generate.py index 556e2b4f5b..feaea00c5b 100755 --- a/examples/deprecated/java/app/bittorrent/generate.py +++ b/examples/deprecated/java/app/bittorrent/generate.py @@ -30,17 +30,18 @@ all_ids = [42] sys.stdout.write("\n" "\n" "\n" - " \n" % end_date) + " \n" % + end_date) for i in range(1, nb_nodes): ok = False while not ok: my_id = random.randint(0, max_id) - ok = not my_id in all_ids + ok = my_id not in all_ids start_date = i * 10 - line = " " % ( - i, my_id, end_date) + line = " " \ + "" % (i, my_id, end_date) if random.randint(0, 100) < seed_percentage: line += "" line += "\n" diff --git a/examples/deprecated/msg/dht-kademlia/generate.py b/examples/deprecated/msg/dht-kademlia/generate.py index 5e920ccd9a..bf86345614 100755 --- a/examples/deprecated/msg/dht-kademlia/generate.py +++ b/examples/deprecated/msg/dht-kademlia/generate.py @@ -30,7 +30,7 @@ for i in range(1, nb_nodes): ok = False while not ok: my_id = random.randint(0, max_id) - ok = not my_id in all_ids + ok = my_id not in all_ids known_id = all_ids[random.randint(0, len(all_ids) - 1)] start_date = i * 10 line = " \n "\ diff --git a/examples/deprecated/msg/dht-pastry/generate.py b/examples/deprecated/msg/dht-pastry/generate.py index d80d1eedf1..cc0d24f403 100755 --- a/examples/deprecated/msg/dht-pastry/generate.py +++ b/examples/deprecated/msg/dht-pastry/generate.py @@ -29,19 +29,21 @@ all_ids = [42] sys.stdout.write("\n" "\n" "\n" - " \n" % end_date) + " " + "\n" % end_date) for i in range(1, nb_nodes): ok = False while not ok: my_id = random.randint(0, max_id) - ok = not my_id in all_ids + ok = my_id not in all_ids known_id = all_ids[random.randint(0, len(all_ids) - 1)] start_date = i * 10 - line = " \n" % ( - i, my_id, known_id, start_date, end_date) + line = " " \ + "\n" % ( + i, my_id, known_id, start_date, end_date) sys.stdout.write(line) all_ids.append(my_id) diff --git a/examples/s4u/dht-kademlia/generate.py b/examples/s4u/dht-kademlia/generate.py index 5e920ccd9a..bf86345614 100755 --- a/examples/s4u/dht-kademlia/generate.py +++ b/examples/s4u/dht-kademlia/generate.py @@ -30,7 +30,7 @@ for i in range(1, nb_nodes): ok = False while not ok: my_id = random.randint(0, max_id) - ok = not my_id in all_ids + ok = my_id not in all_ids known_id = all_ids[random.randint(0, len(all_ids) - 1)] start_date = i * 10 line = " \n "\ diff --git a/teshsuite/msg/app-bittorrent/generate.py b/teshsuite/msg/app-bittorrent/generate.py index fde8f93167..04e689e505 100755 --- a/teshsuite/msg/app-bittorrent/generate.py +++ b/teshsuite/msg/app-bittorrent/generate.py @@ -38,7 +38,7 @@ for i in range(1, nb_nodes): ok = False while not ok: my_id = random.randint(0, max_id) - ok = not my_id in all_ids + ok = my_id not in all_ids start_date = i * 10 line = " \n" % i line += " \n \n" % ( -- 2.20.1