From e5b7b236c6abf1b57ed33b54abf5d8a2bd76e6ad Mon Sep 17 00:00:00 2001 From: Moul <moul@moul.re> Date: Tue, 4 Jul 2023 20:27:35 +0200 Subject: [PATCH] Remove pylint exceptions (#458) Use SigningKeyException now defined in DuniterPy Even thought Ruff is not reporting this pylint report --- silkaj/auth.py | 9 +++------ silkaj/money/history.py | 1 - silkaj/tools.py | 1 - silkaj/wot/certification.py | 1 - tests/patched/money.py | 1 - tests/unit/money/test_transfer.py | 1 - tests/unit/wot/test_tools.py | 1 - 7 files changed, 3 insertions(+), 12 deletions(-) diff --git a/silkaj/auth.py b/silkaj/auth.py index d69a9c7f..7b119560 100644 --- a/silkaj/auth.py +++ b/silkaj/auth.py @@ -18,8 +18,8 @@ import sys from pathlib import Path import rich_click as click -from duniterpy.key import SigningKey from duniterpy.key.scrypt_params import ScryptParams +from duniterpy.key.signing_key import SigningKey, SigningKeyException from silkaj.constants import FAILURE_EXIT_STATUS, PUBKEY_PATTERN from silkaj.public_key import gen_pubkey_checksum @@ -97,8 +97,7 @@ def auth_by_seed() -> SigningKey: try: return SigningKey.from_seedhex(seedhex) # To be fixed upstream in DuniterPy - # pylint: disable=broad-except - except Exception as error: + except SigningKeyException as error: print(error) sys.exit(FAILURE_EXIT_STATUS) @@ -120,7 +119,6 @@ def auth_by_scrypt(ctx: click.Context) -> SigningKey: n, r, p = ctx.obj["AUTH_SCRYPT_PARAMS"].split(",") if n.isnumeric() and r.isnumeric() and p.isnumeric(): - # pylint: disable=too-many-boolean-expressions n, r, p = int(n), int(r), int(p) if n <= 0 or n > 65536 or r <= 0 or r > 512 or p <= 0 or p > 32: sys.exit("Error: the values of Scrypt parameters are not good") @@ -149,7 +147,6 @@ def auth_by_wif() -> SigningKey: try: return SigningKey.from_wif_or_ewif_hex(wif_hex, password) # To be fixed upstream in DuniterPy - # pylint: disable=broad-except - except Exception as error: + except SigningKeyException as error: print(error) sys.exit(FAILURE_EXIT_STATUS) diff --git a/silkaj/money/history.py b/silkaj/money/history.py index 4fa0b1db..5854020c 100644 --- a/silkaj/money/history.py +++ b/silkaj/money/history.py @@ -202,7 +202,6 @@ def parse_sent_tx( uids: bool, full_pubkey: bool, ) -> None: - # pylint: disable=too-many-locals """ Extract recipients` pubkeys from outputs Get identities from pubkeys diff --git a/silkaj/tools.py b/silkaj/tools.py index 3a3bb8bf..a80e5a41 100644 --- a/silkaj/tools.py +++ b/silkaj/tools.py @@ -36,7 +36,6 @@ def message_exit(message: str) -> None: sys.exit(FAILURE_EXIT_STATUS) -# pylint: disable=too-few-public-methods class MutuallyExclusiveOption(click.Option): def __init__(self, *args: Any, **kwargs: Any) -> None: self.mutually_exclusive = set(kwargs.pop("mutually_exclusive", [])) diff --git a/silkaj/wot/certification.py b/silkaj/wot/certification.py index f195c38e..0cc4702a 100644 --- a/silkaj/wot/certification.py +++ b/silkaj/wot/certification.py @@ -43,7 +43,6 @@ def certify(ctx: click.Context, uid_pubkey_to_certify: str) -> None: if checked_pubkey: uid_pubkey_to_certify = str(checked_pubkey) - # pylint: disable=unused-variable idty_to_certify, pubkey_to_certify, send_certs = wot_tools.choose_identity( uid_pubkey_to_certify, ) diff --git a/tests/patched/money.py b/tests/patched/money.py index 0c2b4998..b5624d29 100644 --- a/tests/patched/money.py +++ b/tests/patched/money.py @@ -144,5 +144,4 @@ def patched_get_sources(pubkey): class Counter: - # pylint: disable=too-few-public-methods counter = 0 diff --git a/tests/unit/money/test_transfer.py b/tests/unit/money/test_transfer.py index a8f09d6b..321cd7bd 100644 --- a/tests/unit/money/test_transfer.py +++ b/tests/unit/money/test_transfer.py @@ -1009,7 +1009,6 @@ def test_handle_intermediaries_transactions( ), ], ) -# pylint: disable=too-many-locals def test_send_transaction( amounts, amountsud, diff --git a/tests/unit/wot/test_tools.py b/tests/unit/wot/test_tools.py index 8331a2e9..111c42e4 100644 --- a/tests/unit/wot/test_tools.py +++ b/tests/unit/wot/test_tools.py @@ -151,7 +151,6 @@ def test_choose_identity( ): monkeypatch.setattr(w_tools, "wot_lookup", patched_lookup) monkeypatch.setattr(click, "prompt", patched_prompt) - # pylint: disable=unused-variable idty_card, get_pubkey, signed = w_tools.choose_identity(pubkey) expected_pubkey = pubkey.split(":")[0] assert expected_pubkey == get_pubkey -- GitLab