Skip to content

Commit fe1c390

Browse files
committed
Improve the documentation of canio.Message & RemoteTransmissionRequest
1 parent a0971b7 commit fe1c390

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

adafruit_mcp2515/canio/__init__.py

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,26 @@ class Message:
1414
def __init__(self, id, data, extended=False):
1515
"""Create a `Message` to send
1616
17-
Args:
18-
id (int): The numeric ID of the message
19-
data (bytes): The content of the message
20-
extended (bool): True if the
21-
Raises:
22-
AttributeError: If `data` of type `bytes` is not provided for a non-RTR message
23-
AttributeError: If `data` is larger than 8 bytes
17+
:param int id: The numeric ID of the message
18+
:param bytes data: The content of the message, from 0 to 8 bytes of data
19+
:param bool extended: True if the message has an extended identifier,
20+
False if it has a standard identifier
2421
"""
2522

2623
self._data = None
2724
self.id = id
2825
self.data = data
2926
self.extended = extended
3027

28+
id: int
29+
"""The numeric ID of the message"""
30+
31+
extended: bool
32+
"""Indicates whether the the message has an extended identifier"""
33+
3134
@property
3235
def data(self):
33-
"""The content of the message, or dummy content in the case of an rtr"""
36+
"""The content of the message"""
3437
return self._data
3538

3639
@data.setter
@@ -56,16 +59,24 @@ def __init__(self, id: int, length: int, *, extended: bool = False):
5659
"""Construct a RemoteTransmissionRequest to send on a CAN bus
5760
5861
Args:
59-
id (int): The numeric ID of the requested message
60-
length (int): The length of the requested message
61-
extended (bool, optional): True if the message has an extended identifier, False if it\
62-
has a standard identifier. Defaults to False.
63-
62+
:param int id: The numeric ID of the message
63+
:param length int: The length of the requested message
64+
:param bool extended: True if the message has an extended identifier,
65+
False if it has a standard identifier
6466
"""
6567
self.id = id
6668
self.length = length
6769
self.extended = extended
6870

71+
id: int
72+
"""The numeric ID of the message"""
73+
74+
extended: bool
75+
"""Indicates whether the the message has an extended identifier"""
76+
77+
length: int
78+
"""The length of the requested message, from 0 to 8"""
79+
6980

7081
# Replace the above implementation with core canio implementation if it is available
7182
try:

0 commit comments

Comments
 (0)