Upgrade to flake8 v6 (#8007)

* Upgrade to flake8 v6

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
Christian Clauss 2022-11-29 16:56:41 +01:00 committed by GitHub
parent f32d611689
commit 08c2245705
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 13 deletions

View File

@ -4,5 +4,7 @@ max-line-length = 88
max-complexity = 19
extend-ignore =
# Formatting style for `black`
E203 # Whitespace before ':'
W503 # Line break occurred before a binary operator
# E203 is whitespace before ':'
E203,
# W503 is line break occurred before a binary operator
W503

View File

@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-executables-have-shebangs
- id: check-yaml
@ -34,13 +34,13 @@ repos:
- --py311-plus
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 6.0.0
hooks:
- id: flake8 # See .flake8 for args
additional_dependencies: &flake8-plugins
- flake8-bugbear
- flake8-builtins
- flake8-broken-line
# - flake8-broken-line
- flake8-comprehensions
- pep8-naming

View File

@ -375,6 +375,7 @@
* [Articulation Points](graphs/articulation_points.py)
* [Basic Graphs](graphs/basic_graphs.py)
* [Bellman Ford](graphs/bellman_ford.py)
* [Bi Directional Dijkstra](graphs/bi_directional_dijkstra.py)
* [Bidirectional A Star](graphs/bidirectional_a_star.py)
* [Bidirectional Breadth First Search](graphs/bidirectional_breadth_first_search.py)
* [Boruvka](graphs/boruvka.py)
@ -563,6 +564,7 @@
* [Is Ip V4 Address Valid](maths/is_ip_v4_address_valid.py)
* [Is Square Free](maths/is_square_free.py)
* [Jaccard Similarity](maths/jaccard_similarity.py)
* [Juggler Sequence](maths/juggler_sequence.py)
* [Kadanes](maths/kadanes.py)
* [Karatsuba](maths/karatsuba.py)
* [Krishnamurthy Number](maths/krishnamurthy_number.py)

View File

@ -32,7 +32,7 @@ def parse_file(file_path: str) -> list[Letter]:
if not c:
break
chars[c] = chars[c] + 1 if c in chars else 1
return sorted((Letter(c, f) for c, f in chars.items()), key=lambda l: l.freq)
return sorted((Letter(c, f) for c, f in chars.items()), key=lambda x: x.freq)
def build_tree(letters: list[Letter]) -> Letter | TreeNode:
@ -47,7 +47,7 @@ def build_tree(letters: list[Letter]) -> Letter | TreeNode:
total_freq = left.freq + right.freq
node = TreeNode(total_freq, left, right)
response.append(node)
response.sort(key=lambda l: l.freq)
response.sort(key=lambda x: x.freq)
return response[0]

View File

@ -106,7 +106,7 @@ class SegmentTree(Generic[T]):
l, r = l + self.N, r + self.N
res: T | None = None
while l <= r: # noqa: E741
while l <= r:
if l % 2 == 1:
res = self.st[l] if res is None else self.fn(res, self.st[l])
if r % 2 == 0:

View File

@ -16,7 +16,7 @@ class SegmentTree:
return idx * 2 + 1
def build(self, idx, l, r): # noqa: E741
if l == r: # noqa: E741
if l == r:
self.st[idx] = A[l]
else:
mid = (l + r) // 2
@ -33,7 +33,7 @@ class SegmentTree:
"""
if r < a or l > b:
return True
if l == r: # noqa: E741
if l == r:
self.st[idx] = val
return True
mid = (l + r) // 2
@ -51,7 +51,7 @@ class SegmentTree:
"""
if r < a or l > b:
return -math.inf
if l >= a and r <= b: # noqa: E741
if l >= a and r <= b:
return self.st[idx]
mid = (l + r) // 2
q1 = self.query_recursive(self.left(idx), l, mid, a, b)

View File

@ -314,7 +314,7 @@ class SmoSVM:
l, h = max(0.0, a2 - a1), min(self._c, self._c + a2 - a1)
else:
l, h = max(0.0, a2 + a1 - self._c), min(self._c, a2 + a1)
if l == h: # noqa: E741
if l == h:
return None, None
# calculate eta

View File

@ -99,7 +99,6 @@ def solution(filename: str = "p107_network.txt") -> int:
"""
script_dir: str = os.path.abspath(os.path.dirname(__file__))
network_file: str = os.path.join(script_dir, filename)
adjacency_matrix: list[list[str]]
edges: dict[EdgeT, int] = {}
data: list[str]
edge1: int