Skip to content

Commit 97c64f6

Browse files
committed
Revert "iperf3.py: run black"
This reverts commit 0171c50. Instructions told me to run black, so I did, but then the build failed with formatting changes from ... running black
1 parent 0171c50 commit 97c64f6

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

python-ecosys/iperf3/iperf3.py

+6-21
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ def print_line(self, ta, tb, nb, np, nm, extra=""):
117117
if self.udp:
118118
if self.reverse:
119119
print(
120-
" %6.3f ms %u/%u (%.1f%%)"
121-
% (0, nm, np, 100 * nm / (max(1, np + nm))),
122-
end="",
120+
" %6.3f ms %u/%u (%.1f%%)" % (0, nm, np, 100 * nm / (max(1, np + nm))), end=""
123121
)
124122
else:
125123
print(" %u" % np, end="")
@@ -337,9 +335,7 @@ def server():
337335

338336

339337
def client(host, udp=False, reverse=False, bandwidth=10 * 1024 * 1024):
340-
print(
341-
"CLIENT MODE:", "UDP" if udp else "TCP", "receiving" if reverse else "sending"
342-
)
338+
print("CLIENT MODE:", "UDP" if udp else "TCP", "receiving" if reverse else "sending")
343339

344340
param = {
345341
"client_version": "3.6",
@@ -352,9 +348,7 @@ def client(host, udp=False, reverse=False, bandwidth=10 * 1024 * 1024):
352348
if udp:
353349
param["udp"] = True
354350
param["len"] = 1500 - 42
355-
param[
356-
"bandwidth"
357-
] = bandwidth # this should be should be intended bits per second
351+
param["bandwidth"] = bandwidth # this should be should be intended bits per second
358352
udp_interval = 1000000 * 8 * param["len"] // param["bandwidth"]
359353
else:
360354
param["tcp"] = True
@@ -403,9 +397,7 @@ def client(host, udp=False, reverse=False, bandwidth=10 * 1024 * 1024):
403397
if udp:
404398
if reverse:
405399
recvninto(s_data, buf)
406-
udp_in_sec, udp_in_usec, udp_in_id = struct.unpack_from(
407-
">III", buf, 0
408-
)
400+
udp_in_sec, udp_in_usec, udp_in_id = struct.unpack_from(">III", buf, 0)
409401
# print(udp_in_sec, udp_in_usec, udp_in_id)
410402
if udp_in_id != udp_packet_id + 1:
411403
stats.add_lost_packets(udp_in_id - (udp_packet_id + 1))
@@ -417,12 +409,7 @@ def client(host, udp=False, reverse=False, bandwidth=10 * 1024 * 1024):
417409
udp_last_send += udp_interval
418410
udp_packet_id += 1
419411
struct.pack_into(
420-
">III",
421-
buf,
422-
0,
423-
t // 1000000,
424-
t % 1000000,
425-
udp_packet_id,
412+
">III", buf, 0, t // 1000000, t % 1000000, udp_packet_id
426413
)
427414
n = s_data.sendto(buf, ai[-1])
428415
stats.add_bytes(n)
@@ -505,9 +492,7 @@ def client(host, udp=False, reverse=False, bandwidth=10 * 1024 * 1024):
505492
elif cmd == DISPLAY_RESULTS:
506493
s_ctrl.sendall(bytes([IPERF_DONE]))
507494
s_ctrl.close()
508-
time.sleep(
509-
1
510-
) # delay so server is ready for any subsequent client connections
495+
time.sleep(1) # delay so server is ready for any subsequent client connections
511496
return
512497

513498
stats.update()

0 commit comments

Comments
 (0)