[PATCH 3/7] selftest/bpf: PEP 8: multiple statements on one line (colon)

From: Alice Ferrazzi
Date: Tue Dec 11 2018 - 06:55:49 EST


Reformat the file for fixing PEP 8 style

Signed-off-by: Alice Ferrazzi <alice.ferrazzi@xxxxxxxxx>
---
tools/testing/selftests/bpf/tcp_client.py | 13 +++++++++----
tools/testing/selftests/bpf/tcp_server.py | 16 +++++++++++-----
2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/tools/testing/selftests/bpf/tcp_client.py b/tools/testing/selftests/bpf/tcp_client.py
index ad3de27cd605..31f022bf06fa 100755
--- a/tools/testing/selftests/bpf/tcp_client.py
+++ b/tools/testing/selftests/bpf/tcp_client.py
@@ -11,17 +11,22 @@ def read(sock, n):
buf = b''
while len(buf) < n:
rem = n - len(buf)
- try: s = sock.recv(rem)
- except (socket.error) as e: return b''
+ try:
+ s = sock.recv(rem)
+ except (socket.error) as e:
+ return b''
buf += s
return buf

+
def send(sock, s):
total = len(s)
count = 0
while count < total:
- try: n = sock.send(s)
- except (socket.error) as e: n = 0
+ try:
+ n = sock.send(s)
+ except (socket.error) as e:
+ n = 0
if n == 0:
return count
count += n
diff --git a/tools/testing/selftests/bpf/tcp_server.py b/tools/testing/selftests/bpf/tcp_server.py
index f7491517cc49..af79210249af 100755
--- a/tools/testing/selftests/bpf/tcp_server.py
+++ b/tools/testing/selftests/bpf/tcp_server.py
@@ -13,17 +13,22 @@ def read(sock, n):
buf = b''
while len(buf) < n:
rem = n - len(buf)
- try: s = sock.recv(rem)
- except (socket.error) as e: return b''
+ try:
+ s = sock.recv(rem)
+ except (socket.error) as e:
+ return b''
buf += s
return buf

+
def send(sock, s):
total = len(s)
count = 0
while count < total:
- try: n = sock.send(s)
- except (socket.error) as e: n = 0
+ try:
+ n = sock.send(s)
+ except (socket.error) as e:
+ n = 0
if n == 0:
return count
count += n
@@ -42,7 +47,8 @@ HostName = socket.gethostname()
serverSocket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
host = socket.gethostname()

-try: serverSocket.bind((host, 0))
+try:
+ serverSocket.bind((host, 0))
except socket.error as msg:
print('bind fails: ' + str(msg))

--
2.19.2