Skip to content

Commit 229500f

Browse files
committed
Fix
1 parent d75c631 commit 229500f

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

Diff for: compression/huffman.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def build_tree(letters: list[Letter]) -> Letter | TreeNode:
4040
Run through the list of Letters and build the min heap
4141
for the Huffman Tree.
4242
"""
43-
response: list[Letter | TreeNode] = letters
43+
response: list[Letter | TreeNode] = letters.copy()
4444
while len(response) > 1:
4545
left = response.pop(0)
4646
right = response.pop(0)

Diff for: data_structures/binary_tree/binary_search_tree.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ def remove(self, value: int) -> None:
294294
predecessor = self.get_max(
295295
node.left
296296
) # Gets the max value of the left branch
297-
self.remove(predecessor.value)
297+
self.remove(predecessor.value) # type: ignore[union-attr]
298298
node.value = (
299-
predecessor.value
299+
predecessor.value # type: ignore[union-attr]
300300
) # Assigns the value to the node to delete and keep tree structure
301301

302302
def preorder_traverse(self, node: Node | None) -> Iterable:

Diff for: maths/entropy.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ def analyze_text(text: str) -> tuple[dict, dict]:
9696
The first dictionary stores the frequency of single character strings.
9797
The second dictionary stores the frequency of two character strings.
9898
"""
99-
single_char_strings = Counter()
100-
two_char_strings = Counter()
99+
single_char_strings = Counter() # type: ignore[var-annotated]
100+
two_char_strings = Counter() # type: ignore[var-annotated]
101101
single_char_strings[text[-1]] += 1
102102

103103
# first case when we have space at start.

Diff for: matrix/spiral_print.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def spiral_traversal(matrix: list[list]) -> list[int]:
116116
[1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7] + spiral_traversal([])
117117
"""
118118
if matrix:
119-
return list(matrix.pop(0)) + spiral_traversal(list(zip(*matrix))[::-1])
119+
return list(matrix.pop(0)) + spiral_traversal([list(row) for row in zip(*matrix)][::-1])
120120
else:
121121
return []
122122

Diff for: project_euler/problem_092/sol1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def chain(number: int) -> bool:
6868
"""
6969

7070
if CHAINS[number - 1] is not None:
71-
return CHAINS[number - 1]
71+
return CHAINS[number - 1] # type: ignore[return-value]
7272

7373
number_chain = chain(next_number(number))
7474
CHAINS[number - 1] = number_chain

Diff for: scripts/validate_filenames.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
try:
55
from .build_directory_md import good_file_paths
66
except ImportError:
7-
from build_directory_md import good_file_paths
7+
from build_directory_md import good_file_paths # type: ignore[no-redef]
88

99
filepaths = list(good_file_paths())
1010
assert filepaths, "good_file_paths() failed!"

Diff for: scripts/validate_solutions.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
def convert_path_to_module(file_path: pathlib.Path) -> ModuleType:
2222
"""Converts a file path to a Python module"""
2323
spec = importlib.util.spec_from_file_location(file_path.name, str(file_path))
24-
module = importlib.util.module_from_spec(spec)
25-
spec.loader.exec_module(module)
24+
module = importlib.util.module_from_spec(spec) # type: ignore[arg-type]
25+
spec.loader.exec_module(module) # type: ignore[union-attr]
2626
return module
2727

2828

0 commit comments

Comments
 (0)