File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 2
2
This module contains the implementation of :class:`can.Message`.
3
3
4
4
.. note::
5
- Could use `@dataclass <https://docs.python.org/3.7 /library/dataclasses.html>`__
6
- starting with Python 3.7 .
5
+ Could use `@dataclass(slots=True, weakref_slot=True) <https://docs.python.org/3.11 /library/dataclasses.html>`__
6
+ starting with Python 3.11 .
7
7
"""
8
8
9
9
from copy import deepcopy
10
+ from dataclasses import dataclass
10
11
from math import isinf , isnan
11
12
from typing import Optional
12
13
13
14
from . import typechecking
14
15
15
16
17
+ @dataclass
16
18
class Message : # pylint: disable=too-many-instance-attributes; OK for a dataclass
17
19
"""
18
20
The :class:`~can.Message` object is used to represent CAN messages for
@@ -47,6 +49,19 @@ class Message: # pylint: disable=too-many-instance-attributes; OK for a datacla
47
49
"__weakref__" , # support weak references to messages
48
50
)
49
51
52
+ timestamp : float
53
+ arbitration_id : int
54
+ is_extended_id : bool
55
+ is_remote_frame : bool
56
+ is_error_frame : bool
57
+ channel : Optional [typechecking .Channel ]
58
+ dlc : Optional [int ]
59
+ data : Optional [typechecking .CanData ]
60
+ is_fd : bool
61
+ is_rx : bool
62
+ bitrate_switch : bool
63
+ error_state_indicator : bool
64
+
50
65
def __init__ ( # pylint: disable=too-many-locals, too-many-arguments
51
66
self ,
52
67
timestamp : float = 0.0 ,
You can’t perform that action at this time.
0 commit comments