diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0c3fd7d4..de20d177 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -97,8 +97,8 @@ repos: hooks: - id: bandit name: bandit (tests) - # disable B101 (Test for use of assert) on tests folder - args: ["-s", "B101"] + # disable B101 (Test for use of assert) for the tests folder + args: ["--skip", "B101"] exclude: btclib - repo: https://github.com/pycqa/pylint rev: v2.15.9 diff --git a/btclib/script/sig_hash.py b/btclib/script/sig_hash.py index ac9528a0..22b405d4 100644 --- a/btclib/script/sig_hash.py +++ b/btclib/script/sig_hash.py @@ -60,12 +60,11 @@ def assert_valid_hash_type(hash_type: int) -> None: def legacy_script(script_pub_key: Octets) -> list[bytes]: script_s: list[bytes] = [] current_script: list[Command] = [] - for token in parse(script_pub_key)[::-1]: - # B105 required for py<38 - if token == "OP_CODESEPARATOR": # nosec B105 + for cmd in parse(script_pub_key)[::-1]: + if cmd == "OP_CODESEPARATOR": script_s.append(serialize(current_script[::-1])) else: - current_script.append(token) + current_script.append(cmd) script_s.append(serialize(current_script[::-1])) return script_s[::-1] @@ -82,11 +81,10 @@ def witness_v0_script(script_pub_key: Octets) -> list[bytes]: script_s: list[bytes] = [] current_script: list[Command] = [] - for token in parse(script_pub_key)[::-1]: - # B105 required for py<38 - if token == "OP_CODESEPARATOR": # nosec B105 + for cmd in parse(script_pub_key)[::-1]: + if cmd == "OP_CODESEPARATOR": script_s.append(serialize(current_script[::-1])) - current_script.append(token) + current_script.append(cmd) script_s.append(serialize(current_script[::-1])) return script_s[::-1] diff --git a/tests/ec/test_curve.py b/tests/ec/test_curve.py index 256914c0..e5d477b3 100644 --- a/tests/ec/test_curve.py +++ b/tests/ec/test_curve.py @@ -193,7 +193,7 @@ def test_ec_repr() -> None: ec_repr = repr(ec) if ec in low_card_curves.values() or ec.p_size < 24: ec_repr = f"{ec_repr[:-1]}, False)" - ec2 = eval(ec_repr) # pylint: disable=eval-used # nosec B307 + ec2 = eval(ec_repr) # pylint: disable=eval-used # nosec eval assert str(ec) == str(ec2)