Skip to content

Commit 49f97b0

Browse files
authored
bump ruff version in precommit (#474)
* bump ruff version in pre-commit * reup ruff formatting * forgot to update newest ruff
1 parent b0c356c commit 49f97b0

File tree

7 files changed

+13
-14
lines changed

7 files changed

+13
-14
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
files: "spopt\/"
22
repos:
33
- repo: https://github.com/astral-sh/ruff-pre-commit
4-
rev: "v0.8.6"
4+
rev: "v0.11.4"
55
hooks:
66
- id: ruff
77
- id: ruff-format

spopt/region/components.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def is_component(w, ids):
3333
"""
3434

3535
components = 0
36-
marks = {node: 0 for node in ids}
36+
marks = dict.fromkeys(ids, 0)
3737
q = []
3838
for node in ids:
3939
if marks[node] == 0:

spopt/region/spenclib/abstracts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,9 @@ def _spectral_bipartition(
427427
left_cut[left_cut] *= new_cut
428428
right_cut = this_cut.copy()
429429
right_cut[right_cut] *= ~new_cut
430-
assert (
431-
len(this_cut) == len(left_cut) == len(right_cut)
432-
), "Indexing Error in cutting!"
430+
assert len(this_cut) == len(left_cut) == len(right_cut), (
431+
"Indexing Error in cutting!"
432+
)
433433
if ((left_cut * floor_weights).sum() > floor) & (
434434
(right_cut * floor_weights).sum() > floor
435435
) and (tuple(left_cut) not in accepted_cuts) & (

spopt/region/spenclib/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
def check_weights(W, X=None):
1111
if X is not None:
12-
assert (
13-
W.shape[0] == X.shape[0]
14-
), "W does not have the same number of samples as X"
12+
assert W.shape[0] == X.shape[0], (
13+
"W does not have the same number of samples as X"
14+
)
1515
graph = sp.csc_matrix(W)
1616
graph.eliminate_zeros()
1717
components, labels = csg.connected_components(graph)

spopt/region/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ def generate_initial_sol(adj, n_regions):
674674
f"or equal to the number of areas ({n_areas})."
675675
)
676676
if n_regions == 1:
677-
yield {area: 0 for area in range(n_areas)}
677+
yield dict.fromkeys(range(n_areas), 0)
678678
return
679679

680680
n_comps, comp_labels = csg.connected_components(adj)

spopt/tests/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ def toy_fac_data() -> geopandas.GeoDataFrame:
181181

182182

183183
@pytest.fixture
184-
def toy_dem_data() -> (
185-
tuple[geopandas.GeoDataFrame, geopandas.GeoDataFrame, geopandas.GeoDataFrame]
186-
):
184+
def toy_dem_data() -> tuple[
185+
geopandas.GeoDataFrame, geopandas.GeoDataFrame, geopandas.GeoDataFrame
186+
]:
187187
"""Toy demand data used in ``locate`` error & warning tests."""
188188

189189
point = shapely.Point(10, 10)

spopt/tests/test_c_p_median.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ def test_infeasibility_predefined_facilities_fulfillment_error(self):
145145
with pytest.raises(
146146
SpecificationError,
147147
match=(
148-
"Problem is infeasible. "
149-
"The predefined facilities can't be fulfilled, "
148+
"Problem is infeasible. The predefined facilities can't be fulfilled, "
150149
),
151150
):
152151
PMedian.from_cost_matrix(

0 commit comments

Comments
 (0)