From 71fe1ca6595abb0924d1719d714fcd3b8db820b0 Mon Sep 17 00:00:00 2001 From: barklan Date: Sun, 24 Jan 2021 08:44:19 +0300 Subject: [PATCH 1/5] fix type annotations in binary_tree_traversals --- traversals/binary_tree_traversals.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/traversals/binary_tree_traversals.py b/traversals/binary_tree_traversals.py index cb471ba55bac..f919a2962354 100644 --- a/traversals/binary_tree_traversals.py +++ b/traversals/binary_tree_traversals.py @@ -188,7 +188,7 @@ def pre_order_iter(node: TreeNode) -> None: """ if not isinstance(node, TreeNode) or not node: return - stack: List[TreeNode] = [] + stack: list[TreeNode] = [] n = node while n or stack: while n: # start from root node, find its left child @@ -218,7 +218,7 @@ def in_order_iter(node: TreeNode) -> None: """ if not isinstance(node, TreeNode) or not node: return - stack: List[TreeNode] = [] + stack: list[TreeNode] = [] n = node while n or stack: while n: From a1df380c47437665c013d7784ca91d53e22d7b6c Mon Sep 17 00:00:00 2001 From: barklan Date: Sun, 24 Jan 2021 08:50:42 +0300 Subject: [PATCH 2/5] Fix type in hashes/sdbm.py --- hashes/sdbm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hashes/sdbm.py b/hashes/sdbm.py index 86d47a1d9967..daf292717f75 100644 --- a/hashes/sdbm.py +++ b/hashes/sdbm.py @@ -19,7 +19,7 @@ """ -def sdbm(plain_text: str) -> str: +def sdbm(plain_text: str) -> int: """ Function implements sdbm hash, easy to use, great for bits scrambling. iterates over each character in the given string and applies function to each of From 2f410e945de3dd17022781a90d96f56c9ee617e9 Mon Sep 17 00:00:00 2001 From: barklan Date: Sun, 24 Jan 2021 08:56:50 +0300 Subject: [PATCH 3/5] Fix type in hashes/adler32.py --- hashes/adler32.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hashes/adler32.py b/hashes/adler32.py index fad747abe3c3..13d0b2bb7a3c 100644 --- a/hashes/adler32.py +++ b/hashes/adler32.py @@ -9,7 +9,7 @@ """ -def adler32(plain_text: str) -> str: +def adler32(plain_text: str) -> int: """ Function implements adler-32 hash. Itterates and evaluates new value for each character From 1422a6913b29ac2f959f9cc46dfb5131ebc85570 Mon Sep 17 00:00:00 2001 From: barklan Date: Sun, 24 Jan 2021 09:04:37 +0300 Subject: [PATCH 4/5] Add type annotations in hashes/chaos_machine.py --- hashes/chaos_machine.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hashes/chaos_machine.py b/hashes/chaos_machine.py index 1bdf984b68de..ec0c78fc88f2 100644 --- a/hashes/chaos_machine.py +++ b/hashes/chaos_machine.py @@ -6,7 +6,8 @@ m = 5 # Buffer Space (with Parameters Space) -buffer_space, params_space = [], [] +buffer_space: list[int] = [] +params_space: list[int] = [] # Machine Time machine_time = 0 From c991b9fdf03ecd5dbbd433acd647c9fbe87da6be Mon Sep 17 00:00:00 2001 From: barklan Date: Sun, 24 Jan 2021 09:08:02 +0300 Subject: [PATCH 5/5] Add int type annotations in hashes/md5.py --- hashes/md5.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hashes/md5.py b/hashes/md5.py index b7888fb610ac..e69f08770f7f 100644 --- a/hashes/md5.py +++ b/hashes/md5.py @@ -25,7 +25,7 @@ def rearrange(bitString32): return newString -def reformatHex(i): +def reformatHex(i: int) -> str: """[summary] Converts the given integer into 8-digit hex number. @@ -81,7 +81,7 @@ def getBlock(bitString): currPos += 512 -def not32(i): +def not32(i: int) -> int: """ >>> not32(34) 4294967261