Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13.0", "3.14"]
python-version: ["3.11", "3.12", "3.13.0", "3.14", "3.15"]
fail-fast: false

steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]
fail-fast: false

steps:
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
strategy:
matrix:
# Rust runtime doesn't support 3.14 yet.
python-version: ["3.10", "3.11", "3.12", "3.13"]
python-version: ["3.11", "3.12", "3.13"]
rust-version: [ "1.80.0", "1.91.0" ]
fail-fast: false
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: '3.10'
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -31,7 +31,7 @@
run: python -m build
- name: Publish package to PyPI
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1.13

Check notice on line 34 in .github/workflows/python-publish.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

use-trusted-publishing

python-publish.yml:34: prefer trusted publishing for authentication: this step
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,6 @@
"python-envs.defaultEnvManager": "ms-python.python:venv",
"nrf-connect.applications": [
"${workspaceFolder}/extras/zephyr/hci_usb"
]
],
"idf.currentSetup": "/Users/gilles/.espressif/v6.1/esp-idf"
}
7 changes: 1 addition & 6 deletions apps/auracast.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,14 @@
import functools
import logging
import secrets
import sys
import tomllib
from collections.abc import AsyncGenerator, Awaitable, Callable, Iterable, Sequence
from typing import (
Any,
)

import click

if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib

try:
import lc3 # type: ignore # pylint: disable=E0401
except ImportError as e:
Expand Down
4 changes: 1 addition & 3 deletions bumble/a2dp.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
import logging
import struct
from collections.abc import AsyncGenerator, Awaitable, Callable
from typing import ClassVar

from typing_extensions import Self
from typing import ClassVar, Self

from bumble import utils
from bumble.codecs import AacAudioRtpPacket
Expand Down
3 changes: 1 addition & 2 deletions bumble/codecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
from __future__ import annotations

from dataclasses import dataclass

from typing_extensions import Self
from typing import Self

from bumble import core

Expand Down
3 changes: 1 addition & 2 deletions bumble/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@
ClassVar,
Final,
Literal,
Self,
cast,
overload,
)

from typing_extensions import Self

from bumble import utils
from bumble.company_ids import COMPANY_IDENTIFIERS

Expand Down
4 changes: 1 addition & 3 deletions bumble/data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
import math
import struct
from collections.abc import Sequence
from typing import Any, ClassVar

from typing_extensions import Self
from typing import Any, ClassVar, Self

from bumble import company_ids, core, hci

Expand Down
15 changes: 7 additions & 8 deletions bumble/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@
TYPE_CHECKING,
Any,
ClassVar,
Self,
TypeVar,
cast,
overload,
)

from typing_extensions import Self

