Skip to content

Commit e160574

Browse files
committed
fix: Fix pre-commit errors
1 parent 2777e5d commit e160574

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

Diff for: digital_image_processing/test_digital_image_processing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def test_nearest_neighbour(
9696

9797

9898
def test_local_binary_pattern():
99-
file_path: str = "digital_image_processing/image_data/lena.jpg"
99+
file_path = "digital_image_processing/image_data/lena.jpg"
100100

101101
# Reading the image and converting it to grayscale.
102102
image = imread(file_path, 0)

Diff for: dynamic_programming/fibonacci.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def get(self, index: int) -> list:
2424
return self.sequence[:index]
2525

2626

27-
def main():
27+
def main() -> None:
2828
print(
2929
"Fibonacci Series Using Dynamic Programming\n",
3030
"Enter the index of the Fibonacci number you want to calculate ",

Diff for: maths/euclidean_distance.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
from __future__ import annotations
22

3+
import typing
34
from collections.abc import Iterable
45

56
import numpy as np
67

7-
Vector = Iterable[float] | Iterable[int], np.ndarray
8-
VectorOut = np.float64 | int, float
8+
Vector = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007
9+
VectorOut = typing.Union[np.float64, int, float] # noqa: UP007
910

1011

1112
def euclidean_distance(vector_1: Vector, vector_2: Vector) -> VectorOut:

Diff for: searches/binary_tree_traversal.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ def __init__(self, data):
1313
self.left = None
1414

1515

16-
def build_tree():
16+
def build_tree() -> TreeNode:
1717
print("\n********Press N to stop entering at any point of time********\n")
18-
check = input("Enter the value of the root node: ").strip().lower() or "n"
19-
if check == "n":
20-
return None
18+
check = input("Enter the value of the root node: ").strip().lower()
2119
q: queue.Queue = queue.Queue()
2220
tree_node = TreeNode(int(check))
2321
q.put(tree_node)
@@ -37,7 +35,7 @@ def build_tree():
3735
right_node = TreeNode(int(check))
3836
node_found.right = right_node
3937
q.put(right_node)
40-
return None
38+
raise
4139

4240

4341
def pre_order(node: TreeNode) -> None:
@@ -272,7 +270,7 @@ def prompt(s: str = "", width=50, char="*") -> str:
272270
doctest.testmod()
273271
print(prompt("Binary Tree Traversals"))
274272

275-
node = build_tree()
273+
node: TreeNode = build_tree()
276274
print(prompt("Pre Order Traversal"))
277275
pre_order(node)
278276
print(prompt() + "\n")

0 commit comments

Comments
 (0)