[util/pipeline] use 'Queue' without generics

Apparently Python 3.8 does not support generic type parameters on the
built-in 'queue.Queue' type?
This commit is contained in:
Arav K. 2024-06-08 14:30:22 +02:00
parent 8b232bd311
commit 549fea14cd
2 changed files with 3 additions and 9 deletions

View file

@ -35,7 +35,6 @@ in place of any single coroutine.
import queue
import sys
from threading import Lock, Thread
from typing import TypeVar
BUBBLE = "__PIPELINE_BUBBLE__"
POISON = "__PIPELINE_POISON__"
@ -85,10 +84,7 @@ def _invalidate_queue(q, val=None, sync=True):
q.mutex.release()
T = TypeVar("T")
class CountedQueue(queue.Queue[T]):
class CountedQueue(queue.Queue):
"""A queue that keeps track of the number of threads that are
still feeding into it. The queue is poisoned when all threads are
finished with the queue.

View file

@ -1181,9 +1181,7 @@ class ExceptionWatcher(Thread):
Once an exception occurs, raise it and execute a callback.
"""
def __init__(
self, queue: queue.Queue[Exception], callback: Callable[[], None]
):
def __init__(self, queue: queue.Queue, callback: Callable[[], None]):
self._queue = queue
self._callback = callback
self._stopevent = Event()
@ -1442,7 +1440,7 @@ class ReplayGainPlugin(BeetsPlugin):
"""Open a `ThreadPool` instance in `self.pool`"""
if self.pool is None and self.backend_instance.do_parallel:
self.pool = ThreadPool(threads)
self.exc_queue: queue.Queue[Exception] = queue.Queue()
self.exc_queue: queue.Queue = queue.Queue()
signal.signal(signal.SIGINT, self._interrupt)