Lint Python files with Yapf (#1872)

This commit is contained in:
Philipp Moritz
2018-04-11 10:11:35 -07:00
committed by Robert Nishihara
parent a3ddde398c
commit 74162d1492
97 changed files with 3927 additions and 3139 deletions
+9
View File
@@ -13,6 +13,7 @@ import numpy as np
def handle_int(a, b):
return a + 1, b + 1
# Test timing
@@ -25,6 +26,7 @@ def empty_function():
def trivial_function():
return 1
# Test keyword arguments
@@ -42,6 +44,7 @@ def keyword_fct2(a="hello", b="world"):
def keyword_fct3(a, b, c="hello", d="world"):
return "{} {} {} {}".format(a, b, c, d)
# Test variable numbers of arguments
@@ -56,17 +59,21 @@ def varargs_fct2(a, *b):
try:
@ray.remote
def kwargs_throw_exception(**c):
return ()
kwargs_exception_thrown = False
except Exception:
kwargs_exception_thrown = True
try:
@ray.remote
def varargs_and_kwargs_throw_exception(a, b="hi", *c):
return "{} {} {}".format(a, b, c)
varargs_and_kwargs_exception_thrown = False
except Exception:
varargs_and_kwargs_exception_thrown = True
@@ -88,6 +95,7 @@ def throw_exception_fct2():
def throw_exception_fct3(x):
raise Exception("Test function 3 intentionally failed.")
# test Python mode
@@ -101,6 +109,7 @@ def python_mode_g(x):
x[0] = 1
return x
# test no return values
+2 -2
View File
@@ -48,8 +48,8 @@ def _wait_for_nodes_to_join(num_nodes, timeout=20):
if num_ready_nodes > num_nodes:
# Too many nodes have joined. Something must be wrong.
raise Exception("{} nodes have joined the cluster, but we were "
"expecting {} nodes.".format(num_ready_nodes,
num_nodes))
"expecting {} nodes.".format(
num_ready_nodes, num_nodes))
time.sleep(0.1)
# If we get here then we timed out.