Skip to content

Commit c6f2d4b

Browse files
committed
pre-commit autoupdate 2025-09-11
1 parent 18c853d commit c6f2d4b

16 files changed

+31
-32
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ repos:
1616
- id: auto-walrus
1717

1818
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: v0.12.12
19+
rev: v0.13.0
2020
hooks:
2121
- id: ruff-check
2222
- id: ruff-format

data_structures/arrays/sudoku_solver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def search(values):
149149
if all(len(values[s]) == 1 for s in squares):
150150
return values ## Solved!
151151
## Chose the unfilled square s with the fewest possibilities
152-
n, s = min((len(values[s]), s) for s in squares if len(values[s]) > 1)
152+
_n, s = min((len(values[s]), s) for s in squares if len(values[s]) > 1)
153153
return some(search(assign(values.copy(), s, d)) for d in values[s])
154154

155155

data_structures/trie/radix_tree.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def find(self, word: str) -> bool:
115115
if not incoming_node:
116116
return False
117117
else:
118-
matching_string, remaining_prefix, remaining_word = incoming_node.match(
118+
_matching_string, remaining_prefix, remaining_word = incoming_node.match(
119119
word
120120
)
121121
# If there is remaining prefix, the word can't be on the tree
@@ -144,7 +144,7 @@ def delete(self, word: str) -> bool:
144144
if not incoming_node:
145145
return False
146146
else:
147-
matching_string, remaining_prefix, remaining_word = incoming_node.match(
147+
_matching_string, remaining_prefix, remaining_word = incoming_node.match(
148148
word
149149
)
150150
# If there is remaining prefix, the word can't be on the tree

graphs/graph_adjacency_list.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ def test_remove_edge(self) -> None:
448448
(
449449
undirected_graph,
450450
directed_graph,
451-
random_vertices,
451+
_random_vertices,
452452
random_edges,
453453
) = self.__generate_graphs(20, 0, 100, 4)
454454

@@ -502,7 +502,7 @@ def test_add_vertex_exception_check(self) -> None:
502502
undirected_graph,
503503
directed_graph,
504504
random_vertices,
505-
random_edges,
505+
_random_edges,
506506
) = self.__generate_graphs(20, 0, 100, 4)
507507

508508
for vertex in random_vertices:
@@ -516,7 +516,7 @@ def test_remove_vertex_exception_check(self) -> None:
516516
undirected_graph,
517517
directed_graph,
518518
random_vertices,
519-
random_edges,
519+
_random_edges,
520520
) = self.__generate_graphs(20, 0, 100, 4)
521521

522522
for i in range(101):
@@ -530,7 +530,7 @@ def test_add_edge_exception_check(self) -> None:
530530
(
531531
undirected_graph,
532532
directed_graph,
533-
random_vertices,
533+
_random_vertices,
534534
random_edges,
535535
) = self.__generate_graphs(20, 0, 100, 4)
536536

@@ -569,7 +569,7 @@ def test_contains_edge_exception_check(self) -> None:
569569
undirected_graph,
570570
directed_graph,
571571
random_vertices,
572-
random_edges,
572+
_random_edges,
573573
) = self.__generate_graphs(20, 0, 100, 4)
574574

575575
for vertex in random_vertices:

graphs/graph_adjacency_matrix.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def test_remove_edge(self) -> None:
469469
(
470470
undirected_graph,
471471
directed_graph,
472-
random_vertices,
472+
_random_vertices,
473473
random_edges,
474474
) = self.__generate_graphs(20, 0, 100, 4)
475475

@@ -523,7 +523,7 @@ def test_add_vertex_exception_check(self) -> None:
523523
undirected_graph,
524524
directed_graph,
525525
random_vertices,
526-
random_edges,
526+
_random_edges,
527527
) = self.__generate_graphs(20, 0, 100, 4)
528528

529529
for vertex in random_vertices:
@@ -537,7 +537,7 @@ def test_remove_vertex_exception_check(self) -> None:
537537
undirected_graph,
538538
directed_graph,
539539
random_vertices,
540-
random_edges,
540+
_random_edges,
541541
) = self.__generate_graphs(20, 0, 100, 4)
542542

543543
for i in range(101):
@@ -551,7 +551,7 @@ def test_add_edge_exception_check(self) -> None:
551551
(
552552
undirected_graph,
553553
directed_graph,
554-
random_vertices,
554+
_random_vertices,
555555
random_edges,
556556
) = self.__generate_graphs(20, 0, 100, 4)
557557

