Skip to content

Commit aadf8b1

Browse files
committed
ruff rule ANN204 missing-return-type-special-method
1 parent dbf22d3 commit aadf8b1

73 files changed

Lines changed: 125 additions & 121 deletions

File tree

Some content is hidden

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

ciphers/xor_cipher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
class XORCipher:
24-
def __init__(self, key: int = 0):
24+
def __init__(self, key: int = 0) -> None:
2525
"""
2626
simple constructor that receives a key or uses
2727
default key = 0

computer_vision/harris_corner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
class HarrisCorner:
11-
def __init__(self, k: float, window_size: int):
11+
def __init__(self, k: float, window_size: int) -> None:
1212
"""
1313
k : is an empirically determined constant in [0.04,0.06]
1414
window_size : neighbourhoods considered

data_compression/huffman.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
class Letter:
7-
def __init__(self, letter: str, freq: int):
7+
def __init__(self, letter: str, freq: int) -> None:
88
self.letter: str = letter
99
self.freq: int = freq
1010
self.bitstring: dict[str, str] = {}
@@ -14,7 +14,9 @@ def __repr__(self) -> str:
1414

1515

1616
class TreeNode:
17-
def __init__(self, freq: int, left: Letter | TreeNode, right: Letter | TreeNode):
17+
def __init__(
18+
self, freq: int, left: Letter | TreeNode, right: Letter | TreeNode
19+
) -> None:
1820
self.freq: int = freq
1921
self.left: Letter | TreeNode = left
2022
self.right: Letter | TreeNode = right

data_structures/binary_tree/segment_tree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
class SegmentTree:
5-
def __init__(self, a):
5+
def __init__(self, a) -> None:
66
self.A = a
77
self.N = len(self.A)
88
self.st = [0] * (

data_structures/binary_tree/segment_tree_other.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010

1111
class SegmentTreeNode:
12-
def __init__(self, start, end, val, left=None, right=None):
12+
def __init__(self, start, end, val, left=None, right=None) -> None:
1313
self.start = start
1414
self.end = end
1515
self.val = val
1616
self.mid = (start + end) // 2
1717
self.left = left
1818
self.right = right
1919

20-
def __repr__(self):
20+
def __repr__(self) -> str:
2121
return f"SegmentTreeNode(start={self.start}, end={self.end}, val={self.val})"
2222

2323

@@ -127,7 +127,7 @@ class SegmentTree:
127127
>>>
128128
"""
129129

130-
def __init__(self, collection: Sequence, function):
130+
def __init__(self, collection: Sequence, function) -> None:
131131
self.collection = collection
132132
self.fn = function
133133
if self.collection:

data_structures/binary_tree/treap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Node:
99
Treap is a binary tree by value and heap by priority
1010
"""
1111

12-
def __init__(self, value: int | None = None):
12+
def __init__(self, value: int | None = None) -> None:
1313
self.value = value
1414
self.prior = random()
1515
self.left: Node | None = None

data_structures/hashing/double_hash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class DoubleHash(HashTable):
2121
Hash Table example with open addressing and Double Hash
2222
"""
2323

24-
def __init__(self, *args, **kwargs):
24+
def __init__(self, *args, **kwargs) -> None:
2525
super().__init__(*args, **kwargs)
2626

2727
def __hash_function_2(self, value, data):

data_structures/hashing/hash_table_with_linked_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
class HashTableWithLinkedList(HashTable):
7-
def __init__(self, *args, **kwargs):
7+
def __init__(self, *args, **kwargs) -> None:
88
super().__init__(*args, **kwargs)
99

1010
def _set_value(self, key, data):

data_structures/hashing/quadratic_probing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class QuadraticProbing(HashTable):
88
Basic Hash Table example with open addressing using Quadratic Probing
99
"""
1010

11-
def __init__(self, *args, **kwargs):
11+
def __init__(self, *args, **kwargs) -> None:
1212
super().__init__(*args, **kwargs)
1313

1414
def _collision_resolution(self, key, data=None): # noqa: ARG002

data_structures/heap/binomial_heap.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Node:
1212
- link to left, right and parent nodes
1313
"""
1414

15-
def __init__(self, val):
15+
def __init__(self, val) -> None:
1616
self.val = val
1717
# Number of nodes in left subtree
1818
self.left_tree_size = 0
@@ -123,7 +123,7 @@ class BinomialHeap:
123123
[17, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 34]
124124
"""
125125

126-
def __init__(self, bottom_root=None, min_node=None, heap_size=0):
126+
def __init__(self, bottom_root=None, min_node=None, heap_size=0) -> None:
127127
self.size = heap_size
128128
self.bottom_root = bottom_root
129129
self.min_node = min_node
@@ -384,7 +384,7 @@ def __traversal(self, curr_node, preorder, level=0):
384384
else:
385385
preorder.append(("#", level))
386386

387-
def __str__(self):
387+
def __str__(self) -> str:
388388
"""
389389
Overwriting str for a pre-order print of nodes in heap;
390390
Performance is poor, so use only for small examples

0 commit comments

Comments
 (0)