|
2 | 2 |
|
3 | 3 | """Top-level package for bleak.""" |
4 | 4 |
|
5 | | -from __future__ import annotations |
6 | | - |
7 | 5 | __author__ = """Henrik Blidh""" |
8 | 6 | |
9 | 7 |
|
|
14 | 12 | import os |
15 | 13 | import sys |
16 | 14 | import uuid |
17 | | -from collections.abc import AsyncGenerator, Awaitable, Callable, Iterable |
18 | 15 | from types import TracebackType |
19 | | -from typing import Any, Literal, Optional, TypedDict, Union, cast, overload |
20 | | - |
21 | | -if sys.version_info < (3, 12): |
22 | | - from typing_extensions import Buffer |
23 | | -else: |
24 | | - from collections.abc import Buffer |
| 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 | +) |
25 | 29 |
|
26 | | -if sys.version_info < (3, 11): |
27 | | - from async_timeout import timeout as async_timeout |
28 | | - from typing_extensions import Never, Self, Unpack, assert_never |
29 | | -else: |
30 | | - from asyncio import timeout as async_timeout |
31 | | - from typing import Never, Self, Unpack, assert_never |
| 30 | +from typing_extensions import Buffer, Never, Self, Unpack, assert_never |
32 | 31 |
|
| 32 | +from bleak._compat import async_timeout |
33 | 33 | from bleak.args.bluez import BlueZScannerArgs |
34 | 34 | from bleak.args.corebluetooth import CBScannerArgs, CBStartNotifyArgs |
35 | 35 | from bleak.args.winrt import WinRTClientArgs |
@@ -481,7 +481,7 @@ class BleakClient: |
481 | 481 | def __init__( |
482 | 482 | self, |
483 | 483 | address_or_ble_device: Union[BLEDevice, str], |
484 | | - disconnected_callback: Optional[Callable[[BleakClient], None]] = None, |
| 484 | + disconnected_callback: Optional[Callable[["BleakClient"], None]] = None, |
485 | 485 | services: Optional[Iterable[str]] = None, |
486 | 486 | *, |
487 | 487 | timeout: float = 10.0, |
|
0 commit comments