diff --git a/CHANGES.rst b/CHANGES.rst index e45ffd0..78dcee5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,11 @@ Changes ======= +0.7.0 (2021-11-24) +------------------ + +- Add SyncQueue and AsyncQueue Protocols to provide type hints for sync and async queues #374 + 0.6.2 (2021-10-24) ------------------ diff --git a/janus/__init__.py b/janus/__init__.py index 08c61f5..f21882e 100644 --- a/janus/__init__.py +++ b/janus/__init__.py @@ -8,10 +8,18 @@ from queue import Empty as SyncQueueEmpty from queue import Full as SyncQueueFull from typing import Any, Callable, Deque, Generic, List, Optional, Set, TypeVar + from typing_extensions import Protocol -__version__ = "0.6.2" -__all__ = ("Queue", "PriorityQueue", "LifoQueue") +__version__ = "0.7.0" +__all__ = ( + "Queue", + "PriorityQueue", + "LifoQueue", + "SyncQueue", + "AsyncQueue", + "BaseQueue", +) T = TypeVar("T") @@ -19,7 +27,6 @@ class BaseQueue(Protocol[T]): - @property def maxsize(self) -> int: ... @@ -52,7 +59,6 @@ def get_nowait(self) -> T: class SyncQueue(BaseQueue[T], Protocol[T]): - @property def maxsize(self) -> int: ... @@ -94,7 +100,6 @@ def join(self) -> None: class AsyncQueue(BaseQueue[T], Protocol[T]): - async def put(self, item: T) -> None: ... @@ -127,7 +132,7 @@ def __init__(self, maxsize: int = 0) -> None: self._async_mutex = asyncio.Lock() if sys.version_info[:3] == (3, 10, 0): # Workaround for Python 3.10 bug, see #358: - getattr(self._async_mutex, '_get_loop', lambda: None)() + getattr(self._async_mutex, "_get_loop", lambda: None)() self._async_not_empty = asyncio.Condition(self._async_mutex) self._async_not_full = asyncio.Condition(self._async_mutex) self._finished = asyncio.Event() diff --git a/setup.py b/setup.py index 8bf1ba9..6068493 100644 --- a/setup.py +++ b/setup.py @@ -1,2 +1,3 @@ from setuptools import setup + setup()