__init__.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. """The asyncio package, tracking PEP 3156."""
  2. import sys
  3. # The selectors module is in the stdlib in Python 3.4 but not in 3.3.
  4. # Do this first, so the other submodules can use "from . import selectors".
  5. # Prefer asyncio/selectors.py over the stdlib one, as ours may be newer.
  6. try:
  7. from . import selectors
  8. except ImportError:
  9. import selectors # Will also be exported.
  10. if sys.platform == 'win32':
  11. # Similar thing for _overlapped.
  12. try:
  13. from . import _overlapped
  14. except ImportError:
  15. import _overlapped # Will also be exported.
  16. # This relies on each of the submodules having an __all__ variable.
  17. from .base_events import *
  18. from .coroutines import *
  19. from .events import *
  20. from .futures import *
  21. from .locks import *
  22. from .protocols import *
  23. from .queues import *
  24. from .streams import *
  25. from .subprocess import *
  26. from .tasks import *
  27. from .transports import *
  28. __all__ = (base_events.__all__ +
  29. coroutines.__all__ +
  30. events.__all__ +
  31. futures.__all__ +
  32. locks.__all__ +
  33. protocols.__all__ +
  34. queues.__all__ +
  35. streams.__all__ +
  36. subprocess.__all__ +
  37. tasks.__all__ +
  38. transports.__all__)
  39. if sys.platform == 'win32': # pragma: no cover
  40. from .windows_events import *
  41. __all__ += windows_events.__all__
  42. else:
  43. from .unix_events import * # pragma: no cover
  44. __all__ += unix_events.__all__