codekingpro/portable-devtools
114k
1"""The asyncio package, tracking PEP 3156."""2 3# flake8: noqa4 5import sys6 7# This relies on each of the submodules having an __all__ variable.8from .base_events import *9from .coroutines import *10from .events import *11from .exceptions import *12from .futures import *13from .graph import *14from .locks import *15from .protocols import *16from .runners import *17from .queues import *18from .streams import *19from .subprocess import *20from .tasks import *21from .taskgroups import *22from .timeouts import *23from .threads import *24from .transports import *25 26__all__ = (base_events.__all__ +27 coroutines.__all__ +28 events.__all__ +29 exceptions.__all__ +30 futures.__all__ +31 graph.__all__ +32 locks.__all__ +33 protocols.__all__ +34 runners.__all__ +35 queues.__all__ +36 streams.__all__ +37 subprocess.__all__ +38 tasks.__all__ +39 taskgroups.__all__ +40 threads.__all__ +41 timeouts.__all__ +42 transports.__all__)43 44if sys.platform == 'win32': # pragma: no cover45 from .windows_events import *46 __all__ += windows_events.__all__47else:48 from .unix_events import * # pragma: no cover49 __all__ += unix_events.__all__50 51def __getattr__(name: str):52 import warnings53 54 match name:55 case "AbstractEventLoopPolicy":56 warnings._deprecated(f"asyncio.{name}", remove=(3, 16))57 return events._AbstractEventLoopPolicy58 case "DefaultEventLoopPolicy":59 warnings._deprecated(f"asyncio.{name}", remove=(3, 16))60 if sys.platform == 'win32':61 return windows_events._DefaultEventLoopPolicy62 return unix_events._DefaultEventLoopPolicy63 case "WindowsSelectorEventLoopPolicy":64 if sys.platform == 'win32':65 warnings._deprecated(f"asyncio.{name}", remove=(3, 16))66 return windows_events._WindowsSelectorEventLoopPolicy67 # Else fall through to the AttributeError below.68 case "WindowsProactorEventLoopPolicy":69 if sys.platform == 'win32':70 warnings._deprecated(f"asyncio.{name}", remove=(3, 16))71 return windows_events._WindowsProactorEventLoopPolicy72 # Else fall through to the AttributeError below.73 74 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")75 