Skip to content

Commit 2a52868

Browse files
Prefix internal components with _
Some of our code, namely the nrf52_upload module, is only intended for use within the SDK but not part of the public API. This patch adds an underscore to those components to indicate the visibility.
1 parent 274cec5 commit 2a52868

33 files changed

+14
-15
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
# E501 (line length) disabled as this is handled by black which takes better care of edge cases
55
extend-ignore = E203,E501,E701
66
max-complexity = 18
7-
extend-exclude = src/nitrokey/trussed/bootloader/nrf52_upload
7+
extend-exclude = src/nitrokey/trussed/bootloader/_nrf52_upload

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ strict = true
5555

5656
# nrf52_upload is only temporary in this package
5757
[[tool.mypy.overrides]]
58-
module = "nitrokey.trussed.bootloader.nrf52_upload.*"
58+
module = "nitrokey.trussed.bootloader._nrf52_upload.*"
5959
ignore_errors = true
6060

6161
# nrf52 has to use the untyped nrf52_upload module

src/nitrokey/nk3/secrets_app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def _send_receive(
348348
) -> bytes:
349349
encoded_structure = self._custom_encode(structure)
350350
ins_b, p1, p2 = self._encode_command(ins)
351-
bytes_data = iso7816_compose(ins_b, p1, p2, data=encoded_structure)
351+
bytes_data = _iso7816_compose(ins_b, p1, p2, data=encoded_structure)
352352
if self.write_corpus_fn:
353353
self.write_corpus_fn(ins, bytes_data)
354354
return self._send_receive_inner(bytes_data, log_info=f"{ins}")
@@ -373,7 +373,7 @@ def _send_receive_inner(self, data: bytes, log_info: str = "") -> bytes:
373373
self.logfn(f"Got RemainingData status: [{status_bytes.hex()}]")
374374
log_multipacket = True
375375
ins_b, p1, p2 = self._encode_command(Instruction.SendRemaining)
376-
bytes_data = iso7816_compose(ins_b, p1, p2)
376+
bytes_data = _iso7816_compose(ins_b, p1, p2)
377377
try:
378378
result = self.dev._call_app(App.SECRETS, data=bytes_data)
379379
except Exception as e:
@@ -863,7 +863,7 @@ def _semver_equal_or_newer(self, required_version: str) -> bool:
863863
return current >= semver_req_version
864864

865865

866-
def iso7816_compose(
866+
def _iso7816_compose(
867867
ins: int,
868868
p1: int,
869869
p2: int,

src/nitrokey/nk3/updates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from spsdk.mboot.exceptions import McuBootConnectionError
1818

19-
from nitrokey.helpers import Retries
19+
from nitrokey._helpers import Retries
2020
from nitrokey.nk3 import NK3_DATA
2121
from nitrokey.nk3.bootloader import Nitrokey3Bootloader
2222
from nitrokey.nk3.device import Nitrokey3Device

src/nitrokey/trussed/bootloader/nrf52_upload/README.md renamed to src/nitrokey/trussed/bootloader/_nrf52_upload/README.md

File renamed without changes.

src/nitrokey/trussed/bootloader/nrf52_upload/__init__.py renamed to src/nitrokey/trussed/bootloader/_nrf52_upload/__init__.py

File renamed without changes.

src/nitrokey/trussed/bootloader/nrf52_upload/dfu/__init__.py renamed to src/nitrokey/trussed/bootloader/_nrf52_upload/dfu/__init__.py

File renamed without changes.

src/nitrokey/trussed/bootloader/nrf52_upload/dfu/crc16.py renamed to src/nitrokey/trussed/bootloader/_nrf52_upload/dfu/crc16.py

File renamed without changes.

src/nitrokey/trussed/bootloader/nrf52_upload/dfu/dfu_cc_pb2.py renamed to src/nitrokey/trussed/bootloader/_nrf52_upload/dfu/dfu_cc_pb2.py

File renamed without changes.

0 commit comments

Comments
 (0)