|
6 | 6 | import logging |
7 | 7 | import threading |
8 | 8 | from abc import ABC, ABCMeta, abstractmethod |
| 9 | +from collections.abc import Iterator, Sequence |
9 | 10 | from enum import Enum, auto |
10 | 11 | from time import time |
11 | 12 | from types import TracebackType |
12 | 13 | from typing import ( |
13 | 14 | Any, |
14 | 15 | Callable, |
15 | | - Iterator, |
16 | | - List, |
17 | 16 | Optional, |
18 | | - Sequence, |
19 | | - Tuple, |
20 | | - Type, |
21 | 17 | Union, |
22 | 18 | cast, |
23 | 19 | ) |
@@ -97,7 +93,7 @@ def __init__( |
97 | 93 | :raises ~can.exceptions.CanInitializationError: |
98 | 94 | If the bus cannot be initialized |
99 | 95 | """ |
100 | | - self._periodic_tasks: List[_SelfRemovingCyclicTask] = [] |
| 96 | + self._periodic_tasks: list[_SelfRemovingCyclicTask] = [] |
101 | 97 | self.set_filters(can_filters) |
102 | 98 | # Flip the class default value when the constructor finishes. That |
103 | 99 | # usually means the derived class constructor was also successful, |
@@ -147,7 +143,7 @@ def recv(self, timeout: Optional[float] = None) -> Optional[Message]: |
147 | 143 |
|
148 | 144 | def _recv_internal( |
149 | 145 | self, timeout: Optional[float] |
150 | | - ) -> Tuple[Optional[Message], bool]: |
| 146 | + ) -> tuple[Optional[Message], bool]: |
151 | 147 | """ |
152 | 148 | Read a message from the bus and tell whether it was filtered. |
153 | 149 | This methods may be called by :meth:`~can.BusABC.recv` |
@@ -491,7 +487,7 @@ def __enter__(self) -> Self: |
491 | 487 |
|
492 | 488 | def __exit__( |
493 | 489 | self, |
494 | | - exc_type: Optional[Type[BaseException]], |
| 490 | + exc_type: Optional[type[BaseException]], |
495 | 491 | exc_value: Optional[BaseException], |
496 | 492 | traceback: Optional[TracebackType], |
497 | 493 | ) -> None: |
@@ -529,7 +525,7 @@ def protocol(self) -> CanProtocol: |
529 | 525 | return self._can_protocol |
530 | 526 |
|
531 | 527 | @staticmethod |
532 | | - def _detect_available_configs() -> List[can.typechecking.AutoDetectedConfig]: |
| 528 | + def _detect_available_configs() -> list[can.typechecking.AutoDetectedConfig]: |
533 | 529 | """Detect all configurations/channels that this interface could |
534 | 530 | currently connect with. |
535 | 531 |
|
|
0 commit comments