Skip to content

Commit

Permalink
Fixed broken compatibility with python 3.7 (#111)
Browse files Browse the repository at this point in the history
Fixes #110
  • Loading branch information
pylessard committed Jan 9, 2024
1 parent f871d42 commit 78f1ce3
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions isotp/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,31 @@ def inform_byte_sent(self, datalen: int) -> None:
class TransportLayerLogic:
LOGGER_NAME = 'isotp'

@dataclass(slots=True, init=False)
@dataclass(init=False)
class Params:
__slots__ = (
'stmin',
'blocksize',
'override_receiver_stmin',
'rx_flowcontrol_timeout',
'rx_consecutive_frame_timeout',
'tx_padding',
'wftmax',
'tx_data_length',
'tx_data_min_length',
'max_frame_size',
'can_fd',
'bitrate_switch',
'default_target_address_type',
'rate_limit_max_bitrate',
'rate_limit_window_size',
'rate_limit_enable',
'listen_mode',
'blocking_send',
'logger_name',
'wait_func'
)

stmin: int
blocksize: int
override_receiver_stmin: Optional[float]
Expand Down Expand Up @@ -518,9 +541,12 @@ def complete(self, success: bool) -> None:
self.success = success
self.complete_event.set()

@dataclass(slots=True, frozen=True)
@dataclass(frozen=True)
class ProcessStats:
"""Some statistics produced by every ``process`` called indicating how much has been accomplish during that iteration."""

__slots__ = ('received', 'received_processed', 'sent', 'frame_received')

received: int
received_processed: int
sent: int
Expand All @@ -529,16 +555,20 @@ class ProcessStats:
def __repr__(self):
return f'<{self.__class__.__name__} received:{self.received} (processed: {self.received_processed}, sent: {self.sent})>'

@dataclass(slots=True, frozen=True)
@dataclass(frozen=True)
class ProcessRxReport:
immediate_tx_required: bool
frame_received: bool

@dataclass(slots=True, frozen=True)
__slots__ = ('immediate_tx_required', 'frame_received')

@dataclass(frozen=True)
class ProcessTxReport:
msg: Optional[CanMessage]
immediate_rx_required: bool

__slots__ = 'msg', 'immediate_rx_required'

RxFn = Callable[[float], Optional[CanMessage]]
TxFn = Callable[[CanMessage], None]
PostSendCallback = Callable[[SendRequest], None]
Expand Down

0 comments on commit 78f1ce3

Please sign in to comment.