2013-10-17 17:40:50 -03:00
|
|
|
"""The asyncio package, tracking PEP 3156."""
|
|
|
|
|
2017-12-10 19:36:12 -04:00
|
|
|
# flake8: noqa
|
|
|
|
|
2013-10-17 17:40:50 -03:00
|
|
|
import sys
|
2019-05-27 16:56:22 -03:00
|
|
|
import warnings
|
2013-10-17 17:40:50 -03:00
|
|
|
|
|
|
|
# This relies on each of the submodules having an __all__ variable.
|
2015-01-05 20:03:58 -04:00
|
|
|
from .base_events import *
|
2014-06-28 19:46:45 -03:00
|
|
|
from .coroutines import *
|
2013-10-17 17:40:50 -03:00
|
|
|
from .events import *
|
2018-09-11 14:13:04 -03:00
|
|
|
from .exceptions import *
|
2014-01-25 10:32:06 -04:00
|
|
|
from .futures import *
|
2013-10-17 17:40:50 -03:00
|
|
|
from .locks import *
|
|
|
|
from .protocols import *
|
2017-12-14 10:42:21 -04:00
|
|
|
from .runners import *
|
2014-01-25 10:32:06 -04:00
|
|
|
from .queues import *
|
2013-10-17 17:40:50 -03:00
|
|
|
from .streams import *
|
2014-02-01 17:49:59 -04:00
|
|
|
from .subprocess import *
|
2013-10-17 17:40:50 -03:00
|
|
|
from .tasks import *
|
2014-01-25 10:32:06 -04:00
|
|
|
from .transports import *
|
2013-10-17 17:40:50 -03:00
|
|
|
|
2018-05-28 18:54:02 -03:00
|
|
|
# Exposed for _asynciomodule.c to implement now deprecated
|
|
|
|
# Task.all_tasks() method. This function will be removed in 3.9.
|
|
|
|
from .tasks import _all_tasks_compat # NoQA
|
|
|
|
|
2015-01-05 20:03:58 -04:00
|
|
|
__all__ = (base_events.__all__ +
|
|
|
|
coroutines.__all__ +
|
2014-06-28 19:46:45 -03:00
|
|
|
events.__all__ +
|
2018-09-11 14:13:04 -03:00
|
|
|
exceptions.__all__ +
|
2014-01-25 10:32:06 -04:00
|
|
|
futures.__all__ +
|
2013-10-17 17:40:50 -03:00
|
|
|
locks.__all__ +
|
|
|
|
protocols.__all__ +
|
2017-12-14 10:42:21 -04:00
|
|
|
runners.__all__ +
|
2014-01-25 10:32:06 -04:00
|
|
|
queues.__all__ +
|
2013-10-17 17:40:50 -03:00
|
|
|
streams.__all__ +
|
2014-02-01 17:49:59 -04:00
|
|
|
subprocess.__all__ +
|
2014-01-25 10:32:06 -04:00
|
|
|
tasks.__all__ +
|
|
|
|
transports.__all__)
|
2014-07-18 07:44:25 -03:00
|
|
|
|
|
|
|
if sys.platform == 'win32': # pragma: no cover
|
|
|
|
from .windows_events import *
|
|
|
|
__all__ += windows_events.__all__
|
|
|
|
else:
|
|
|
|
from .unix_events import * # pragma: no cover
|
|
|
|
__all__ += unix_events.__all__
|
2019-05-27 16:56:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
__all__ += ('StreamReader', 'StreamWriter', 'StreamReaderProtocol') # deprecated
|
|
|
|
|
|
|
|
|
|
|
|
def __getattr__(name):
|
|
|
|
global StreamReader, StreamWriter, StreamReaderProtocol
|
|
|
|
if name == 'StreamReader':
|
|
|
|
warnings.warn("StreamReader is deprecated since Python 3.8 "
|
|
|
|
"in favor of Stream, and scheduled for removal "
|
|
|
|
"in Python 3.10",
|
|
|
|
DeprecationWarning,
|
|
|
|
stacklevel=2)
|
|
|
|
from .streams import StreamReader as sr
|
|
|
|
StreamReader = sr
|
|
|
|
return StreamReader
|
|
|
|
if name == 'StreamWriter':
|
|
|
|
warnings.warn("StreamWriter is deprecated since Python 3.8 "
|
|
|
|
"in favor of Stream, and scheduled for removal "
|
|
|
|
"in Python 3.10",
|
|
|
|
DeprecationWarning,
|
|
|
|
stacklevel=2)
|
|
|
|
from .streams import StreamWriter as sw
|
|
|
|
StreamWriter = sw
|
|
|
|
return StreamWriter
|
|
|
|
if name == 'StreamReaderProtocol':
|
|
|
|
warnings.warn("Using asyncio internal class StreamReaderProtocol "
|
|
|
|
"is deprecated since Python 3.8 "
|
|
|
|
" and scheduled for removal "
|
|
|
|
"in Python 3.10",
|
|
|
|
DeprecationWarning,
|
|
|
|
stacklevel=2)
|
|
|
|
from .streams import StreamReaderProtocol as srp
|
|
|
|
StreamReaderProtocol = srp
|
|
|
|
return StreamReaderProtocol
|
|
|
|
|
|
|
|
raise AttributeError(f"module {__name__} has no attribute {name}")
|