Skip to content

Commit 421ace8

Browse files
pre-commit-ci[bot]github-actionscclauss
authored
[pre-commit.ci] pre-commit autoupdate (TheAlgorithms#9013)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.285 → v0.0.286](astral-sh/ruff-pre-commit@v0.0.285...v0.0.286) - [github.com/tox-dev/pyproject-fmt: 0.13.1 → 1.1.0](tox-dev/pyproject-fmt@0.13.1...1.1.0) * updating DIRECTORY.md * Fis ruff rules PIE808,PLR1714 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com>
1 parent 0a94380 commit 421ace8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+70
-71
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
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.0.285
19+
rev: v0.0.286
2020
hooks:
2121
- id: ruff
2222

@@ -33,7 +33,7 @@ repos:
3333
- tomli
3434

3535
- repo: https://github.com/tox-dev/pyproject-fmt
36-
rev: "0.13.1"
36+
rev: "1.1.0"
3737
hooks:
3838
- id: pyproject-fmt
3939

DIRECTORY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@
245245
* Stacks
246246
* [Balanced Parentheses](data_structures/stacks/balanced_parentheses.py)
247247
* [Dijkstras Two Stack Algorithm](data_structures/stacks/dijkstras_two_stack_algorithm.py)
248-
* [Evaluate Postfix Notations](data_structures/stacks/evaluate_postfix_notations.py)
249248
* [Infix To Postfix Conversion](data_structures/stacks/infix_to_postfix_conversion.py)
250249
* [Infix To Prefix Conversion](data_structures/stacks/infix_to_prefix_conversion.py)
251250
* [Next Greater Element](data_structures/stacks/next_greater_element.py)

arithmetic_analysis/jacobi_iteration_method.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ def strictly_diagonally_dominant(table: NDArray[float64]) -> bool:
152152

153153
is_diagonally_dominant = True
154154

155-
for i in range(0, rows):
155+
for i in range(rows):
156156
total = 0
157-
for j in range(0, cols - 1):
157+
for j in range(cols - 1):
158158
if i == j:
159159
continue
160160
else:

arithmetic_analysis/secant_method.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def secant_method(lower_bound: float, upper_bound: float, repeats: int) -> float
2020
"""
2121
x0 = lower_bound
2222
x1 = upper_bound
23-
for _ in range(0, repeats):
23+
for _ in range(repeats):
2424
x0, x1 = x1, x1 - (f(x1) * (x1 - x0)) / (f(x1) - f(x0))
2525
return x1
2626

backtracking/hamiltonian_cycle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def util_hamilton_cycle(graph: list[list[int]], path: list[int], curr_ind: int)
9595
return graph[path[curr_ind - 1]][path[0]] == 1
9696

9797
# Recursive Step
98-
for next_ver in range(0, len(graph)):
98+
for next_ver in range(len(graph)):
9999
if valid_connection(graph, next_ver, curr_ind, path):
100100
# Insert current vertex into path as next transition
101101
path[curr_ind] = next_ver

backtracking/sudoku.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def is_safe(grid: Matrix, row: int, column: int, n: int) -> bool:
4848
is found) else returns True if it is 'safe'
4949
"""
5050
for i in range(9):
51-
if grid[row][i] == n or grid[i][column] == n:
51+
if n in {grid[row][i], grid[i][column]}:
5252
return False
5353

5454
for i in range(3):

bit_manipulation/reverse_bits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def get_reverse_bit_string(number: int) -> str:
2020
)
2121
raise TypeError(msg)
2222
bit_string = ""
23-
for _ in range(0, 32):
23+
for _ in range(32):
2424
bit_string += str(number % 2)
2525
number = number >> 1
2626
return bit_string

ciphers/trafid_cipher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def decrypt_message(
119119
for i in range(0, len(message) + 1, period):
120120
a, b, c = __decrypt_part(message[i : i + period], character_to_number)
121121

122-
for j in range(0, len(a)):
122+
for j in range(len(a)):
123123
decrypted_numeric.append(a[j] + b[j] + c[j])
124124

125125
for each in decrypted_numeric:

data_structures/binary_tree/lazy_segment_tree.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ class SegmentTree:
77
def __init__(self, size: int) -> None:
88
self.size = size
99
# approximate the overall size of segment tree with given value
10-
self.segment_tree = [0 for i in range(0, 4 * size)]
10+
self.segment_tree = [0 for i in range(4 * size)]
1111
# create array to store lazy update
12-
self.lazy = [0 for i in range(0, 4 * size)]
13-
self.flag = [0 for i in range(0, 4 * size)] # flag for lazy update
12+
self.lazy = [0 for i in range(4 * size)]
13+
self.flag = [0 for i in range(4 * size)] # flag for lazy update
1414

1515
def left(self, idx: int) -> int:
1616
"""

data_structures/linked_list/circular_linked_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def test_circular_linked_list() -> None:
125125
circular_linked_list.insert_tail(6)
126126
assert str(circular_linked_list) == "->".join(str(i) for i in range(1, 7))
127127
circular_linked_list.insert_head(0)
128-
assert str(circular_linked_list) == "->".join(str(i) for i in range(0, 7))
128+
assert str(circular_linked_list) == "->".join(str(i) for i in range(7))
129129

130130
assert circular_linked_list.delete_front() == 0
131131
assert circular_linked_list.delete_tail() == 6

0 commit comments

Comments
 (0)