Skip to content

Commit d1d776e

Browse files
committed
Merge remote-tracking branch 'benma/pylint'
2 parents 90a72cc + ce5fa55 commit d1d776e

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed

py/bitbox02/bitbox02/bitbox02/bitbox02.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
from bitbox02.communication.generated import antiklepto_pb2 as antiklepto
4646
import google.protobuf.empty_pb2
4747

48-
# pylint: disable=unused-import
48+
# pylint: disable=unused-import,ungrouped-imports
4949
# We export it in __init__.py
5050
from bitbox02.communication.generated import system_pb2 as system
5151
except ModuleNotFoundError:
@@ -116,6 +116,9 @@ class BTCInputType(TypedDict):
116116

117117
class BTCOutputInternal:
118118
# TODO: Use NamedTuple, but not playing well with protobuf types.
119+
"""
120+
Internal transaction output (output belongs to BitBox).
121+
"""
119122

120123
def __init__(
121124
self,
@@ -135,6 +138,9 @@ def __init__(
135138

136139
class BTCOutputExternal:
137140
# TODO: Use NamedTuple, but not playing well with protobuf types.
141+
"""
142+
External transaction output.
143+
"""
138144

139145
def __init__(self, output_type: "btc.BTCOutputType.V", output_payload: bytes, value: int):
140146
self.type = output_type
@@ -807,6 +813,8 @@ def eth_sign(
807813
"""
808814
transaction should be given as a full rlp encoded eth transaction.
809815
"""
816+
# pylint: disable=no-member
817+
810818
is_eip1559 = transaction.startswith(b"\x02")
811819

812820
def handle_antiklepto(request: eth.ETHRequest) -> bytes:

py/bitbox02/setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"""BitBox python package"""
1515
import os.path
1616
import re
17-
from distutils.core import setup
1817
import setuptools
1918

2019

@@ -33,7 +32,7 @@ def find_version() -> str:
3332
raise RuntimeError("Version string not found")
3433

3534

36-
setup(
35+
setuptools.setup(
3736
name="bitbox02",
3837
version=find_version(),
3938
author="Shift Crypto",

py/send_message.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def _setup_workflow(self) -> None:
197197
else:
198198
try:
199199
entropy_size = int(entropy_size_inp)
200-
except:
200+
except ValueError:
201201
eprint("Failed")
202202
return
203203

@@ -1531,7 +1531,7 @@ def _get_versions(self) -> None:
15311531

15321532
def _get_hardware(self) -> None:
15331533
secure_chip = self._device.hardware()["secure_chip_model"]
1534-
print(f"Hardware variant:")
1534+
print("Hardware variant:")
15351535
print(f"- Secure Chip: {secure_chip.value}")
15361536

15371537
def _erase(self) -> None:

scripts/lint-python

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,26 @@ ${PYLINT} --persistent=no "${ARGS[@]}" || {
3939
# 32 usage error
4040
pylint_status=$?
4141
exitcode=0
42-
if (( ${pylint_status} \& 1 )); then
43-
echo fatal messsage >&2
42+
if (( ${pylint_status} & 1 )); then
43+
echo fatal message >&2
4444
exitcode=2
4545
fi
46-
if (( ${pylint_status} \& 2 )); then
47-
echo error messsage >&2
46+
if (( ${pylint_status} & 2 )); then
47+
echo error message >&2
4848
exitcode=2
4949
fi
50-
if (( ${pylint_status} \& 4 )); then
51-
echo warning messsage >&2
50+
if (( ${pylint_status} & 4 )); then
51+
echo warning message >&2
5252
exitcode=2
5353
fi
54-
if (( ${pylint_status} \& 8 )); then
55-
echo refactor messsage >&2
54+
if (( ${pylint_status} & 8 )); then
55+
echo refactor message >&2
5656
fi
57-
if (( ${pylint_status} \& 16 )); then
58-
echo convention messsage >&2
57+
if (( ${pylint_status} & 16 )); then
58+
echo convention message >&2
5959
fi
6060
# This should not happen!
61-
if (( ${pylint_status} \& 32 )); then
61+
if (( ${pylint_status} & 32 )); then
6262
echo usage error >&2
6363
exitcode=2
6464
fi

0 commit comments

Comments
 (0)