@@ -590,7 +590,7 @@ def test_contains_edge_exception_check(self) -> None:
590590
undirected_graph,
591591
directed_graph,
592592
random_vertices,
593-
random_edges,
593+
_random_edges,
594594
) = self.__generate_graphs(20, 0, 100, 4)
595595

596596
for vertex in random_vertices:

knapsack/tests/test_greedy_knapsack.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_negative_max_weight(self):
2828
# profit = [10, 20, 30, 40, 50, 60]
2929
# weight = [2, 4, 6, 8, 10, 12]
3030
# max_weight = -15
31-
pytest.raises(ValueError, match="max_weight must greater than zero.")
31+
pytest.raises(ValueError, match=r"max_weight must greater than zero.")
3232

3333
def test_negative_profit_value(self):
3434
"""
@@ -38,7 +38,7 @@ def test_negative_profit_value(self):
3838
# profit = [10, -20, 30, 40, 50, 60]
3939
# weight = [2, 4, 6, 8, 10, 12]
4040
# max_weight = 15
41-
pytest.raises(ValueError, match="Weight can not be negative.")
41+
pytest.raises(ValueError, match=r"Weight can not be negative.")
4242

4343
def test_negative_weight_value(self):
4444
"""
@@ -48,7 +48,7 @@ def test_negative_weight_value(self):
4848
# profit = [10, 20, 30, 40, 50, 60]
4949
# weight = [2, -4, 6, -8, 10, 12]
5050
# max_weight = 15
51-
pytest.raises(ValueError, match="Profit can not be negative.")
51+
pytest.raises(ValueError, match=r"Profit can not be negative.")
5252

5353
def test_null_max_weight(self):
5454
"""
@@ -58,7 +58,7 @@ def test_null_max_weight(self):
5858
# profit = [10, 20, 30, 40, 50, 60]
5959
# weight = [2, 4, 6, 8, 10, 12]
6060
# max_weight = null
61-
pytest.raises(ValueError, match="max_weight must greater than zero.")
61+
pytest.raises(ValueError, match=r"max_weight must greater than zero.")
6262

6363
def test_unequal_list_length(self):
6464
"""
@@ -68,7 +68,7 @@ def test_unequal_list_length(self):
6868
# profit = [10, 20, 30, 40, 50]
6969
# weight = [2, 4, 6, 8, 10, 12]
7070
# max_weight = 100
71-
pytest.raises(IndexError, match="The length of profit and weight must be same.")
71+
pytest.raises(IndexError, match=r"The length of profit and weight must be same.")
7272

7373

7474
if __name__ == "__main__":

linear_algebra/gaussian_elimination.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def retroactive_resolution(
3333
[ 0.5]])
3434
"""
3535

36-
rows, columns = np.shape(coefficients)
36+
rows, _columns = np.shape(coefficients)
3737

3838
x: NDArray[float64] = np.zeros((rows, 1), dtype=float)
3939
for row in reversed(range(rows)):

linear_algebra/jacobi_iteration_method.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def jacobi_iteration_method(
112112
(coefficient_matrix, constant_matrix), axis=1
113113
)
114114

115-
rows, cols = table.shape
115+
rows, _cols = table.shape
116116

117117
strictly_diagonally_dominant(table)
118118

@@ -149,7 +149,7 @@ def jacobi_iteration_method(
149149

150150
# Here we get 'i_col' - these are the column numbers, for each row
151151
# without diagonal elements, except for the last column.
152-
i_row, i_col = np.where(masks)
152+
_i_row, i_col = np.where(masks)
153153
ind = i_col.reshape(-1, rows - 1)
154154

155155
#'i_col' is converted to a two-dimensional list 'ind', which will be

machine_learning/polynomial_regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def _design_matrix(data: np.ndarray, degree: int) -> np.ndarray:
9393
...
9494
ValueError: Data must have dimensions N x 1
9595
"""
96-
rows, *remaining = data.shape
96+
_rows, *remaining = data.shape
9797
if remaining:
9898
raise ValueError("Data must have dimensions N x 1")
9999

machine_learning/principle_component_analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def main() -> None:
6565
"""
6666
Driver function to execute PCA and display results.
6767
"""
68-
data_x, data_y = collect_dataset()
68+
data_x, _data_y = collect_dataset()
6969

7070
# Number of principal components to retain
7171
n_components = 2

0 commit comments

Comments
 (0)