diff --git a/CHANGES.rst b/CHANGES.rst index 412b6f6..2ea4086 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -12,6 +12,8 @@ Changes - Refomat with ``black`` +- Replace ``timeout`` type from ``Optional[int]`` to ``Optional[float]`` #267 + 0.5.0 (2020-04-23) ------------------ diff --git a/janus/__init__.py b/janus/__init__.py index d2aea67..cb391de 100644 --- a/janus/__init__.py +++ b/janus/__init__.py @@ -13,7 +13,7 @@ T = TypeVar("T") -OptInt = Optional[int] +OptFloat = Optional[float] current_loop = getattr(asyncio, "get_running_loop", None) @@ -265,7 +265,7 @@ def full(self) -> bool: """ return 0 < self._parent._maxsize <= self._parent._qsize() - def put(self, item: T, block: bool = True, timeout: OptInt = None) -> None: + def put(self, item: T, block: bool = True, timeout: OptFloat = None) -> None: """Put an item into the queue. If optional args 'block' is true and 'timeout' is None (the default), @@ -299,7 +299,7 @@ def put(self, item: T, block: bool = True, timeout: OptInt = None) -> None: self._parent._sync_not_empty.notify() self._parent._notify_async_not_empty(threadsafe=True) - def get(self, block: bool = True, timeout: OptInt = None) -> T: + def get(self, block: bool = True, timeout: OptFloat = None) -> T: """Remove and return an item from the queue. If optional args 'block' is true and 'timeout' is None (the default),