Skip to content

Commit

Permalink
run black after updating from v22 to v24
Browse files Browse the repository at this point in the history
  • Loading branch information
dlech committed Apr 28, 2024
1 parent 25669d3 commit 2b256c1
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 28 deletions.
20 changes: 10 additions & 10 deletions bleak/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,15 +287,13 @@ class ExtraArgs(TypedDict, total=False):
@classmethod
async def discover(
cls, timeout: float = 5.0, *, return_adv: Literal[False] = False, **kwargs
) -> List[BLEDevice]:
...
) -> List[BLEDevice]: ...

@overload
@classmethod
async def discover(
cls, timeout: float = 5.0, *, return_adv: Literal[True], **kwargs
) -> Dict[str, Tuple[BLEDevice, AdvertisementData]]:
...
) -> Dict[str, Tuple[BLEDevice, AdvertisementData]]: ...

@classmethod
async def discover(
Expand Down Expand Up @@ -526,12 +524,14 @@ def __init__(

self._backend = PlatformBleakClient(
address_or_ble_device,
disconnected_callback=None
if disconnected_callback is None
else functools.partial(disconnected_callback, self),
services=None
if services is None
else set(map(normalize_uuid_str, services)),
disconnected_callback=(
None
if disconnected_callback is None
else functools.partial(disconnected_callback, self)
),
services=(
None if services is None else set(map(normalize_uuid_str, services))
),
timeout=timeout,
winrt=winrt,
**kwargs,
Expand Down
1 change: 0 additions & 1 deletion bleak/assigned_numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
See <https://www.bluetooth.com/specifications/assigned-numbers/>.
"""


from enum import IntEnum


Expand Down
6 changes: 3 additions & 3 deletions bleak/backends/bluezdbus/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ def on_value_changed(char_path: str, value: bytes) -> None:
watcher
)

self._disconnect_monitor_event = (
local_disconnect_monitor_event
) = asyncio.Event()
self._disconnect_monitor_event = local_disconnect_monitor_event = (
asyncio.Event()
)

try:
try:
Expand Down
6 changes: 3 additions & 3 deletions bleak/backends/corebluetooth/PeripheralDelegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ async def discover_characteristics(self, service: CBService) -> NSArray:
async def discover_descriptors(self, characteristic: CBCharacteristic) -> NSArray:
future = self._event_loop.create_future()

self._characteristic_descriptor_discover_futures[
characteristic.handle()
] = future
self._characteristic_descriptor_discover_futures[characteristic.handle()] = (
future
)
try:
self.peripheral.discoverDescriptorsForCharacteristic_(characteristic)
await future
Expand Down
1 change: 1 addition & 0 deletions bleak/backends/corebluetooth/characteristic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Created on 2019-06-28 by kevincar <[email protected]>
"""

from enum import Enum
from typing import Dict, List, Optional, Tuple, Union

Expand Down
9 changes: 6 additions & 3 deletions bleak/backends/corebluetooth/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Created on 2019-06-26 by kevincar <[email protected]>
"""

import asyncio
import logging
import sys
Expand Down Expand Up @@ -325,9 +326,11 @@ async def write_gatt_char(
await self._delegate.write_characteristic(
characteristic.obj,
value,
CBCharacteristicWriteWithResponse
if response
else CBCharacteristicWriteWithoutResponse,
(
CBCharacteristicWriteWithResponse
if response
else CBCharacteristicWriteWithoutResponse
),
)
logger.debug(f"Write Characteristic {characteristic.uuid} : {data}")

Expand Down
1 change: 1 addition & 0 deletions bleak/backends/corebluetooth/descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Created on 2019-06-28 by kevincar <[email protected]>
"""

from CoreBluetooth import CBDescriptor

from ..corebluetooth.utils import cb_uuid_to_str
Expand Down
1 change: 1 addition & 0 deletions examples/async_callback_with_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Created on 2021-02-25 by hbldh <[email protected]>
"""

import argparse
import time
import asyncio
Expand Down
1 change: 1 addition & 0 deletions examples/scan_iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Created on 2023-07-07 by bojanpotocnik <[email protected]>
"""

import asyncio

from bleak import BleakScanner
Expand Down
12 changes: 4 additions & 8 deletions typings/objc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
T = TypeVar("T")


def super(cls: Type[T], self: T) -> T:
...
def super(cls: Type[T], self: T) -> T: ...


def macos_available(major: int, minor: int, patch: int = 0) -> bool:
...
def macos_available(major: int, minor: int, patch: int = 0) -> bool: ...


class WeakRef:
def __init__(self, object: NSObject) -> None:
...
def __init__(self, object: NSObject) -> None: ...

def __call__(self) -> Optional[NSObject]:
...
def __call__(self) -> Optional[NSObject]: ...

0 comments on commit 2b256c1

Please sign in to comment.