Skip to content

Commit 76e0e5f

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 42a80dd commit 76e0e5f

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

src/pysimulators/operators.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,11 @@ def partition_init(self, *args, **keywords):
177177
n = len(partitionin)
178178
argss = tuple(
179179
tuple(
180-
a[i]
181-
if class_args[j] in partition_args and not isscalarlike(a)
182-
else a
180+
(
181+
a[i]
182+
if class_args[j] in partition_args and not isscalarlike(a)
183+
else a
184+
)
183185
for j, a in enumerate(args)
184186
)
185187
for i in range(n)

tests/test_operators.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ def assert_partioning_chunk(cls, op, value, key):
7777
nn = (
7878
max(n1, n2)
7979
if partitionin is None
80-
else 1
81-
if isscalarlike(partitionin)
82-
else len(partitionin)
80+
else 1 if isscalarlike(partitionin) else len(partitionin)
8381
)
8482
if n1 != n2 and not isscalarlike(value) and not isscalarlike(key):
8583
# the partitioned arguments do not have the same length

tests/test_quantities.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -174,22 +174,24 @@ def test_function(array, func):
174174

175175
@pytest.mark.parametrize(
176176
'value, expected_type',
177-
[
178-
(Quantity(1), float),
179-
(Quantity(1, dtype='float32'), np.float32),
180-
(Quantity(1.0), float),
181-
(Quantity(complex(1, 0)), np.complex128),
182-
(Quantity(1.0, dtype=np.complex64), np.complex64),
183-
(Quantity(1.0, dtype=np.complex128), np.complex128),
184-
(Quantity(np.array(complex(1, 0))), complex),
185-
(Quantity(np.array(np.complex64(1.0))), np.complex64),
186-
(Quantity(np.array(np.complex128(1.0))), complex),
187-
]
188-
+ [
189-
(Quantity(1.0, dtype=np.complex256), np.complex256),
190-
]
191-
if hasattr(np, 'complex256')
192-
else [],
177+
(
178+
[
179+
(Quantity(1), float),
180+
(Quantity(1, dtype='float32'), np.float32),
181+
(Quantity(1.0), float),
182+
(Quantity(complex(1, 0)), np.complex128),
183+
(Quantity(1.0, dtype=np.complex64), np.complex64),
184+
(Quantity(1.0, dtype=np.complex128), np.complex128),
185+
(Quantity(np.array(complex(1, 0))), complex),
186+
(Quantity(np.array(np.complex64(1.0))), np.complex64),
187+
(Quantity(np.array(np.complex128(1.0))), complex),
188+
]
189+
+ [
190+
(Quantity(1.0, dtype=np.complex256), np.complex256),
191+
]
192+
if hasattr(np, 'complex256')
193+
else []
194+
),
193195
)
194196
def test_dtype(value, expected_type):
195197
assert value.dtype == expected_type

0 commit comments

Comments
 (0)