Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/blinker/__init__.py: 62%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

24 statements  

1from __future__ import annotations 

2 

3import typing as t 

4 

5from .base import ANY 

6from .base import default_namespace 

7from .base import NamedSignal 

8from .base import Namespace 

9from .base import Signal 

10from .base import signal 

11 

12__all__ = [ 

13 "ANY", 

14 "default_namespace", 

15 "NamedSignal", 

16 "Namespace", 

17 "Signal", 

18 "signal", 

19] 

20 

21 

22def __getattr__(name: str) -> t.Any: 

23 import warnings 

24 

25 if name == "__version__": 

26 import importlib.metadata 

27 

28 warnings.warn( 

29 "The '__version__' attribute is deprecated and will be removed in" 

30 " Blinker 1.9.0. Use feature detection or" 

31 " 'importlib.metadata.version(\"blinker\")' instead.", 

32 DeprecationWarning, 

33 stacklevel=2, 

34 ) 

35 return importlib.metadata.version("blinker") 

36 

37 if name == "receiver_connected": 

38 from .base import _receiver_connected 

39 

40 warnings.warn( 

41 "The global 'receiver_connected' signal is deprecated and will be" 

42 " removed in Blinker 1.9. Use 'Signal.receiver_connected' and" 

43 " 'Signal.receiver_disconnected' instead.", 

44 DeprecationWarning, 

45 stacklevel=2, 

46 ) 

47 return _receiver_connected 

48 

49 if name == "WeakNamespace": 

50 from .base import _WeakNamespace 

51 

52 warnings.warn( 

53 "'WeakNamespace' is deprecated and will be removed in Blinker 1.9." 

54 " Use 'Namespace' instead.", 

55 DeprecationWarning, 

56 stacklevel=2, 

57 ) 

58 return _WeakNamespace 

59 

60 raise AttributeError(name)