Skip to content

Commit

Permalink
Bump to 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Nov 24, 2021
1 parent 5389dec commit 7b72d85
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
5 changes: 5 additions & 0 deletions 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)
------------------

Expand Down
17 changes: 11 additions & 6 deletions janus/__init__.py
Expand Up @@ -8,18 +8,25 @@
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")
OptFloat = Optional[float]


class BaseQueue(Protocol[T]):

@property
def maxsize(self) -> int:
...
Expand Down Expand Up @@ -52,7 +59,6 @@ def get_nowait(self) -> T:


class SyncQueue(BaseQueue[T], Protocol[T]):

@property
def maxsize(self) -> int:
...
Expand Down Expand Up @@ -94,7 +100,6 @@ def join(self) -> None:


class AsyncQueue(BaseQueue[T], Protocol[T]):

async def put(self, item: T) -> None:
...

Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions setup.py
@@ -1,2 +1,3 @@
from setuptools import setup

setup()

0 comments on commit 7b72d85

Please sign in to comment.