Skip to content

Commit 6fc0d7d

Browse files
committed
remove typing import
1 parent 2b8154a commit 6fc0d7d

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

can/notifier.py

+16-6
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,20 @@
77
import logging
88
import threading
99
import time
10-
import typing
1110
from contextlib import AbstractContextManager
1211
from types import TracebackType
13-
from typing import Any, Awaitable, Callable, Iterable, List, NamedTuple, Optional, Union
12+
from typing import (
13+
Any,
14+
Awaitable,
15+
Callable,
16+
Final,
17+
Iterable,
18+
List,
19+
NamedTuple,
20+
Optional,
21+
Type,
22+
Union,
23+
)
1424

1525
from can.bus import BusABC
1626
from can.listener import Listener
@@ -34,7 +44,7 @@ class _NotifierRegistry:
3444

3545
def __init__(self) -> None:
3646
"""Initialize the registry with an empty list of bus-notifier pairs and a threading lock."""
37-
self.pairs: typing.List[_BusNotifierPair] = []
47+
self.pairs: List[_BusNotifierPair] = []
3848
self.lock = threading.Lock()
3949

4050
def register(self, bus: BusABC, notifier: "Notifier") -> None:
@@ -68,7 +78,7 @@ def unregister(self, bus: BusABC, notifier: "Notifier") -> None:
6878
The Notifier instance associated with the bus.
6979
"""
7080
with self.lock:
71-
registered_pairs_to_remove: typing.List[_BusNotifierPair] = []
81+
registered_pairs_to_remove: List[_BusNotifierPair] = []
7282
for pair in self.pairs:
7383
if pair.bus is bus and pair.notifier is notifier:
7484
registered_pairs_to_remove.append(pair)
@@ -78,7 +88,7 @@ def unregister(self, bus: BusABC, notifier: "Notifier") -> None:
7888

7989
class Notifier(AbstractContextManager):
8090

81-
_registry: typing.Final = _NotifierRegistry()
91+
_registry: Final = _NotifierRegistry()
8292

8393
def __init__(
8494
self,
@@ -266,7 +276,7 @@ def stopped(self) -> bool:
266276

267277
def __exit__(
268278
self,
269-
exc_type: Optional[typing.Type[BaseException]],
279+
exc_type: Optional[Type[BaseException]],
270280
exc_value: Optional[BaseException],
271281
traceback: Optional[TracebackType],
272282
) -> None:

0 commit comments

Comments
 (0)