What changed, and why it matters
This commit is a routine code-style fix. It updates the Python formatter (black) configuration so the linter uses the correct pyproject.toml file, and reformats two Python files to match the new style rules. There are no security changes to the firmware or any sensitive logic.
No security action needed; this is a normal linting/formatting maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit adjusts .ci/check-pep8 to pass –config py/pyproject.toml to the Python formatter and to exclude the external/ directory from formatting. It also applies black formatting changes to releases/describe_signed_firmware.py and scripts/graphics/convert.py, which are purely cosmetic (line wrapping, lowercase hex byte literal). No functional code, cryptographic operations, or security boundaries were modified.
Changed components
.ci/check-pep8releases/describe_signed_firmware.pyscripts/graphics/convert.pyInspect captured patch +6 / −12
diff --git a/.ci/check-pep8 b/.ci/check-pep8
index 774d4e8..a9c0ac9 100755
--- a/.ci/check-pep8
+++ b/.ci/check-pep8
@@ -11,12 +11,12 @@ set -o pipefail
command -v git >/dev/null 2>&1 || { echo >&2 "git is missing"; exit 1; }
# grep will exit with 1 if no lines are found
-FILES=$(git --no-pager diff --diff-filter=d --name-only ${TARGET_BRANCH} HEAD | grep -v -e "old/" -e "generated/" -e "rust/vendor/" | grep -E ".py\$" || exit 0)
+FILES=$(git --no-pager diff --diff-filter=d --name-only ${TARGET_BRANCH} HEAD | grep -v -e "old/" -e "generated/" -e "rust/vendor/" -e "external/" | grep -E ".py\$" || exit 0)
if [ -z "${FILES}" ] ; then
exit 0
fi
-./scripts/format-python --check --fast ${FILES}
+./scripts/format-python --config py/pyproject.toml --check --fast ${FILES}
# We lint all default Python files, as linting only a subset can lead to errors (e.g. if
# send_message.py only is linted without the bitbox02 dep).
./scripts/lint-python
diff --git a/releases/describe_signed_firmware.py b/releases/describe_signed_firmware.py
index 6a9eb03..c65b216 100755
--- a/releases/describe_signed_firmware.py
+++ b/releases/describe_signed_firmware.py
@@ -74,18 +74,14 @@ def main() -> int:
"the signatures are not being verified."
)
- firmware_padded = firmware + b"\xFF" * (MAX_FIRMWARE_SIZE - len(firmware))
+ firmware_padded = firmware + b"\xff" * (MAX_FIRMWARE_SIZE - len(firmware))
- print(
- "The hash of the unsigned firmware binary is (compare with reproducible build):"
- )
+ print("The hash of the unsigned firmware binary is (compare with reproducible build):")
print(hashlib.sha256(firmware).hexdigest())
version = sigdata[SIGNING_PUBKEYS_DATA_LEN:][:VERSION_LEN]
print("The monotonic firmware version is:", struct.unpack("<I", version)[0])
print("The hash of the firmware as verified/shown by the bootloader is:")
- print(
- hashlib.sha256(hashlib.sha256(version + firmware_padded).digest()).hexdigest()
- )
+ print(hashlib.sha256(hashlib.sha256(version + firmware_padded).digest()).hexdigest())
return 0
diff --git a/scripts/graphics/convert.py b/scripts/graphics/convert.py
index 75630b2..bf70c0c 100755
--- a/scripts/graphics/convert.py
+++ b/scripts/graphics/convert.py
@@ -33,9 +33,7 @@ def main():
"""Main function"""
parser = argparse.ArgumentParser()
parser.add_argument("pbmfile")
- parser.add_argument(
- "--name", help="Name to give to the resulting variable", nargs="?"
- )
+ parser.add_argument("--name", help="Name to give to the resulting variable", nargs="?")
args = parser.parse_args()
with open(args.pbmfile) as file:
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.