diff --git a/py/bitbox02/bitbox02/bitbox02/bitbox02.py b/py/bitbox02/bitbox02/bitbox02/bitbox02.py index f7ceaf2bd..af5b3ec25 100644 --- a/py/bitbox02/bitbox02/bitbox02/bitbox02.py +++ b/py/bitbox02/bitbox02/bitbox02/bitbox02.py @@ -45,7 +45,7 @@ from bitbox02.communication.generated import antiklepto_pb2 as antiklepto import google.protobuf.empty_pb2 - # pylint: disable=unused-import + # pylint: disable=unused-import,ungrouped-imports # We export it in __init__.py from bitbox02.communication.generated import system_pb2 as system except ModuleNotFoundError: @@ -116,6 +116,9 @@ class BTCInputType(TypedDict): class BTCOutputInternal: # TODO: Use NamedTuple, but not playing well with protobuf types. + """ + Internal transaction output (output belongs to BitBox). + """ def __init__( self, @@ -135,6 +138,9 @@ def __init__( class BTCOutputExternal: # TODO: Use NamedTuple, but not playing well with protobuf types. + """ + External transaction output. + """ def __init__(self, output_type: "btc.BTCOutputType.V", output_payload: bytes, value: int): self.type = output_type @@ -807,6 +813,8 @@ def eth_sign( """ transaction should be given as a full rlp encoded eth transaction. """ + # pylint: disable=no-member + is_eip1559 = transaction.startswith(b"\x02") def handle_antiklepto(request: eth.ETHRequest) -> bytes: diff --git a/py/bitbox02/setup.py b/py/bitbox02/setup.py index bb97fbc6d..605202e40 100644 --- a/py/bitbox02/setup.py +++ b/py/bitbox02/setup.py @@ -14,7 +14,6 @@ """BitBox python package""" import os.path import re -from distutils.core import setup import setuptools @@ -33,7 +32,7 @@ def find_version() -> str: raise RuntimeError("Version string not found") -setup( +setuptools.setup( name="bitbox02", version=find_version(), author="Shift Crypto", diff --git a/py/send_message.py b/py/send_message.py index 46af8b3bb..a998d6501 100755 --- a/py/send_message.py +++ b/py/send_message.py @@ -197,7 +197,7 @@ def _setup_workflow(self) -> None: else: try: entropy_size = int(entropy_size_inp) - except: + except ValueError: eprint("Failed") return @@ -1531,7 +1531,7 @@ def _get_versions(self) -> None: def _get_hardware(self) -> None: secure_chip = self._device.hardware()["secure_chip_model"] - print(f"Hardware variant:") + print("Hardware variant:") print(f"- Secure Chip: {secure_chip.value}") def _erase(self) -> None: diff --git a/scripts/lint-python b/scripts/lint-python index f9bc4e03d..718afb56a 100755 --- a/scripts/lint-python +++ b/scripts/lint-python @@ -39,26 +39,26 @@ ${PYLINT} --persistent=no "${ARGS[@]}" || { # 32 usage error pylint_status=$? exitcode=0 - if (( ${pylint_status} \& 1 )); then - echo fatal messsage >&2 + if (( ${pylint_status} & 1 )); then + echo fatal message >&2 exitcode=2 fi - if (( ${pylint_status} \& 2 )); then - echo error messsage >&2 + if (( ${pylint_status} & 2 )); then + echo error message >&2 exitcode=2 fi - if (( ${pylint_status} \& 4 )); then - echo warning messsage >&2 + if (( ${pylint_status} & 4 )); then + echo warning message >&2 exitcode=2 fi - if (( ${pylint_status} \& 8 )); then - echo refactor messsage >&2 + if (( ${pylint_status} & 8 )); then + echo refactor message >&2 fi - if (( ${pylint_status} \& 16 )); then - echo convention messsage >&2 + if (( ${pylint_status} & 16 )); then + echo convention message >&2 fi # This should not happen! - if (( ${pylint_status} \& 32 )); then + if (( ${pylint_status} & 32 )); then echo usage error >&2 exitcode=2 fi