Simplify the declarations of the Python code.

This commit is contained in:
krahets
2023-05-22 22:03:57 +08:00
parent 081b76d620
commit e196962d0a
27 changed files with 88 additions and 87 deletions

View File

@ -23,7 +23,7 @@ class ArrayHashMap:
def hash_func(self, key: int) -> int:
"""哈希函数"""
index: int = key % 100
index = key % 100
return index
def get(self, key: int) -> str:
@ -56,7 +56,7 @@ class ArrayHashMap:
def key_set(self) -> list[int]:
"""获取所有键"""
result: list[int] = []
result = []
for pair in self.buckets:
if pair is not None:
result.append(pair.key)
@ -64,7 +64,7 @@ class ArrayHashMap:
def value_set(self) -> list[str]:
"""获取所有值"""
result: list[str] = []
result = []
for pair in self.buckets:
if pair is not None:
result.append(pair.val)