fixed(py): Fixed HashModel.

This commit is contained in:
KyMAN 2026-07-16 07:20:53 +02:00
parent 8d88c077b2
commit dc026f162e

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from hashlib import md5, sha1, sha256, blake2b, _Hash as Hash from hashlib import md5, sha1, sha256, blake2b
from zlib import crc32 from zlib import crc32
from typing import Self, Protocol from typing import Self, Protocol
from AnP.Utils.Checks import Check from AnP.Utils.Checks import Check
@ -24,7 +24,7 @@ class CRC32HashAlgorithm(HashAlgorithm):
class HashModel(): class HashModel():
@staticmethod @staticmethod
def algorithms() -> dict[str, type[HashAlgorithm|Hash]]: def algorithms() -> dict[str, type[HashAlgorithm]]:
return { return {
"md5" : md5, "md5" : md5,
"sha1" : sha1, "sha1" : sha1,
@ -42,7 +42,7 @@ class HashModel():
self.blake2b:str = "" self.blake2b:str = ""
self.crc32:str = "" self.crc32:str = ""
self.__hashes:list[str] = list(self.algorithms().keys()) self.__hashes:list[str] = list(self.algorithms().keys())
self.__algorithms:list[HashAlgorithm|Hash] = [ self.__algorithms:list[HashAlgorithm] = [
method() for method in list(self.algorithms().values()) method() for method in list(self.algorithms().values())
] ]