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

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

18 statements  

1__all__ = [ 

2 "BaseExceptionGroup", 

3 "ExceptionGroup", 

4 "catch", 

5 "format_exception", 

6 "format_exception_only", 

7 "print_exception", 

8 "print_exc", 

9 "suppress", 

10] 

11 

12import os 

13import sys 

14 

15from ._catch import catch 

16from ._version import version as __version__ # noqa: F401 

17 

18if sys.version_info < (3, 11): 

19 from ._exceptions import BaseExceptionGroup, ExceptionGroup 

20 from ._formatting import ( 

21 format_exception, 

22 format_exception_only, 

23 print_exc, 

24 print_exception, 

25 ) 

26 

27 if os.getenv("EXCEPTIONGROUP_NO_PATCH") != "1": 

28 from . import _formatting # noqa: F401 

29 

30 BaseExceptionGroup.__module__ = __name__ 

31 ExceptionGroup.__module__ = __name__ 

32else: 

33 from traceback import ( 

34 format_exception, 

35 format_exception_only, 

36 print_exc, 

37 print_exception, 

38 ) 

39 

40 BaseExceptionGroup = BaseExceptionGroup 

41 ExceptionGroup = ExceptionGroup 

42 

43if sys.version_info < (3, 12, 1): 

44 from ._suppress import suppress 

45else: 

46 from contextlib import suppress