Skip to content

Commit

Permalink
Fix #267: Replace timeout type from Optional[int] to Optional[float]
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Oct 26, 2020
1 parent d7597a2 commit 5a19ba7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -12,6 +12,8 @@ Changes

- Refomat with ``black``

- Replace ``timeout`` type from ``Optional[int]`` to ``Optional[float]`` #267

0.5.0 (2020-04-23)
------------------

Expand Down
6 changes: 3 additions & 3 deletions janus/__init__.py
Expand Up @@ -13,7 +13,7 @@


T = TypeVar("T")
OptInt = Optional[int]
OptFloat = Optional[float]


current_loop = getattr(asyncio, "get_running_loop", None)
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 5a19ba7

Please sign in to comment.