mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
[mypy] fix hashes folder (#4305)
* fix hashes-folder * Update build.yml * fix doctests * return-values to int * Update hashes/adler32.py * type hints for elements Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
parent
5229c74955
commit
a53fcf221b
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
|||||||
python -m pip install mypy pytest-cov -r requirements.txt
|
python -m pip install mypy pytest-cov -r requirements.txt
|
||||||
# FIXME: #4052 fix mypy errors in the exclude directories and remove them below
|
# FIXME: #4052 fix mypy errors in the exclude directories and remove them below
|
||||||
- run: mypy --ignore-missing-imports
|
- run: mypy --ignore-missing-imports
|
||||||
--exclude '(ciphers|conversions|data_structures|digital_image_processing|dynamic_programming|graphs|hashes|linear_algebra|maths|matrix|other|project_euler|scripts|searches|strings*)/$' .
|
--exclude '(ciphers|conversions|data_structures|digital_image_processing|dynamic_programming|graphs|linear_algebra|maths|matrix|other|project_euler|scripts|searches|strings*)/$' .
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/ --cov-report=term-missing:skip-covered --cov=. .
|
run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/ --cov-report=term-missing:skip-covered --cov=. .
|
||||||
- if: ${{ success() }}
|
- if: ${{ success() }}
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def adler32(plain_text: str) -> str:
|
def adler32(plain_text: str) -> int:
|
||||||
"""
|
"""
|
||||||
Function implements adler-32 hash.
|
Function implements adler-32 hash.
|
||||||
Itterates and evaluates new value for each character
|
Iterates and evaluates a new value for each character
|
||||||
|
|
||||||
>>> adler32('Algorithms')
|
>>> adler32('Algorithms')
|
||||||
363791387
|
363791387
|
||||||
|
@ -6,7 +6,8 @@ t = 3
|
|||||||
m = 5
|
m = 5
|
||||||
|
|
||||||
# Buffer Space (with Parameters Space)
|
# Buffer Space (with Parameters Space)
|
||||||
buffer_space, params_space = [], []
|
buffer_space: list[float] = []
|
||||||
|
params_space: list[float] = []
|
||||||
|
|
||||||
# Machine Time
|
# Machine Time
|
||||||
machine_time = 0
|
machine_time = 0
|
||||||
|
@ -41,8 +41,7 @@ def engine(input_character):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
decode = input("Type your message:\n")
|
decode = list(input("Type your message:\n"))
|
||||||
decode = list(decode)
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
token = int(input("Please set token:(must be only digits)\n"))
|
token = int(input("Please set token:(must be only digits)\n"))
|
||||||
@ -51,8 +50,8 @@ if __name__ == "__main__":
|
|||||||
print(error)
|
print(error)
|
||||||
for i in range(token):
|
for i in range(token):
|
||||||
rotator()
|
rotator()
|
||||||
for i in decode:
|
for j in decode:
|
||||||
engine(i)
|
engine(j)
|
||||||
print("\n" + "".join(code))
|
print("\n" + "".join(code))
|
||||||
print(
|
print(
|
||||||
f"\nYour Token is {token} please write it down.\nIf you want to decode "
|
f"\nYour Token is {token} please write it down.\nIf you want to decode "
|
||||||
|
@ -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.
|
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
|
iterates over each character in the given string and applies function to each of
|
||||||
|
Loading…
Reference in New Issue
Block a user