Skip to content

Commit

Permalink
Bump to 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Dec 17, 2021
1 parent 3421545 commit dff5078
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
@@ -1,6 +1,11 @@
Changes
=======

1.0.0 (2021-12-17)
------------------

- Drop Python 3.6 support

0.7.0 (2021-11-24)
------------------

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

from typing_extensions import Protocol

__version__ = "0.7.0"
__version__ = "1.0.0"
__all__ = (
"Queue",
"PriorityQueue",
Expand Down Expand Up @@ -110,14 +110,9 @@ async def join(self) -> None:
...


current_loop = getattr(asyncio, "get_running_loop", None)
if current_loop is None:
current_loop = asyncio.get_event_loop


class Queue(Generic[T]):
def __init__(self, maxsize: int = 0) -> None:
self._loop = current_loop()
self._loop = asyncio.get_running_loop()
self._maxsize = maxsize

self._init(maxsize)
Expand Down Expand Up @@ -235,7 +230,7 @@ def f() -> None:
with self._sync_mutex:
self._sync_not_full.notify()

fut = self._loop.run_in_executor(None, f)
fut = asyncio.ensure_future(self._loop.run_in_executor(None, f))
fut.add_done_callback(self._pending.discard)
self._pending.add(fut)

Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Expand Up @@ -30,7 +30,6 @@ classifiers =

Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Expand All @@ -41,7 +40,7 @@ classifiers =
keywords= janus, queue, asyncio

[options]
python_requires = >=3.6
python_requires = >=3.7
packages = find:
# https://setuptools.readthedocs.io/en/latest/setuptools.html#setting-the-zip-safe-flag
zip_safe = True
Expand Down
24 changes: 12 additions & 12 deletions tests/test_async.py
Expand Up @@ -20,7 +20,7 @@ async def _test_repr_or_str(self, fn, expect_id):
assert fn(q).startswith("<Queue")
id_is_present = hex(id(q)) in fn(q)
assert expect_id == id_is_present
loop = janus.current_loop()
loop = asyncio.get_running_loop()

async def add_getter():
_q = janus.Queue()
Expand Down Expand Up @@ -105,7 +105,7 @@ async def test_order(self):

@pytest.mark.asyncio
async def test_maxsize(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
_q = janus.Queue(maxsize=2)
q = _q.async_q
assert 2 == q.maxsize
Expand Down Expand Up @@ -158,7 +158,7 @@ async def test_blocking_get(self):

@pytest.mark.asyncio
async def test_get_with_putters(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
_q = janus.Queue(1)
q = _q.async_q
q.put_nowait(1)
Expand All @@ -185,7 +185,7 @@ async def put():

@pytest.mark.asyncio
async def test_blocking_get_wait(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
_q = janus.Queue()
q = _q.async_q
started = asyncio.Event()
Expand Down Expand Up @@ -235,7 +235,7 @@ async def test_nonblocking_get_exception(self):

@pytest.mark.asyncio
async def test_get_cancelled(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
_q = janus.Queue()
q = _q.async_q

Expand All @@ -256,7 +256,7 @@ async def test():

@pytest.mark.asyncio
async def test_get_cancelled_race(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
_q = janus.Queue()
q = _q.async_q

Expand Down Expand Up @@ -287,7 +287,7 @@ async def g1():

@pytest.mark.asyncio
async def test_get_with_waiting_putters(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
_q = janus.Queue(maxsize=1)
q = _q.async_q

Expand Down Expand Up @@ -319,7 +319,7 @@ async def test_blocking_put(self):

@pytest.mark.asyncio
async def test_blocking_put_wait(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
_q = janus.Queue(maxsize=1)
q = _q.async_q
started = asyncio.Event()
Expand Down Expand Up @@ -396,7 +396,7 @@ async def queue_put():

@pytest.mark.asyncio
async def test_put_cancelled(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
_q = janus.Queue()
q = _q.async_q

Expand All @@ -418,7 +418,7 @@ async def test():

@pytest.mark.asyncio
async def test_put_cancelled_race(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
_q = janus.Queue(maxsize=1)
q = _q.async_q

Expand Down Expand Up @@ -449,7 +449,7 @@ async def go():

@pytest.mark.asyncio
async def test_put_with_waiting_getters(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
fut = loop.create_future()

async def go():
Expand Down Expand Up @@ -520,7 +520,7 @@ async def test_task_done_underflow(self):

@pytest.mark.asyncio
async def test_task_done(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
_q = self.q_class()
q = _q.async_q
for i in range(100):
Expand Down
10 changes: 5 additions & 5 deletions tests/test_mixed.py
Expand Up @@ -52,7 +52,7 @@ async def test_unfinished(self):

@pytest.mark.asyncio
async def test_sync_put_async_get(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
q = janus.Queue()

def threaded():
Expand All @@ -77,7 +77,7 @@ async def go():

@pytest.mark.asyncio
async def test_sync_put_async_join(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
q = janus.Queue()

for i in range(5):
Expand All @@ -102,7 +102,7 @@ async def wait_for_empty_queue():

@pytest.mark.asyncio
async def test_async_put_sync_get(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
q = janus.Queue()

def threaded():
Expand All @@ -126,7 +126,7 @@ async def go():

@pytest.mark.asyncio
async def test_sync_join_async_done(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
q = janus.Queue()

def threaded():
Expand All @@ -153,7 +153,7 @@ async def go():

@pytest.mark.asyncio
async def test_async_join_async_done(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
q = janus.Queue()

def threaded():
Expand Down
3 changes: 2 additions & 1 deletion tests/test_sync.py
@@ -1,5 +1,6 @@
# Some simple queue module tests, plus some failure conditions
# to ensure the Queue locks remain stable.
import asyncio
import queue
import threading
import time
Expand Down Expand Up @@ -410,7 +411,7 @@ async def test_failing_queue(self):

@pytest.mark.asyncio
async def test_closed_loop_non_failing(self):
loop = janus.current_loop()
loop = asyncio.get_running_loop()
_q = janus.Queue(QUEUE_SIZE)
q = _q.sync_q
# we are pacthing loop to follow setUp/tearDown agreement
Expand Down

0 comments on commit dff5078

Please sign in to comment.