Skip to content

Commit 4884075

Browse files
committed
Make black happy
1 parent d0a3d98 commit 4884075

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

tests/test_buffer.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,12 @@ def test_free_simple(test_context):
9595
ch.free_string(offset)
9696
ch.check()
9797

98+
9899
@for_all_test_contexts
99100
def test_free(test_context):
100101
class CheckFree(xo.Struct):
101102
a = xo.Float64
103+
102104
ch = CheckFree(a=5, _context=test_context)
103105
assert ch._buffer.capacity == 8
104106
assert ch._buffer.chunks == []
@@ -107,17 +109,17 @@ class CheckFree(xo.Struct):
107109
with pytest.raises(ValueError, match="Cannot free outside of buffer"):
108110
ch._buffer.free(0, 10)
109111
with pytest.raises(ValueError, match="Cannot free outside of buffer"):
110-
ch._buffer.free(7,2)
111-
ch._buffer.free(0,4)
112+
ch._buffer.free(7, 2)
113+
ch._buffer.free(0, 4)
112114
assert len(ch._buffer.chunks) == 1
113115
assert ch._buffer.chunks[0].start == 0
114116
assert ch._buffer.chunks[0].end == 4
115-
ch._buffer.free(0,4) # Does nothing
116-
ch._buffer.free(2,4) # Increases free chunk
117+
ch._buffer.free(0, 4) # Does nothing
118+
ch._buffer.free(2, 4) # Increases free chunk
117119
assert len(ch._buffer.chunks) == 1
118120
assert ch._buffer.chunks[0].start == 0
119121
assert ch._buffer.chunks[0].end == 6
120-
ch._buffer.free(7,1)
122+
ch._buffer.free(7, 1)
121123
assert len(ch._buffer.chunks) == 2
122124
assert ch._buffer.chunks[0].start == 0
123125
assert ch._buffer.chunks[0].end == 6

tests/test_hybrid_class.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -338,16 +338,16 @@ class TD(xo.HybridClass):
338338
"_a": xo.Float64[3],
339339
"_b": xo.Int64,
340340
}
341-
_skip_in_to_dict = ['_a', '_b']
342-
_store_in_to_dict = ['a', 'b']
343-
_extra_fields_in_to_dict = ['c']
341+
_skip_in_to_dict = ["_a", "_b"]
342+
_store_in_to_dict = ["a", "b"]
343+
_extra_fields_in_to_dict = ["c"]
344344

345345
def __init__(self, **kwargs):
346-
if '_xobject' in kwargs and kwargs['_xobject'] is not None:
346+
if "_xobject" in kwargs and kwargs["_xobject"] is not None:
347347
self._initialize(**kwargs)
348348
return
349-
kwargs['_a'] = kwargs.pop('a', [1., 2., 3.])
350-
kwargs['_b'] = kwargs.pop('b', 0)
349+
kwargs["_a"] = kwargs.pop("a", [1.0, 2.0, 3.0])
350+
kwargs["_b"] = kwargs.pop("b", 0)
351351
self._initialize(**kwargs)
352352

353353
def _initialize(self, **kwargs):
@@ -380,7 +380,7 @@ def c(self):
380380

381381
# Verify that to_dict has all fields, including python-only ones,
382382
# for custom initialisation
383-
td2 = TD(a=[8,9,10], b=40, c=20)
383+
td2 = TD(a=[8, 9, 10], b=40, c=20)
384384
td2_dict = td2.to_dict()
385385
assert td2_dict.pop("__class__") == "TD"
386386
assert all(td2_dict.pop("a") == [8, 9, 10])
@@ -402,7 +402,7 @@ def c(self):
402402
assert td4.c == td2.c
403403

404404
# Verify that move works correctly
405-
td3.move(_context=xo.ContextCpu(omp_num_threads='auto'))
405+
td3.move(_context=xo.ContextCpu(omp_num_threads="auto"))
406406
assert all(td3.a == td2.a)
407407
assert td3.b == td2.b
408408
assert td3.c == td2.c

xobjects/context_cupy.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,11 @@ def build_kernels(
457457

458458
extra_include_paths = self.get_installed_c_source_paths()
459459
include_flags = [f"-I{path}" for path in extra_include_paths]
460-
extra_compile_args = (*extra_compile_args, *include_flags, "-DXO_CONTEXT_CUDA")
460+
extra_compile_args = (
461+
*extra_compile_args,
462+
*include_flags,
463+
"-DXO_CONTEXT_CUDA"
464+
)
461465

462466
module = cupy.RawModule(
463467
code=specialized_source, options=extra_compile_args

0 commit comments

Comments
 (0)