diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 951ac5bf2252bc0b8813c05ddb223065468edeb4..ae674949f50021f2043a34958abadf0f225fc43b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: - id: isort args: ["--profile", "black"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.991 + rev: v1.3.0 hooks: - id: mypy args: diff --git a/duniterpy/documents/ws2p/heads.py b/duniterpy/documents/ws2p/heads.py index 04cc8d0450d77795ddf3fdf3f9fb2d2d5cdb07f6..9f6a3ec491829cd3fda415afe3b98693636ae47c 100644 --- a/duniterpy/documents/ws2p/heads.py +++ b/duniterpy/documents/ws2p/heads.py @@ -48,7 +48,7 @@ class API: raise MalformedDocumentError("WS2P API Document") private = "" if data.group(1) is None else data.group(1) public = "" if data.group(2) is None else data.group(2) - return cls(private, public) + return cls(private, public) # type: ignore[call-arg] def __str__(self) -> str: return f"WS2P{self.private}{self.public}" @@ -68,7 +68,7 @@ class Head: raise MalformedDocumentError("Head") head = data.group(0).split(":") version = int(head[1]) if len(head) == 2 else 0 - return cls(version) + return cls(version) # type: ignore[call-arg] except AttributeError: raise MalformedDocumentError("Head") from AttributeError @@ -102,7 +102,7 @@ class HeadV0(Head): pubkey = data.group(3) block_id = BlockID.from_str(data.group(4)) offload = data.group(5) - return cls(head.version, signature, api, head, pubkey, block_id), offload + return cls(head.version, signature, api, head, pubkey, block_id), offload # type: ignore[call-arg] except AttributeError: raise MalformedDocumentError("HeadV0") from AttributeError @@ -162,7 +162,7 @@ class HeadV1(HeadV0): pow_prefix = int(data.group(4)) offload = data.group(5) return ( - cls( + cls( # type: ignore[call-arg] v0.version, v0.signature, v0.api, @@ -201,7 +201,7 @@ class HeadV2(HeadV1): free_member_room = int(data.group(1)) free_mirror_room = int(data.group(2)) return ( - cls( + cls( # type: ignore[call-arg] v1.version, v1.signature, v1.api, diff --git a/examples/load_credentials_file.py b/examples/load_credentials_file.py index bf3788b79d9e57363a4a6837578116771ec767ba..1d32eaf11c0af65d87f38a86040dd6dfcf7aa218 100644 --- a/examples/load_credentials_file.py +++ b/examples/load_credentials_file.py @@ -28,9 +28,7 @@ def load_credentials_file(signing_key_instance=None): credentials_filepath = sys.argv[1] # create SigningKey instance from file - signing_key_instance = SigningKey.from_credentials_file( - credentials_filepath - ) # type: SigningKey + signing_key_instance = SigningKey.from_credentials_file(credentials_filepath) # print pubkey print(f"Public key from credentials file: {signing_key_instance.pubkey}") diff --git a/examples/load_scuttlebutt_file.py b/examples/load_scuttlebutt_file.py index f36ce1ec9428b8a7b65689af7ec084022f3b259c..def5c105912d74c866981e0a66757808ad2a1964 100644 --- a/examples/load_scuttlebutt_file.py +++ b/examples/load_scuttlebutt_file.py @@ -28,9 +28,7 @@ def load_scuttlebutt_file(signing_key_insance=None): scuttlebutt_filepath = sys.argv[1] # create SigningKey instance from file - signing_key_instance = SigningKey.from_ssb_file( - scuttlebutt_filepath - ) # type: SigningKey + signing_key_instance = SigningKey.from_ssb_file(scuttlebutt_filepath) # print pubkey print(f"Public key from scuttlebutt file: {signing_key_instance.pubkey}") diff --git a/examples/save_and_load_private_key_file.py b/examples/save_and_load_private_key_file.py index 096337a22c58b0ce6a1dd19d82226df45c149913..b40c77c2b27efb9b7e430e370d32784473e7203f 100644 --- a/examples/save_and_load_private_key_file.py +++ b/examples/save_and_load_private_key_file.py @@ -62,9 +62,7 @@ def save_and_load_private_key_file(): print(f"Private keys for public key {pubkey} saved in {PRIVATE_KEYS_FILE_PATH}") # load private keys from file - loaded_signer = SigningKey.from_private_key( - PRIVATE_KEYS_FILE_PATH - ) # type: SigningKey + loaded_signer = SigningKey.from_private_key(PRIVATE_KEYS_FILE_PATH) # check public key from file print( diff --git a/examples/save_and_load_private_key_file_ewif.py b/examples/save_and_load_private_key_file_ewif.py index ef52e78e0ba3b9cb49746bc0eab01f46218c2499..e25c9873bf8e9196d0437357725cb5cb816cd5ea 100644 --- a/examples/save_and_load_private_key_file_ewif.py +++ b/examples/save_and_load_private_key_file_ewif.py @@ -68,9 +68,7 @@ def save_and_load_private_key_file_ewif(): try: # load private keys from file - loaded_signer = SigningKey.from_ewif_file( - PRIVATE_KEY_FILE_PATH, ewif_password - ) # type: SigningKey + loaded_signer = SigningKey.from_ewif_file(PRIVATE_KEY_FILE_PATH, ewif_password) # check public key from file print( diff --git a/examples/save_and_load_private_key_file_wif.py b/examples/save_and_load_private_key_file_wif.py index a334e496bf0659fcc5c960a2d5e7933005fba4bd..ee7ef18403d77632452a59770d6ddaad53c24562 100644 --- a/examples/save_and_load_private_key_file_wif.py +++ b/examples/save_and_load_private_key_file_wif.py @@ -65,9 +65,7 @@ def save_and_load_private_key_file_wif(): try: # load private keys from file - loaded_signer = SigningKey.from_wif_file( - PRIVATE_KEY_FILE_PATH - ) # type: SigningKey + loaded_signer = SigningKey.from_wif_file(PRIVATE_KEY_FILE_PATH) # check public key from file print( diff --git a/examples/save_binary_signed_message.py b/examples/save_binary_signed_message.py index 6ad82a1cba6d5fbdd8320a155d004af5908c8b62..5f730cc441588ae13587ef9676dc1707444f445a 100644 --- a/examples/save_binary_signed_message.py +++ b/examples/save_binary_signed_message.py @@ -43,7 +43,7 @@ def save_binary_signed_message(): # Sign the message, the signed string is the message itself plus the # signature - signed_message = key.sign(bytes(message, "utf-8")) # type: bytes + signed_message = key.sign(bytes(message, "utf-8")) # To create a verifier pass in the verify key: veri = libnacl.sign.Verifier(key.hex_vk()) diff --git a/tests/key/test_verifying_key.py b/tests/key/test_verifying_key.py index 488715b5774a5ac7146ebfeeb3d18ac87d9f3e29..8dac30145f37f820aa82c5d3277f9b1c6676e57a 100644 --- a/tests/key/test_verifying_key.py +++ b/tests/key/test_verifying_key.py @@ -35,7 +35,7 @@ class TestVerifyingKey(unittest.TestCase): message = "Hello world with utf-8 chars like éàè !" # Sign the message, the signed string is the message itself plus the # signature - signed_message = sign_key.sign(bytes(message, "utf-8")) # type: bytes + signed_message = sign_key.sign(bytes(message, "utf-8")) # Verify the message! verifier = VerifyingKey(sign_key.pubkey)