Skip to content

Commit aa23267

Browse files
Update module docstrings and regenerate api.md
Co-Authored-By: abucknall@blues.com <abucknall@blues.com>
1 parent 27c4e39 commit aa23267

8 files changed

Lines changed: 605 additions & 231 deletions

File tree

docs/api.md

Lines changed: 549 additions & 221 deletions
Large diffs are not rendered by default.

notecard/binary_helpers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
"""Helper methods for doing binary transfers to/from a Notecard."""
1+
"""Helper methods for performing binary transfers to and from a Notecard.
2+
3+
This module provides functions for working with the Notecard's binary data store,
4+
including reading, writing, and managing binary data with CRC verification.
5+
"""
26

37
import sys
48
from notecard.cobs import cobs_encode, cobs_decode

notecard/cobs.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
"""Methods for COBS encoding and decoding arbitrary bytearrays."""
1+
"""Functions for COBS encoding and decoding of bytearrays.
2+
3+
This module implements Consistent Overhead Byte Stuffing (COBS), an encoding
4+
that eliminates zero bytes from arbitrary binary data. The Notecard uses this
5+
for binary data transfers to ensure reliable transmission.
6+
"""
27

38

49
def cobs_encode(data: bytearray, eop: int) -> bytearray:

notecard/crc32.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
"""Module for computing the CRC32 of arbitrary data."""
1+
"""Functions for computing CRC32 checksums.
2+
3+
This module provides a lightweight implementation of the CRC32 algorithm
4+
for verifying data integrity in Notecard communications.
5+
"""
26

37
crc32_lookup_table = [
48
0x00000000, 0x1DB71064, 0x3B6E20C8, 0x26D930AC, 0x76DC4190, 0x6B6B51F4,

notecard/md5.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
"""Module for computing MD5 hash for MicroPython and CircuitPython."""
1+
"""Functions for computing MD5 hashes.
2+
3+
This module provides a lightweight implementation of the MD5 algorithm
4+
for MicroPython and CircuitPython platforms, used for data verification
5+
in Notecard binary transfers.
6+
"""
27

38
"""
49
Copyright [2018] [Mauro Riva <lemariva@mail.com> <lemariva.com>]

notecard/notecard.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,21 +402,40 @@ def Command(self, req):
402402
self.Transaction(req)
403403

404404
def GetUserAgent(self):
405-
"""Return the User Agent String for the host for debug purposes."""
405+
"""Return the User Agent String for the host for debug purposes.
406+
407+
Returns:
408+
dict: A dictionary containing user agent information including OS details
409+
and any application-specific user agent information.
410+
"""
406411
ua_copy = self._user_agent.copy()
407412
ua_copy.update(self._user_agent_app or {})
408413
return ua_copy
409414

410415
def SetAppUserAgent(self, app_user_agent):
411-
"""Set the User Agent info for the app."""
416+
"""Set the User Agent info for the app.
417+
418+
Args:
419+
app_user_agent (dict): Dictionary containing application-specific
420+
user agent information.
421+
"""
412422
self._user_agent_app = app_user_agent
413423

414424
def UserAgentSent(self):
415-
"""Return true if the User Agent has been sent to the Notecard."""
425+
"""Return true if the User Agent has been sent to the Notecard.
426+
427+
Returns:
428+
bool: True if the User Agent has been sent to the Notecard, False otherwise.
429+
"""
416430
return self._user_agent_sent
417431

418432
def SetTransactionPins(self, rtx_pin, ctx_pin):
419-
"""Set the pins used for RTX and CTX."""
433+
"""Set the pins used for RTX and CTX.
434+
435+
Args:
436+
rtx_pin: The pin to use for Ready To Transact (RTX) signaling.
437+
ctx_pin: The pin to use for Clear To Transact (CTX) signaling.
438+
"""
420439
self._transaction_manager = TransactionManager(rtx_pin, ctx_pin)
421440

422441

notecard/timeout.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
"""Module for managing timeouts in note-python."""
1+
"""Functions for managing timeouts.
2+
3+
This module provides cross-platform timeout management for Notecard communications,
4+
supporting different timing mechanisms for CPython, MicroPython, and CircuitPython.
5+
"""
26

37
import sys
48
import time

notecard/transaction_manager.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
"""TransactionManager-related code for note-python."""
1+
"""Classes for managing Notecard transactions.
2+
3+
This module provides transaction management for Notecard communications,
4+
implementing the RTX/CTX protocol for reliable data exchange between
5+
the host and Notecard.
6+
"""
27

38
import sys
49
import time

0 commit comments

Comments
 (0)