Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/wrapt/exceptions.py: 100%

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

13 statements  

1"""Exception types raised by wrapt.""" 

2 

3 

4class WrapperNotInitializedError(ValueError): 

5 """ 

6 Exception raised when a wrapper is in an inconsistent state: __init__ was 

7 called but __wrapped__ is not set. Inherits from ValueError only, so it is 

8 not silently swallowed by hasattr/getattr/except AttributeError patterns. 

9 """ 

10 

11 pass 

12 

13 

14class PathResolutionError(AttributeError): 

15 """ 

16 Exception raised when the dotted attribute path supplied for a patch 

17 target could not be resolved. Inherits from AttributeError so existing 

18 code catching that continues to work, while the message carries the 

19 target, the full dotted path, and the failing segment, and the low-level 

20 error is preserved as __cause__. 

21 """ 

22 

23 pass 

24 

25 

26class TargetModuleNotFoundError(ModuleNotFoundError): 

27 """ 

28 Exception raised when a patch target supplied as a string named a module 

29 that could not be imported. Inherits from ModuleNotFoundError so existing 

30 code catching that, or ImportError, continues to work, while the message 

31 names the module and the attribute path being resolved, and the low-level 

32 error is preserved as __cause__. 

33 """ 

34 

35 pass 

36 

37 

38class WrapperChainTooDeepError(RuntimeError): 

39 """ 

40 Exception raised when a scan of a chain of wrappers reached the traversal 

41 limit with a further link still pending, so the result of the scan would 

42 be indeterminate. Inherits from RuntimeError, following the precedent of 

43 RecursionError for exhaustion of a depth limit, as it reports an 

44 execution limit rather than a contract violation. 

45 """ 

46 

47 pass 

48 

49 

50class WrapperNotFoundError(ValueError): 

51 """ 

52 Exception raised when the wrapper to be removed was not found in the 

53 chain of wrappers of the attribute, meaning nothing of the caller's is 

54 installed there: it was never wrapped, was already removed, or the 

55 attribute was replaced wholesale by a third party. 

56 """ 

57 

58 pass 

59 

60 

61class WrapperNotOutermostError(ValueError): 

62 """ 

63 Exception raised when the wrapper to be removed was found but cannot be 

64 removed, because what sits directly above it in the chain is not a wrapt 

65 wrapper whose link to it can be updated in place, or because the 

66 attribute is served dynamically and has no owning location to restore. 

67 """ 

68 

69 pass