mirror of
https://github.com/wassname/ray.git
synced 2026-08-12 12:20:11 +08:00
YAPF, take 3 (#2098)
* Use pep8 style The original style file is actually just pep8 style, but with everything spelled out. It's easier to use the `based_on_style` feature. Any overrides are clearer that way. * Improve yapf script 1. Do formatting in parallel 2. Lint RLlib 3. Use .style.yapf file * Pull out expressions into variables * Don't format rllib * Don't allow splits in dicts * Apply yapf * Disallow single line if-statements * Use arithmetic comparison * Simplify checking for changed files * Pull out expr into var
This commit is contained in:
+11
-10
@@ -180,14 +180,15 @@ LIST_OBJECTS = [[obj] for obj in BASE_OBJECTS]
|
||||
TUPLE_OBJECTS = [(obj, ) for obj in BASE_OBJECTS]
|
||||
# The check that type(obj).__module__ != "numpy" should be unnecessary, but
|
||||
# otherwise this seems to fail on Mac OS X on Travis.
|
||||
DICT_OBJECTS = ([{
|
||||
obj: obj
|
||||
} for obj in PRIMITIVE_OBJECTS if (
|
||||
obj.__hash__ is not None and type(obj).__module__ != "numpy")] + [{
|
||||
0: obj
|
||||
} for obj in BASE_OBJECTS] + [{
|
||||
Foo(123): Foo(456)
|
||||
}])
|
||||
DICT_OBJECTS = (
|
||||
[{
|
||||
obj: obj
|
||||
} for obj in PRIMITIVE_OBJECTS
|
||||
if (obj.__hash__ is not None and type(obj).__module__ != "numpy")] + [{
|
||||
0: obj
|
||||
} for obj in BASE_OBJECTS] + [{
|
||||
Foo(123): Foo(456)
|
||||
}])
|
||||
|
||||
RAY_TEST_OBJECTS = BASE_OBJECTS + LIST_OBJECTS + TUPLE_OBJECTS + DICT_OBJECTS
|
||||
|
||||
@@ -720,8 +721,8 @@ class APITest(unittest.TestCase):
|
||||
assert ray.get([id1, id2, id3]) == [0, 1, 2]
|
||||
assert ray.get(
|
||||
g._submit(
|
||||
args=[], num_cpus=1, num_gpus=1, resources={"Custom":
|
||||
1})) == [0]
|
||||
args=[], num_cpus=1, num_gpus=1,
|
||||
resources={"Custom": 1})) == [0]
|
||||
infeasible_id = g._submit(args=[], resources={"NonexistentCustom": 1})
|
||||
ready_ids, remaining_ids = ray.wait([infeasible_id], timeout=50)
|
||||
assert len(ready_ids) == 0
|
||||
|
||||
Reference in New Issue
Block a user