From 0192f301b4709989cb97ba59a01714d379b19cd8 Mon Sep 17 00:00:00 2001 From: aostiles Date: Thu, 19 Jan 2017 16:11:09 -0800 Subject: [PATCH] Reflect Python 3.4.4 asyncio.queues changes in stubs (#847) Fixes #846 --- stdlib/3.4/asyncio/__init__.pyi | 4 +++- stdlib/3.4/asyncio/queues.pyi | 15 ++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/stdlib/3.4/asyncio/__init__.pyi b/stdlib/3.4/asyncio/__init__.pyi index 5f83bc6cf..3f88dac01 100644 --- a/stdlib/3.4/asyncio/__init__.pyi +++ b/stdlib/3.4/asyncio/__init__.pyi @@ -72,7 +72,6 @@ from asyncio.queues import ( Queue as Queue, PriorityQueue as PriorityQueue, LifoQueue as LifoQueue, - JoinableQueue as JoinableQueue, QueueFull as QueueFull, QueueEmpty as QueueEmpty, ) @@ -84,6 +83,9 @@ from asyncio.locks import ( BoundedSemaphore as BoundedSemaphore, ) +if sys.version_info < (3, 5): + from asyncio.queues import JoinableQueue as JoinableQueue + # TODO: It should be possible to instantiate these classes, but mypy # currently disallows this. # See https://github.com/python/mypy/issues/1843 diff --git a/stdlib/3.4/asyncio/queues.pyi b/stdlib/3.4/asyncio/queues.pyi index dd1ffe600..2901218f5 100644 --- a/stdlib/3.4/asyncio/queues.pyi +++ b/stdlib/3.4/asyncio/queues.pyi @@ -1,3 +1,4 @@ +import sys from asyncio.events import AbstractEventLoop from .coroutines import coroutine from .futures import Future @@ -32,6 +33,10 @@ class Queue(Generic[T]): @coroutine def get(self) -> Future[T]: ... def get_nowait(self) -> T: ... + if sys.version_info >= (3, 4): + @coroutine + def join(self) -> None: ... + def task_done(self) -> None: ... class PriorityQueue(Queue): ... @@ -39,8 +44,8 @@ class PriorityQueue(Queue): ... class LifoQueue(Queue): ... - -class JoinableQueue(Queue): - def task_done(self) -> None: ... - @coroutine - def join(self) -> None: ... +if sys.version_info < (3, 5): + class JoinableQueue(Queue): + def task_done(self) -> None: ... + @coroutine + def join(self) -> None: ...