Skip to content

Commit 0c51ffb

Browse files
committed
Pin black==25.1.0 and apply formatting
1 parent fdae744 commit 0c51ffb

20 files changed

Lines changed: 69 additions & 68 deletions

tests/algorithms/test_enumeration.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,7 @@ def test_not_verified(self, enum_with_list_req, onebyone_enum, enum_with_crossin
251251
def test_get_genf(self, enum_verified):
252252
x = sympy.Symbol("x")
253253
expected_gf = -(
254-
sympy.sqrt(
255-
-(4 * x**3 - 14 * x**2 + 8 * x - 1) / (2 * x**2 - 4 * x + 1)
256-
)
257-
- 1
254+
sympy.sqrt(-(4 * x**3 - 14 * x**2 + 8 * x - 1) / (2 * x**2 - 4 * x + 1)) - 1
258255
) / (2 * x * (x**2 - 3 * x + 1))
259256
assert sympy.simplify(enum_verified.get_genf() - expected_gf) == 0
260257
t = Tiling(
@@ -324,8 +321,7 @@ def test_interleave_fixed_length(self, enum_verified):
324321
== 20 * x**11 * dummy_var**3 * cell_var**3
325322
)
326323
assert (
327-
enum_verified._interleave_fixed_length(F, (1, 0), 0)
328-
== x**8 * dummy_var**3
324+
enum_verified._interleave_fixed_length(F, (1, 0), 0) == x**8 * dummy_var**3
329325
)
330326

331327
def test_interleave_fixed_lengths(self, enum_verified):
@@ -392,14 +388,7 @@ def test_genf_with_big_finite_cell(self):
392388
genf = enum.get_genf().expand()
393389
x = sympy.var("x")
394390
assert (
395-
genf
396-
== 1
397-
+ 2 * x
398-
+ 4 * x**2
399-
+ 8 * x**3
400-
+ 14 * x**4
401-
+ 20 * x**5
402-
+ 20 * x**6
391+
genf == 1 + 2 * x + 4 * x**2 + 8 * x**3 + 14 * x**4 + 20 * x**5 + 20 * x**6
403392
)
404393

405394
def test_with_two_reqs(self):

tests/strategies/test_verification.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -677,10 +677,7 @@ def test_get_specification(self, strategy, enum_verified):
677677
def test_get_genf(self, strategy, enum_verified):
678678
x = sympy.Symbol("x")
679679
expected_gf = -(
680-
sympy.sqrt(
681-
-(4 * x**3 - 14 * x**2 + 8 * x - 1) / (2 * x**2 - 4 * x + 1)
682-
)
683-
- 1
680+
sympy.sqrt(-(4 * x**3 - 14 * x**2 + 8 * x - 1) / (2 * x**2 - 4 * x + 1)) - 1
684681
) / (2 * x * (x**2 - 3 * x + 1))
685682
assert sympy.simplify(strategy.get_genf(enum_verified[0]) - expected_gf) == 0
686683

@@ -758,14 +755,7 @@ def test_genf_with_big_finite_cell(self, strategy):
758755
genf = strategy.get_genf(t).expand()
759756
x = sympy.var("x")
760757
assert (
761-
genf
762-
== 1
763-
+ 2 * x
764-
+ 4 * x**2
765-
+ 8 * x**3
766-
+ 14 * x**4
767-
+ 20 * x**5
768-
+ 20 * x**6
758+
genf == 1 + 2 * x + 4 * x**2 + 8 * x**3 + 14 * x**4 + 20 * x**5 + 20 * x**6
769759
)
770760

771761
def test_with_two_reqs(self, strategy):

tilings/algorithms/fusion.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
The implementation of the fusion algorithm
33
"""
4+
45
import collections
56
from itertools import chain
67
from typing import (

tilings/algorithms/requirement_placement.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,11 @@ def _gridded_perm_translation_with_point(
153153
# TODO: to prepare for intervals consider all ways of drawing a
154154
# rectangle around point in cell.
155155
new_pos = [
156-
self._point_translation(gp, i, (point_index, gp.patt[point_index]))
157-
if i != point_index
158-
else self._placed_cell(gp.pos[point_index])
156+
(
157+
self._point_translation(gp, i, (point_index, gp.patt[point_index]))
158+
if i != point_index
159+
else self._placed_cell(gp.pos[point_index])
160+
)
159161
for i in range(len(gp))
160162
]
161163
return gp.__class__(gp.patt, new_pos)

tilings/algorithms/row_col_separation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
The role of the class `RowColSeparation` is to make sure that row columns
88
separation is idempotent by applying the core algorithm until it stabilises.
99
"""
10+
1011
import heapq
1112
from itertools import combinations, product
1213
from typing import TYPE_CHECKING, Dict, List, Tuple

tilings/algorithms/sliding.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@ def slide_assumption(
8282
gp.patt,
8383
(
8484
(
85-
c2
86-
if gp.pos[0][0] == c1
87-
else (c1 if gp.pos[0][0] == c2 else gp.pos[0][0]),
85+
(
86+
c2
87+
if gp.pos[0][0] == c1
88+
else (c1 if gp.pos[0][0] == c2 else gp.pos[0][0])
89+
),
8890
0,
8991
),
9092
),
@@ -99,9 +101,11 @@ def slide_assumption(
99101
gp.patt,
100102
(
101103
(
102-
c2
103-
if gp.pos[0][0] == c1
104-
else (c1 if gp.pos[0][0] == c2 else gp.pos[0][0]),
104+
(
105+
c2
106+
if gp.pos[0][0] == c1
107+
else (c1 if gp.pos[0][0] == c2 else gp.pos[0][0])
108+
),
105109
0,
106110
),
107111
),
@@ -405,9 +409,11 @@ def _slide_obstructions(
405409
# The 12...n obstrudtion that connects av12 and av123
406410
yield GriddedPerm(
407411
range(n),
408-
((av_12, 0),) * (n - 1) + ((av_123, 0),)
409-
if av_12 < av_123
410-
else ((av_123, 0),) + ((av_12, 0),) * (n - 1),
412+
(
413+
((av_12, 0),) * (n - 1) + ((av_123, 0),)
414+
if av_12 < av_123
415+
else ((av_123, 0),) + ((av_12, 0),) * (n - 1)
416+
),
411417
)
412418
elif gp in self.col_info[av_123][2]:
413419
# The one with two points in av_123 are altered so that the two
@@ -435,9 +441,7 @@ def _slide_obstructions(
435441
yield gp
436442

437443
@staticmethod
438-
def _gp_slide_split(
439-
gp: GriddedPerm, c1: int, c2: int
440-
) -> Tuple[
444+
def _gp_slide_split(gp: GriddedPerm, c1: int, c2: int) -> Tuple[
441445
Tuple[Deque[int], Deque[int], Deque[int], Deque[int], Deque[int], Deque[int]],
442446
Tuple[List[int], List[int], List[int]],
443447
]:

tilings/bijections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def _init_assumptions(self) -> Tuple[AssumptionLabels, AssumptionLabels]:
9191

9292
@staticmethod
9393
def _get_next(
94-
path: Deque[Tuple[AbstractRule, int]]
94+
path: Deque[Tuple[AbstractRule, int]],
9595
) -> Tuple[Rule[Tiling, GriddedPerm], int]:
9696
"""Get next rule and the index of its child we traverse through."""
9797
r, idx = path.popleft()

tilings/misc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Collection of function that are not directly related to the code but still
33
useful.
44
"""
5+
56
from functools import reduce
67
from typing import (
78
Collection,

tilings/strategies/assumption_insertion.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ def _build_child_param_map(self, parent: Tiling, child: Tiling) -> ParametersMap
7777
}
7878
child_param_to_parent_param = {v: k for k, v in self.extra_parameters.items()}
7979
child_pos_to_parent_pos: Tuple[Tuple[int, ...], ...] = tuple(
80-
tuple()
81-
if param in self.new_parameters
82-
else (parent_param_to_pos[child_param_to_parent_param[param]],)
80+
(
81+
tuple()
82+
if param in self.new_parameters
83+
else (parent_param_to_pos[child_param_to_parent_param[param]],)
84+
)
8385
for param in child.extra_parameters
8486
)
8587
return self.build_param_map(

tilings/strategies/assumption_splitting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def compositions_dict(value: int, parameters: Tuple[str, ...]):
7777
yield dict(zip(parameters, comp))
7878

7979
def union_params(
80-
sub_params: Tuple[Dict[str, int], ...]
80+
sub_params: Tuple[Dict[str, int], ...],
8181
) -> Optional[Dict[str, int]]:
8282
new_params: Dict[str, int] = {}
8383
for params in sub_params:

0 commit comments

Comments
 (0)