6
6
7
7
__all__ = ["AbstractUdsMessageContainer" , "UdsMessage" , "UdsMessageRecord" ]
8
8
9
- from typing import Any
9
+ from typing import Sequence
10
10
from abc import ABC , abstractmethod
11
11
from datetime import datetime
12
12
@@ -129,7 +129,7 @@ def __eq__(self, other: object) -> bool:
129
129
and self .direction == other .direction
130
130
131
131
@staticmethod
132
- def __validate_packets_records (value : Any ) -> None :
132
+ def __validate_packets_records (value : PacketsRecordsSequence ) -> None :
133
133
"""
134
134
Validate whether the argument contains UDS Packets records.
135
135
@@ -139,9 +139,8 @@ def __validate_packets_records(value: Any) -> None:
139
139
:raise ValueError: At least one of UDS Packet Records sequence elements is not an object of
140
140
:class:`~uds.message.uds_packet.AbstractUdsPacketRecord` class.
141
141
"""
142
- if not isinstance (value , (tuple , list )):
143
- raise TypeError (f"Provided value is not list or tuple type. "
144
- f"Actual type: { type (value )} " )
142
+ if not isinstance (value , Sequence ):
143
+ raise TypeError (f"Provided value is not a sequence. Actual type: { type (value )} " )
145
144
if not value or any (not isinstance (element , AbstractUdsPacketRecord ) for element in value ):
146
145
raise ValueError (f"Provided value must contain only instances of AbstractUdsPacketRecord class. "
147
146
f"Actual value: { value } " )
0 commit comments