From aee6d35584e82255d2fec2582d8ae997ba8c3213 Mon Sep 17 00:00:00 2001 From: Moul <moul@moul.re> Date: Wed, 22 Feb 2023 19:54:10 +0100 Subject: [PATCH] pre-commit autoupgrade Isort got broken Apply new black changes Fix Pylint report Mypy v1.0 --- .pre-commit-config.yaml | 12 ++++++------ silkaj/auth.py | 2 +- silkaj/money/balance.py | 1 - silkaj/money/transfer.py | 1 - silkaj/wot/revocation.py | 1 - tests/unit/wot/test_idty_tools.py | 1 - tests/unit/wot/test_revocation.py | 2 +- 7 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 28ce85f0..b1a63421 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: - id: mixed-line-ending - id: trailing-whitespace - repo: https://github.com/PyCQA/autoflake - rev: v2.0.0 + rev: v2.0.1 hooks: - id: autoflake args: @@ -22,20 +22,20 @@ repos: - --remove-unused-variables - --in-place - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.11.4 + rev: 5.12.0 hooks: - id: isort args: ["--profile", "black"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.991 + rev: v1.0.1 hooks: - id: mypy - repo: https://github.com/PyCQA/pylint - rev: v2.15.10 + rev: v2.16.2 hooks: - id: pylint - repo: https://github.com/asottile/pyupgrade @@ -51,7 +51,7 @@ repos: - "--server" - "https://git.duniter.org" - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.3.1 + rev: v1.4.2 hooks: - id: insert-license files: \.py$ diff --git a/silkaj/auth.py b/silkaj/auth.py index d8d154cd..e2108ae8 100644 --- a/silkaj/auth.py +++ b/silkaj/auth.py @@ -80,7 +80,7 @@ def auth_by_auth_file(ctx: Context) -> SigningKey: authfile = Path(file) if not authfile.is_file(): sys.exit(f"Error: `{file}` file does not exist") - filetxt = authfile.open("r", encoding="utf-8").read() + filetxt = authfile.read_text(encoding="utf-8") # two regural expressions for the PubSec format regex_pubkey = re.compile(PUBSEC_PUBKEY_PATTERN, re.MULTILINE) diff --git a/silkaj/money/balance.py b/silkaj/money/balance.py index dd9ae175..af5f2eff 100644 --- a/silkaj/money/balance.py +++ b/silkaj/money/balance.py @@ -32,7 +32,6 @@ from silkaj.wot import tools as wt @pass_context def balance_cmd(ctx: Context, pubkeys: str) -> None: if not has_auth_method(): - # check input pubkeys if not pubkeys: sys.exit("You should specify one or many pubkeys") diff --git a/silkaj/money/transfer.py b/silkaj/money/transfer.py index f457d623..1ef7a5e6 100644 --- a/silkaj/money/transfer.py +++ b/silkaj/money/transfer.py @@ -502,7 +502,6 @@ def generate_transaction_document( Comment: str = "", OutputbackChange: Optional[str] = None, ) -> Transaction: - listinput = listinput_and_amount[0] totalAmountInput = listinput_and_amount[1] total_tx_amount = sum(tx_amounts) diff --git a/silkaj/wot/revocation.py b/silkaj/wot/revocation.py index 0a50dc4f..f6bfcab5 100644 --- a/silkaj/wot/revocation.py +++ b/silkaj/wot/revocation.py @@ -134,7 +134,6 @@ Optionnaly takes the document filename.", ) @click.pass_context def publish(ctx: click.Context, file: str) -> None: - warn_before_dry_run_or_display(ctx) rev_doc = verify_document(file) diff --git a/tests/unit/wot/test_idty_tools.py b/tests/unit/wot/test_idty_tools.py index 79622a83..932cdd3a 100644 --- a/tests/unit/wot/test_idty_tools.py +++ b/tests/unit/wot/test_idty_tools.py @@ -371,7 +371,6 @@ uid: {idty1.uid}\npubkey: {gen_pubkey_checksum(idty1.pubkey)}" def test_check_many_identities( idty, lookup_pk, lookup_uid, expected, expect_bool, monkeypatch, capsys ): - # Patch BMA lookup so it returns different lookups if we request a pk or a uid def patched_bma_lookup(whatever_node, lookup): # raise errors if no matching identity diff --git a/tests/unit/wot/test_revocation.py b/tests/unit/wot/test_revocation.py index 67ba8078..23978199 100644 --- a/tests/unit/wot/test_revocation.py +++ b/tests/unit/wot/test_revocation.py @@ -138,6 +138,7 @@ def patched_send_bma_revoke_error(wot_useless, rev_doc_useless): # tests + # test cli dry-run @pytest.mark.parametrize( "subcommand, expected_warn", @@ -890,7 +891,6 @@ def test_revocation_cli_revoke( ], ) def test_revocation_cli_revoke_errors(display, user_input, doc, expected, monkeypatch): - monkeypatch.setattr(auth, "auth_method", patched_auth_method_Claude) monkeypatch.setattr(bc_tools, "get_head_block", patched_get_head_block_gtest) monkeypatch.setattr(w_tools, "choose_identity", patched_choose_identity) -- GitLab