Coverage for Lib/asyncio/__init__.py: 100%

27 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-04-15 02:02 +0000

1"""The asyncio package, tracking PEP 3156.""" 

2 

3# flake8: noqa 

4 

5import sys 

6 

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 cover 

45 from .windows_events import * 

46 __all__ += windows_events.__all__ 

47else: 

48 from .unix_events import * # pragma: no cover 

49 __all__ += unix_events.__all__ 

50 

51def __getattr__(name: str): 

52 import warnings 

53 

54 deprecated = { 

55 "AbstractEventLoopPolicy", 

56 "DefaultEventLoopPolicy", 

57 "WindowsSelectorEventLoopPolicy", 

58 "WindowsProactorEventLoopPolicy", 

59 } 

60 if name in deprecated: 

61 warnings._deprecated(f"asyncio.{name}", remove=(3, 16)) 

62 # deprecated things have underscores in front of them 

63 return globals()["_" + name] 

64 

65 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")