From 3c18024d2bb701b3f8285ef6aad616352969d92e Mon Sep 17 00:00:00 2001 From: Moul <moul@moul.re> Date: Wed, 12 Oct 2022 22:24:08 +0200 Subject: [PATCH] Bump pre-commit hooks Fix mypy and pylint new reports --- .pre-commit-config.yaml | 10 +++++----- duniterpy/key/ascii_armor.py | 6 +++--- duniterpy/key/signing_key.py | 18 ++++++++++-------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3370466..5bb976d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ exclude: ^docs/ repos: - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 22.10.0 hooks: - id: black - repo: https://github.com/PyCQA/isort @@ -10,23 +10,23 @@ repos: - id: isort args: ["--profile", "black"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.950 + rev: v0.982 hooks: - id: mypy args: - "--install-types" - "--non-interactive" - repo: https://github.com/PyCQA/pylint - rev: v2.13.8 + rev: v2.15.4 hooks: - id: pylint - repo: https://github.com/asottile/pyupgrade - rev: v2.32.1 + rev: v3.1.0 hooks: - id: pyupgrade args: [--py37-plus] - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.1.13 + rev: v1.3.1 hooks: - id: insert-license files: \.py$ diff --git a/duniterpy/key/ascii_armor.py b/duniterpy/key/ascii_armor.py index 882f23f..8d30c66 100644 --- a/duniterpy/key/ascii_armor.py +++ b/duniterpy/key/ascii_armor.py @@ -65,14 +65,14 @@ class ParserMissingPublicKeysException(Exception): # Exception messages listed here PARSER_MISSING_SIGNING_KEY_EXCEPTION = ParserMissingSigningKeyException( - "The message is encrypted but no SigningKey " "instance is provided" + "The message is encrypted but no SigningKey instance is provided" ) PARSER_MISSING_PUBLIC_KEYS_EXCEPTION = ParserMissingPublicKeysException( - "At least one signature but no public keys " "are provided" + "At least one signature but no public keys are provided" ) MISSING_PUBLIC_KEY_AND_SIGNING_KEY_EXCEPTION = MissingPublickeyAndSigningKeyException( - "Ascii Armor Message needs a " "public key or a SigningKey but " "none are provided" + "Ascii Armor Message needs a public key or a SigningKey but none are provided" ) diff --git a/duniterpy/key/signing_key.py b/duniterpy/key/signing_key.py index 3593709..91a1948 100644 --- a/duniterpy/key/signing_key.py +++ b/duniterpy/key/signing_key.py @@ -77,7 +77,9 @@ class SigningKey(libnacl.sign.Signer): @classmethod def from_credentials_file( - cls, path: str, scrypt_params: Optional[ScryptParams] = None + cls: Type[SigningKeyType], + path: str, + scrypt_params: Optional[ScryptParams] = None, ) -> SigningKeyType: """ Create a SigningKey object from a credentials file @@ -108,7 +110,7 @@ class SigningKey(libnacl.sign.Signer): fh.write(seedhex) @staticmethod - def from_seedhex_file(path: str) -> SigningKeyType: + def from_seedhex_file(path: str) -> Type[SigningKeyType]: """ Return SigningKey instance from Seedhex file @@ -142,7 +144,7 @@ class SigningKey(libnacl.sign.Signer): self.save(path) @staticmethod - def from_private_key(path: str) -> SigningKeyType: + def from_private_key(path: str) -> Type[SigningKeyType]: """ Read authentication file Add public key attribute @@ -222,7 +224,7 @@ sec: {base58_signing_key}" @staticmethod def from_wif_or_ewif_file( path: str, password: Optional[str] = None - ) -> SigningKeyType: + ) -> Type[SigningKeyType]: """ Return SigningKey instance from Duniter WIF or EWIF file @@ -245,7 +247,7 @@ sec: {base58_signing_key}" @staticmethod def from_wif_or_ewif_hex( wif_hex: str, password: Optional[str] = None - ) -> SigningKeyType: + ) -> Type[SigningKeyType]: """ Return SigningKey instance from Duniter WIF or EWIF in hexadecimal format @@ -266,7 +268,7 @@ sec: {base58_signing_key}" return result @staticmethod - def from_wif_file(path: str) -> SigningKeyType: + def from_wif_file(path: str) -> Type[SigningKeyType]: """ Return SigningKey instance from Duniter WIF file @@ -340,7 +342,7 @@ Data: {wif_key}" fh.write(content) @staticmethod - def from_ewif_file(path: str, password: str) -> SigningKeyType: + def from_ewif_file(path: str, password: str) -> Type[SigningKeyType]: """ Return SigningKey instance from Duniter EWIF file @@ -498,7 +500,7 @@ Data: {ewif_key}" @classmethod def from_dubp_mnemonic( - cls, mnemonic: str, scrypt_params: ScryptParams = None + cls: Type[SigningKeyType], mnemonic: str, scrypt_params: ScryptParams = None ) -> SigningKeyType: """ Generate key pair instance from a DUBP mnemonic passphrase -- GitLab