forked from auracaster/bumble_mirror
Merge pull request #802 from zxzxwu/version
Upgrade Python version to 3.10-3.14
This commit is contained in:
@@ -19,13 +19,13 @@ from __future__ import annotations
|
||||
|
||||
import abc
|
||||
import asyncio
|
||||
import concurrent.futures
|
||||
import dataclasses
|
||||
import enum
|
||||
import logging
|
||||
import pathlib
|
||||
import sys
|
||||
import wave
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from typing import TYPE_CHECKING, AsyncGenerator, BinaryIO
|
||||
|
||||
from bumble.colors import color
|
||||
@@ -176,7 +176,7 @@ class ThreadedAudioOutput(AudioOutput):
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._thread_pool = ThreadPoolExecutor(1)
|
||||
self._thread_pool = concurrent.futures.ThreadPoolExecutor(1)
|
||||
self._pcm_samples: asyncio.Queue[bytes] = asyncio.Queue()
|
||||
self._write_task = asyncio.create_task(self._write_loop())
|
||||
|
||||
@@ -405,7 +405,7 @@ class ThreadedAudioInput(AudioInput):
|
||||
"""Base class for AudioInput implementation where reading samples may block."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._thread_pool = ThreadPoolExecutor(1)
|
||||
self._thread_pool = concurrent.futures.ThreadPoolExecutor(1)
|
||||
self._pcm_samples: asyncio.Queue[bytes] = asyncio.Queue()
|
||||
|
||||
@abc.abstractmethod
|
||||
|
||||
@@ -2370,11 +2370,7 @@ class Device(utils.CompositeEventEmitter):
|
||||
hci.Address.ANY: []
|
||||
} # Futures, by BD address OR [Futures] for hci.Address.ANY
|
||||
|
||||
# In Python <= 3.9 + Rust Runtime, asyncio.Lock cannot be properly initiated.
|
||||
if sys.version_info >= (3, 10):
|
||||
self._cis_lock = asyncio.Lock()
|
||||
else:
|
||||
self._cis_lock = AsyncExitStack()
|
||||
self._cis_lock = asyncio.Lock()
|
||||
|
||||
# Own address type cache
|
||||
self.connect_own_address_type = None
|
||||
|
||||
@@ -241,11 +241,7 @@ def cancel_on_event(
|
||||
return
|
||||
msg = f'abort: {event} event occurred.'
|
||||
if isinstance(future, asyncio.Task):
|
||||
# python < 3.9 does not support passing a message on `Task.cancel`
|
||||
if sys.version_info < (3, 9, 0):
|
||||
future.cancel()
|
||||
else:
|
||||
future.cancel(msg)
|
||||
future.cancel(msg)
|
||||
else:
|
||||
future.set_exception(asyncio.CancelledError(msg))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user