Fix TypeError
This commit is contained in:
@@ -12,7 +12,7 @@ class AbsChunkedInputStream(InputStream, HaltListener):
|
||||
preload_chunk_retries: typing.Final[int] = 2
|
||||
max_chunk_tries: typing.Final[int] = 128
|
||||
wait_lock: threading.Condition = threading.Condition()
|
||||
retries: list[int]
|
||||
retries: typing.List[int]
|
||||
retry_on_chunk_error: bool
|
||||
chunk_exception = None
|
||||
wait_for_chunk: int = -1
|
||||
@@ -22,7 +22,7 @@ class AbsChunkedInputStream(InputStream, HaltListener):
|
||||
_decoded_length: int = 0
|
||||
|
||||
def __init__(self, retry_on_chunk_error: bool):
|
||||
self.retries: typing.Final[list[int]] = [
|
||||
self.retries: typing.Final[typing.List[int]] = [
|
||||
0 for _ in range(self.chunks())
|
||||
]
|
||||
self.retry_on_chunk_error = retry_on_chunk_error
|
||||
@@ -30,7 +30,7 @@ class AbsChunkedInputStream(InputStream, HaltListener):
|
||||
def is_closed(self) -> bool:
|
||||
return self.closed
|
||||
|
||||
def buffer(self) -> list[bytearray]:
|
||||
def buffer(self) -> typing.List[bytearray]:
|
||||
raise NotImplementedError()
|
||||
|
||||
def size(self) -> int:
|
||||
@@ -83,10 +83,10 @@ class AbsChunkedInputStream(InputStream, HaltListener):
|
||||
|
||||
return k
|
||||
|
||||
def requested_chunks(self) -> list[bool]:
|
||||
def requested_chunks(self) -> typing.List[bool]:
|
||||
raise NotImplementedError()
|
||||
|
||||
def available_chunks(self) -> list[bool]:
|
||||
def available_chunks(self) -> typing.List[bool]:
|
||||
raise NotImplementedError()
|
||||
|
||||
def chunks(self) -> int:
|
||||
|
||||
@@ -7,6 +7,7 @@ from librespot.standard import BytesInputStream, ByteArrayOutputStream
|
||||
import logging
|
||||
import queue
|
||||
import threading
|
||||
import typing
|
||||
|
||||
|
||||
class AudioKeyManager(PacketsReceiver):
|
||||
@@ -15,7 +16,7 @@ class AudioKeyManager(PacketsReceiver):
|
||||
_AUDIO_KEY_REQUEST_TIMEOUT: int = 20
|
||||
_seqHolder: int = 0
|
||||
_seqHolderLock: threading.Condition = threading.Condition()
|
||||
_callbacks: dict[int, AudioKeyManager.Callback] = {}
|
||||
_callbacks: typing.Dict[int, AudioKeyManager.Callback] = {}
|
||||
_session: Session = None
|
||||
|
||||
def __init__(self, session: Session):
|
||||
|
||||
@@ -87,9 +87,9 @@ class CdnManager:
|
||||
|
||||
class InternalResponse:
|
||||
_buffer: bytearray
|
||||
_headers: dict[str, str]
|
||||
_headers: typing.Dict[str, str]
|
||||
|
||||
def __init__(self, buffer: bytearray, headers: dict[str, str]):
|
||||
def __init__(self, buffer: bytearray, headers: typing.Dict[str, str]):
|
||||
self._buffer = buffer
|
||||
self._headers = headers
|
||||
|
||||
@@ -163,9 +163,9 @@ class CdnManager:
|
||||
_audioDecrypt: AudioDecrypt = None
|
||||
_cdnUrl = None
|
||||
_size: int
|
||||
_buffer: list[bytearray]
|
||||
_available: list[bool]
|
||||
_requested: list[bool]
|
||||
_buffer: typing.List[bytearray]
|
||||
_available: typing.List[bool]
|
||||
_requested: typing.List[bool]
|
||||
_chunks: int
|
||||
_internalStream: CdnManager.Streamer.InternalStream = None
|
||||
_haltListener: HaltListener = None
|
||||
@@ -269,16 +269,16 @@ class CdnManager:
|
||||
self.streamer: CdnManager.Streamer = streamer
|
||||
super().__init__(retry_on_chunk_error)
|
||||
|
||||
def buffer(self) -> list[bytearray]:
|
||||
def buffer(self) -> typing.List[bytearray]:
|
||||
return self.streamer._buffer
|
||||
|
||||
def size(self) -> int:
|
||||
return self.streamer._size
|
||||
|
||||
def requested_chunks(self) -> list[bool]:
|
||||
def requested_chunks(self) -> typing.List[bool]:
|
||||
return self.streamer._requested
|
||||
|
||||
def available_chunks(self) -> list[bool]:
|
||||
def available_chunks(self) -> typing.List[bool]:
|
||||
return self.streamer._available
|
||||
|
||||
def chunks(self) -> int:
|
||||
|
||||
@@ -6,5 +6,5 @@ if typing.TYPE_CHECKING:
|
||||
|
||||
|
||||
class AudioQualityPicker:
|
||||
def get_file(self, files: list[Metadata.AudioFile]) -> Metadata.AudioFile:
|
||||
def get_file(self, files: typing.List[Metadata.AudioFile]) -> Metadata.AudioFile:
|
||||
pass
|
||||
|
||||
@@ -10,12 +10,13 @@ from librespot.standard import BytesInputStream, BytesOutputStream, Closeable, R
|
||||
import concurrent.futures
|
||||
import logging
|
||||
import threading
|
||||
import typing
|
||||
|
||||
|
||||
class ChannelManager(Closeable, PacketsReceiver.PacketsReceiver):
|
||||
CHUNK_SIZE: int = 128 * 1024
|
||||
_LOGGER: logging = logging.getLogger(__name__)
|
||||
_channels: dict[int, Channel] = {}
|
||||
_channels: typing.Dict[int, Channel] = {}
|
||||
_seqHolder: int = 0
|
||||
_seqHolderLock: threading.Condition = threading.Condition()
|
||||
_executorService: concurrent.futures.ThreadPoolExecutor = concurrent.futures.ThreadPoolExecutor(
|
||||
|
||||
Reference in New Issue
Block a user