from bumble import (
att,
core,
Expand Down Expand Up @@ -2874,7 +2873,7 @@ async def send_command(
return await self.host.send_command(
command, check_result, self.command_timeout
)
except asyncio.TimeoutError as error:
except TimeoutError as error:
logger.warning(f'!!! Command {command.name} timed out')
raise CommandTimeoutError() from error

Expand All @@ -2893,7 +2892,7 @@ async def send_sync_command(self, command: hci.HCI_SyncCommand[_RP]) -> _RP:
'''
try:
return await self.host.send_sync_command(command, self.command_timeout)
except asyncio.TimeoutError as error:
except TimeoutError as error:
logger.warning(f'!!! Command {command.name} timed out')
raise CommandTimeoutError() from error

Expand All @@ -2911,7 +2910,7 @@ async def send_sync_command_raw(
'''
try:
return await self.host.send_sync_command_raw(command, self.command_timeout)
except asyncio.TimeoutError as error:
except TimeoutError as error:
logger.warning(f'!!! Command {command.name} timed out')
raise CommandTimeoutError() from error

Expand All @@ -2933,7 +2932,7 @@ async def send_async_command(
return await self.host.send_async_command(
command, check_status, self.command_timeout
)
except asyncio.TimeoutError as error:
except TimeoutError as error:
logger.warning(f'!!! Command {command.name} timed out')
raise CommandTimeoutError() from error

Expand Down Expand Up @@ -4030,7 +4029,7 @@ def on_connection_failure(error: core.ConnectionError):
return await asyncio.wait_for(
asyncio.shield(pending_connection), timeout
)
except asyncio.TimeoutError:
except TimeoutError:
await self.send_sync_command(
hci.HCI_LE_Create_Connection_Cancel_Command()
)
Expand Down Expand Up @@ -4128,7 +4127,7 @@ def on_connection_failure(error: core.ConnectionError):
return await asyncio.wait_for(
asyncio.shield(pending_connection), timeout
)
except asyncio.TimeoutError:
except TimeoutError:
await self.send_sync_command(
hci.HCI_Create_Connection_Cancel_Command(bd_addr=peer_address)
)
Expand Down
5 changes: 2 additions & 3 deletions bumble/gatt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@
Any,
ClassVar,
Generic,
Self,
TypeVar,
overload,
)

from typing_extensions import Self

from bumble import att, core, l2cap, utils
from bumble.colors import color
from bumble.core import UUID, InvalidStateError
Expand Down Expand Up @@ -369,7 +368,7 @@ async def send_request(self, request: att.ATT_PDU):
response = await asyncio.wait_for(
self.pending_response, GATT_REQUEST_TIMEOUT
)
except asyncio.TimeoutError as error:
except TimeoutError as error:
logger.warning(color('!!! GATT Request timeout', 'red'))
raise core.TimeoutError(f'GATT timeout for {request.name}') from error
finally:
Expand Down
2 changes: 1 addition & 1 deletion bumble/gatt_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ async def _indicate_single_bearer(
try:
self.send_gatt_pdu(bearer, bytes(indication))
await asyncio.wait_for(pending_confirmation, GATT_REQUEST_TIMEOUT)
except asyncio.TimeoutError as error:
except TimeoutError as error:
logger.warning(color('!!! GATT Indicate timeout', 'red'))
raise TimeoutError(f'GATT timeout for {indication.name}') from error
finally:
Expand Down
3 changes: 1 addition & 2 deletions bumble/hci.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@
ClassVar,
Generic,
Literal,
Self,
SupportsBytes,
TypeVar,
cast,
)

from typing_extensions import Self

from bumble import crypto, utils
from bumble.colors import color
from bumble.core import (
Expand Down
4 changes: 1 addition & 3 deletions bumble/hfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
import re
import traceback
from collections.abc import Iterable
from typing import Any, ClassVar, Literal, overload

from typing_extensions import Self
from typing import Any, ClassVar, Literal, Self, overload

from bumble import at, device, rfcomm, sdp, utils
from bumble.colors import color
Expand Down
2 changes: 1 addition & 1 deletion bumble/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ async def _send_command(
self.pending_response, timeout=response_timeout
)
return response
except asyncio.TimeoutError:
except TimeoutError:
raise
except Exception:
logger.exception(color("!!! Exception while sending command:", "red"))
Expand Down
4 changes: 1 addition & 3 deletions bumble/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
import logging
import os
import pathlib
from typing import TYPE_CHECKING, Any

from typing_extensions import Self
from typing import TYPE_CHECKING, Any, Self

from bumble import hci
from bumble.colors import color
Expand Down
3 changes: 1 addition & 2 deletions bumble/profiles/bap.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
import logging
import struct
from collections.abc import Sequence

from typing_extensions import Self
from typing import Self

from bumble import core, data_types, gatt, hci, utils
from bumble.profiles import le_audio
Expand Down
4 changes: 1 addition & 3 deletions bumble/profiles/heart_rate_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
import enum
import struct
from collections.abc import Callable, Sequence
from typing import Any

from typing_extensions import Self
from typing import Any, Self

from bumble import att, core, device, gatt, gatt_adapters, gatt_client, utils

Expand Down
4 changes: 1 addition & 3 deletions bumble/profiles/le_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
import dataclasses
import enum
import struct
from typing import Any

from typing_extensions import Self
from typing import Any, Self

from bumble import utils
from bumble.profiles import bap
Expand Down
4 changes: 1 addition & 3 deletions bumble/profiles/mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
import dataclasses
import enum
import struct
from typing import TYPE_CHECKING, ClassVar

from typing_extensions import Self
from typing import TYPE_CHECKING, ClassVar, Self

from bumble import core, device, gatt, gatt_client, utils

Expand Down
3 changes: 1 addition & 2 deletions bumble/profiles/pbp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

import dataclasses
import enum

from typing_extensions import Self
from typing import Self

from bumble import core, data_types, gatt
from bumble.profiles import le_audio
Expand Down
4 changes: 1 addition & 3 deletions bumble/rfcomm.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
import enum
import logging
from collections.abc import Callable
from typing import TYPE_CHECKING

from typing_extensions import Self
from typing import TYPE_CHECKING, Self

from bumble import core, l2cap, sdp, utils
from bumble.colors import color
Expand Down
4 changes: 1 addition & 3 deletions bumble/sdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
import struct
from collections.abc import Iterable, Sequence
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, ClassVar, TypeAlias, TypeVar

from typing_extensions import Self
from typing import TYPE_CHECKING, Any, ClassVar, Self, TypeAlias, TypeVar

from bumble import core, hci, l2cap, utils
from bumble.colors import color
Expand Down
13 changes: 5 additions & 8 deletions bumble/snoop.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class BtSnooper(Snooper):
"""

IDENTIFICATION_PATTERN = b'btsnoop\0'
TIMESTAMP_ANCHOR = datetime.datetime(2000, 1, 1, tzinfo=datetime.timezone.utc)
TIMESTAMP_ANCHOR = datetime.datetime(2000, 1, 1, tzinfo=datetime.UTC)
TIMESTAMP_DELTA = 0x00E03AB44A676000
ONE_MS = datetime.timedelta(microseconds=1)

Expand All @@ -87,10 +87,7 @@ def snoop(self, hci_packet: bytes, direction: Snooper.Direction) -> None:
# Compute the current timestamp
timestamp = (
int(
(
datetime.datetime.now(tz=datetime.timezone.utc)
- self.TIMESTAMP_ANCHOR
)
(datetime.datetime.now(tz=datetime.UTC) - self.TIMESTAMP_ANCHOR)
/ self.ONE_MS
)
+ self.TIMESTAMP_DELTA
Expand Down Expand Up @@ -138,7 +135,7 @@ def __init__(self, output: BinaryIO):
)

def snoop(self, hci_packet: bytes, direction: Snooper.Direction):
now = datetime.datetime.now(datetime.timezone.utc)
now = datetime.datetime.now(datetime.UTC)
sec = int(now.timestamp())
usec = now.microsecond

Expand Down Expand Up @@ -237,7 +234,7 @@ def create_snooper(spec: str) -> Generator[Snooper, None, None]:
# Process the file name string pattern.
file_path = io_name.format(
now=datetime.datetime.now(),
utcnow=datetime.datetime.now(tz=datetime.timezone.utc),
utcnow=datetime.datetime.now(tz=datetime.UTC),
pid=os.getpid(),
instance=_SNOOPER_INSTANCE_COUNT,
)
Expand All @@ -261,7 +258,7 @@ def create_snooper(spec: str) -> Generator[Snooper, None, None]:
# Process the file name string pattern.
file_path = io_name.format(
now=datetime.datetime.now(),
utcnow=datetime.datetime.now(tz=datetime.timezone.utc),
utcnow=datetime.datetime.now(tz=datetime.UTC),
pid=os.getpid(),
instance=_SNOOPER_INSTANCE_COUNT,
)
Expand Down
3 changes: 1 addition & 2 deletions bumble/testing/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
# -----------------------------------------------------------------------------
import asyncio
import functools

from typing_extensions import Self
from typing import Self

from bumble.controller import Controller
from bumble.device import Connection, Device
Expand Down
2 changes: 1 addition & 1 deletion bumble/transport/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async def run() -> None:

try:
await asyncio.wait_for(run(), max_time)
except asyncio.TimeoutError:
except TimeoutError:
transport.close()
raise TransportInitError(
'the controller did not answer the commands sent to resynchronize'
Expand Down
Loading
Loading