Skip to content

Commit 08c2245

Browse files
cclaussgithub-actions
and
github-actions
authored
Upgrade to flake8 v6 (TheAlgorithms#8007)
* Upgrade to flake8 v6 * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent f32d611 commit 08c2245

File tree

8 files changed

+16
-13
lines changed

8 files changed

+16
-13
lines changed

.flake8

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ max-line-length = 88
44
max-complexity = 19
55
extend-ignore =
66
# Formatting style for `black`
7-
E203 # Whitespace before ':'
8-
W503 # Line break occurred before a binary operator
7+
# E203 is whitespace before ':'
8+
E203,
9+
# W503 is line break occurred before a binary operator
10+
W503

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.3.0
3+
rev: v4.4.0
44
hooks:
55
- id: check-executables-have-shebangs
66
- id: check-yaml
@@ -34,13 +34,13 @@ repos:
3434
- --py311-plus
3535

3636
- repo: https://github.com/PyCQA/flake8
37-
rev: 5.0.4
37+
rev: 6.0.0
3838
hooks:
3939
- id: flake8 # See .flake8 for args
4040
additional_dependencies: &flake8-plugins
4141
- flake8-bugbear
4242
- flake8-builtins
43-
- flake8-broken-line
43+
# - flake8-broken-line
4444
- flake8-comprehensions
4545
- pep8-naming
4646

DIRECTORY.md

+2
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@
375375
* [Articulation Points](graphs/articulation_points.py)
376376
* [Basic Graphs](graphs/basic_graphs.py)
377377
* [Bellman Ford](graphs/bellman_ford.py)
378+
* [Bi Directional Dijkstra](graphs/bi_directional_dijkstra.py)
378379
* [Bidirectional A Star](graphs/bidirectional_a_star.py)
379380
* [Bidirectional Breadth First Search](graphs/bidirectional_breadth_first_search.py)
380381
* [Boruvka](graphs/boruvka.py)
@@ -563,6 +564,7 @@
563564
* [Is Ip V4 Address Valid](maths/is_ip_v4_address_valid.py)
564565
* [Is Square Free](maths/is_square_free.py)
565566
* [Jaccard Similarity](maths/jaccard_similarity.py)
567+
* [Juggler Sequence](maths/juggler_sequence.py)
566568
* [Kadanes](maths/kadanes.py)
567569
* [Karatsuba](maths/karatsuba.py)
568570
* [Krishnamurthy Number](maths/krishnamurthy_number.py)

compression/huffman.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def parse_file(file_path: str) -> list[Letter]:
3232
if not c:
3333
break
3434
chars[c] = chars[c] + 1 if c in chars else 1
35-
return sorted((Letter(c, f) for c, f in chars.items()), key=lambda l: l.freq)
35+
return sorted((Letter(c, f) for c, f in chars.items()), key=lambda x: x.freq)
3636

3737

3838
def build_tree(letters: list[Letter]) -> Letter | TreeNode:
@@ -47,7 +47,7 @@ def build_tree(letters: list[Letter]) -> Letter | TreeNode:
4747
total_freq = left.freq + right.freq
4848
node = TreeNode(total_freq, left, right)
4949
response.append(node)
50-
response.sort(key=lambda l: l.freq)
50+
response.sort(key=lambda x: x.freq)
5151
return response[0]
5252

5353

data_structures/binary_tree/non_recursive_segment_tree.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def query(self, l: int, r: int) -> T | None: # noqa: E741
106106
l, r = l + self.N, r + self.N
107107

108108
res: T | None = None
109-
while l <= r: # noqa: E741
109+
while l <= r:
110110
if l % 2 == 1:
111111
res = self.st[l] if res is None else self.fn(res, self.st[l])
112112
if r % 2 == 0:

data_structures/binary_tree/segment_tree.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def right(self, idx):
1616
return idx * 2 + 1
1717

1818
def build(self, idx, l, r): # noqa: E741
19-
if l == r: # noqa: E741
19+
if l == r:
2020
self.st[idx] = A[l]
2121
else:
2222
mid = (l + r) // 2
@@ -33,7 +33,7 @@ def update_recursive(self, idx, l, r, a, b, val): # noqa: E741
3333
"""
3434
if r < a or l > b:
3535
return True
36-
if l == r: # noqa: E741
36+
if l == r:
3737
self.st[idx] = val
3838
return True
3939
mid = (l + r) // 2
@@ -51,7 +51,7 @@ def query_recursive(self, idx, l, r, a, b): # noqa: E741
5151
"""
5252
if r < a or l > b:
5353
return -math.inf
54-
if l >= a and r <= b: # noqa: E741
54+
if l >= a and r <= b:
5555
return self.st[idx]
5656
mid = (l + r) // 2
5757
q1 = self.query_recursive(self.left(idx), l, mid, a, b)

machine_learning/sequential_minimum_optimization.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def _get_new_alpha(self, i1, i2, a1, a2, e1, e2, y1, y2):
314314
l, h = max(0.0, a2 - a1), min(self._c, self._c + a2 - a1)
315315
else:
316316
l, h = max(0.0, a2 + a1 - self._c), min(self._c, a2 + a1)
317-
if l == h: # noqa: E741
317+
if l == h:
318318
return None, None
319319

320320
# calculate eta

project_euler/problem_107/sol1.py

-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ def solution(filename: str = "p107_network.txt") -> int:
9999
"""
100100
script_dir: str = os.path.abspath(os.path.dirname(__file__))
101101
network_file: str = os.path.join(script_dir, filename)
102-
adjacency_matrix: list[list[str]]
103102
edges: dict[EdgeT, int] = {}
104103
data: list[str]
105104
edge1: int

0 commit comments

Comments
 (0)