Apply yapf to python files

This commit is contained in:
Matt Weiden
2019-12-19 15:20:41 -08:00
parent 42a8d45bd7
commit cdca128a01
43 changed files with 1143 additions and 678 deletions
+5 -2
View File
@@ -12,12 +12,15 @@ def find_available_port(host, port=5005):
for port_to_try in range(port, port + num_ports_to_try):
if is_port_available(host, port_to_try):
return port_to_try
raise socket.error(errno.EADDRINUSE, f"No port in range {port} - {port + num_ports_to_try - 1} available.")
raise socket.error(
errno.EADDRINUSE,
f"No port in range {port} - {port + num_ports_to_try - 1} available.")
def is_port_available(host, port):
is_available = False
with contextlib.closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:
with contextlib.closing(socket.socket(socket.AF_INET,
socket.SOCK_STREAM)) as s:
try:
s.bind((host, port))
is_available = True