diff --git a/aioh2/helper.py b/aioh2/helper.py index 9804564..d81dfba 100644 --- a/aioh2/helper.py +++ b/aioh2/helper.py @@ -4,7 +4,7 @@ from .protocol import H2Protocol -__all__ = ['open_connection', 'start_server', 'async_task'] +__all__ = ['open_connection', 'start_server'] if hasattr(socket, 'AF_UNIX'): __all__.extend(['open_unix_connection', 'start_unix_server']) @@ -82,8 +82,3 @@ def factory(): # noinspection PyArgumentList return (yield from loop.create_unix_server(factory, path, **kwargs)) - -if hasattr(asyncio, 'ensure_future'): # Python >= 3.5 - async_task = getattr(asyncio, 'ensure_future') -else: - async_task = getattr(asyncio, 'async') diff --git a/aioh2/protocol.py b/aioh2/protocol.py index 101c291..fba886b 100644 --- a/aioh2/protocol.py +++ b/aioh2/protocol.py @@ -10,11 +10,16 @@ from h2.connection import H2Connection from h2.exceptions import NoSuchStreamError, StreamClosedError, ProtocolError -from . import exceptions, async_task +from . import exceptions __all__ = ['H2Protocol'] logger = getLogger(__package__) +if hasattr(asyncio, 'ensure_future'): # Python >= 3.5 + async_task = getattr(asyncio, 'ensure_future') +else: + async_task = getattr(asyncio, 'async') + @asyncio.coroutine def _wait_for_events(*events_):