Skip to content

Commit 17192c7

Browse files
committed
rollback collections.abc imports
1 parent 952f579 commit 17192c7

File tree

17 files changed

+42
-52
lines changed

17 files changed

+42
-52
lines changed

bleak/__init__.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
"""Top-level package for bleak."""
44

5+
from __future__ import annotations
6+
57
__author__ = """Henrik Blidh"""
68
__email__ = "[email protected]"
79

@@ -12,20 +14,9 @@
1214
import os
1315
import sys
1416
import uuid
17+
from collections.abc import AsyncGenerator, Awaitable, Callable, Iterable
1518
from types import TracebackType
16-
from typing import (
17-
Any,
18-
AsyncGenerator,
19-
Awaitable,
20-
Callable,
21-
Iterable,
22-
Literal,
23-
Optional,
24-
TypedDict,
25-
Union,
26-
cast,
27-
overload,
28-
)
19+
from typing import Any, Literal, Optional, TypedDict, Union, cast, overload
2920

3021
from typing_extensions import Buffer, Never, Self, Unpack, assert_never
3122

bleak/args/corebluetooth.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
-------------------------------
55
"""
66

7-
from typing import Callable, Optional, TypedDict
7+
from collections.abc import Callable
8+
from typing import Optional, TypedDict
89

910

1011
class CBScannerArgs(TypedDict, total=False):

bleak/backends/bluezdbus/advertisement_monitor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
assert False, "This backend is only available on Linux"
1515

1616
import logging
17-
from typing import Any, Iterable, no_type_check
17+
from collections.abc import Iterable
18+
from typing import Any, no_type_check
1819
from warnings import warn
1920

2021
from dbus_fast import PropertyAccess

bleak/backends/bluezdbus/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
import logging
1414
import os
1515
import warnings
16+
from collections.abc import Callable
1617
from contextlib import AsyncExitStack
17-
from typing import Any, Callable, Optional, Union
18+
from typing import Any, Optional, Union
1819

1920
from typing_extensions import Buffer, override
2021

bleak/backends/bluezdbus/manager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
import logging
1919
import os
2020
from collections import defaultdict
21-
from typing import Any, Callable, Coroutine, MutableMapping, NamedTuple, Optional, cast
21+
from collections.abc import Callable, Coroutine, MutableMapping
22+
from typing import Any, NamedTuple, Optional, cast
2223
from weakref import WeakKeyDictionary
2324

2425
from dbus_fast import BusType, Message, MessageType, Variant, unpack_variants

bleak/backends/bluezdbus/scanner.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
assert False, "This backend is only available on Linux"
77

88
import logging
9-
from typing import Any, Callable, Coroutine, Literal, Optional
9+
from collections.abc import Callable, Coroutine
10+
from typing import Any, Literal, Optional
1011
from warnings import warn
1112

1213
from dbus_fast import Variant

bleak/backends/bluezdbus/signals.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# -*- coding: utf-8 -*-
2+
from __future__ import annotations
3+
24
import sys
35
from typing import TYPE_CHECKING
46

@@ -142,7 +144,7 @@ def __init__(
142144
self.args = None
143145

144146
@staticmethod
145-
def parse(rules: str) -> "MatchRules":
147+
def parse(rules: str) -> MatchRules:
146148
return MatchRules(**dict(r.split("=") for r in rules.split(",")))
147149

148150
def __str__(self) -> str:

bleak/backends/characteristic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from __future__ import annotations
77

88
import enum
9-
from typing import TYPE_CHECKING, Any, Callable, Union
9+
from collections.abc import Callable
10+
from typing import TYPE_CHECKING, Any, Union
1011
from uuid import UUID
1112

1213
from bleak.assigned_numbers import CharacteristicPropertyName

bleak/backends/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
import os
88
import platform
99
import sys
10-
from typing import Any, Callable, Optional, Union
10+
from collections.abc import Callable
11+
from typing import Any, Optional, Union
1112

1213
from typing_extensions import Buffer
1314

bleak/backends/corebluetooth/CentralManagerDelegate.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
import asyncio
1515
import logging
1616
import threading
17-
from typing import Any, Callable, Optional
18-
19-
from typing_extensions import Self
17+
from collections.abc import Callable
18+
from typing import Any, Optional
2019

2120
if sys.version_info < (3, 11):
2221
from async_timeout import timeout as async_timeout
22+
from typing_extensions import Self
2323
else:
2424
from asyncio import timeout as async_timeout
25+
from typing import Self
2526

2627
import objc
2728
from CoreBluetooth import (

0 commit comments

Comments
 (0)