Coverage for pydantic/error_wrappers.py: 100.00%

Shortcuts on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

88 statements  

1import json linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

2from typing import TYPE_CHECKING, Any, Dict, Generator, List, Optional, Sequence, Tuple, Type, Union linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

3 

4from .json import pydantic_encoder linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

5from .utils import Representation linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

6 

7if TYPE_CHECKING: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

8 from typing_extensions import TypedDict 

9 

10 from .config import BaseConfig 

11 from .types import ModelOrDc 

12 from .typing import ReprArgs 

13 

14 Loc = Tuple[Union[int, str], ...] 

15 

16 class _ErrorDictRequired(TypedDict): 

17 loc: Loc 

18 msg: str 

19 type: str 

20 

21 class ErrorDict(_ErrorDictRequired, total=False): 

22 ctx: Dict[str, Any] 

23 

24 

25__all__ = 'ErrorWrapper', 'ValidationError' linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

26 

27 

28class ErrorWrapper(Representation): linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

29 __slots__ = 'exc', '_loc' linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

30 

31 def __init__(self, exc: Exception, loc: Union[str, 'Loc']) -> None: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

32 self.exc = exc linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

33 self._loc = loc linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

34 

35 def loc_tuple(self) -> 'Loc': linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

36 if isinstance(self._loc, tuple): linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

37 return self._loc linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

38 else: 

39 return (self._loc,) linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

40 

41 def __repr_args__(self) -> 'ReprArgs': linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

42 return [('exc', self.exc), ('loc', self.loc_tuple())] linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

43 

44 

45# ErrorList is something like Union[List[Union[List[ErrorWrapper], ErrorWrapper]], ErrorWrapper] 

46# but recursive, therefore just use: 

47ErrorList = Union[Sequence[Any], ErrorWrapper] linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

48 

49 

50class ValidationError(Representation, ValueError): linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

51 __slots__ = 'raw_errors', 'model', '_error_cache' linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

52 

53 def __init__(self, errors: Sequence[ErrorList], model: 'ModelOrDc') -> None: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

54 self.raw_errors = errors linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

55 self.model = model linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

56 self._error_cache: Optional[List['ErrorDict']] = None linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

57 

58 def errors(self) -> List['ErrorDict']: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

59 if self._error_cache is None: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

60 try: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

61 config = self.model.__config__ # type: ignore linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

62 except AttributeError: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

63 config = self.model.__pydantic_model__.__config__ # type: ignore linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

64 self._error_cache = list(flatten_errors(self.raw_errors, config)) linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

65 return self._error_cache linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

66 

67 def json(self, *, indent: Union[None, int, str] = 2) -> str: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

68 return json.dumps(self.errors(), indent=indent, default=pydantic_encoder) linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

69 

70 def __str__(self) -> str: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

71 errors = self.errors() linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

72 no_errors = len(errors) linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

73 return ( linux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.8macos-py3.9macos-py3.10windows-py3.8windows-py3.9windows-py3.10

74 f'{no_errors} validation error{"" if no_errors == 1 else "s"} for {self.model.__name__}\n' 

75 f'{display_errors(errors)}' 

76 ) 

77 

78 def __repr_args__(self) -> 'ReprArgs': linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

79 return [('model', self.model.__name__), ('errors', self.errors())] linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

80 

81 

82def display_errors(errors: List['ErrorDict']) -> str: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

83 return '\n'.join(f'{_display_error_loc(e)}\n {e["msg"]} ({_display_error_type_and_ctx(e)})' for e in errors) linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

84 

85 

86def _display_error_loc(error: 'ErrorDict') -> str: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

87 return ' -> '.join(str(e) for e in error['loc']) linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

88 

89 

90def _display_error_type_and_ctx(error: 'ErrorDict') -> str: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

91 t = 'type=' + error['type'] linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

92 ctx = error.get('ctx') linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

93 if ctx: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

94 return t + ''.join(f'; {k}={v}' for k, v in ctx.items()) linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

95 else: 

96 return t linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

97 

98 

99def flatten_errors( linux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.8macos-py3.9macos-py3.10windows-py3.8windows-py3.9windows-py3.10

100 errors: Sequence[Any], config: Type['BaseConfig'], loc: Optional['Loc'] = None 

101) -> Generator['ErrorDict', None, None]: 

102 for error in errors: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

103 if isinstance(error, ErrorWrapper): linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

104 

105 if loc: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

106 error_loc = loc + error.loc_tuple() linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

107 else: 

108 error_loc = error.loc_tuple() linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

109 

110 if isinstance(error.exc, ValidationError): linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

111 yield from flatten_errors(error.exc.raw_errors, config, error_loc) linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

112 else: 

113 yield error_dict(error.exc, config, error_loc) linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

114 elif isinstance(error, list): linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

115 yield from flatten_errors(error, config, loc=loc) linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

116 else: 

117 raise RuntimeError(f'Unknown error object: {error}') linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

118 

119 

120def error_dict(exc: Exception, config: Type['BaseConfig'], loc: 'Loc') -> 'ErrorDict': linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

121 type_ = get_exc_type(exc.__class__) linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

122 msg_template = config.error_msg_templates.get(type_) or getattr(exc, 'msg_template', None) linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

123 ctx = exc.__dict__ linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

124 if msg_template: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

125 msg = msg_template.format(**ctx) linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

126 else: 

127 msg = str(exc) linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

128 

129 d: 'ErrorDict' = {'loc': loc, 'msg': msg, 'type': type_} linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

130 

131 if ctx: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

132 d['ctx'] = ctx linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

133 

134 return d linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

135 

136 

137_EXC_TYPE_CACHE: Dict[Type[Exception], str] = {} linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

138 

139 

140def get_exc_type(cls: Type[Exception]) -> str: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

141 # slightly more efficient than using lru_cache since we don't need to worry about the cache filling up 

142 try: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

143 return _EXC_TYPE_CACHE[cls] linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

144 except KeyError: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

145 r = _get_exc_type(cls) linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

146 _EXC_TYPE_CACHE[cls] = r linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

147 return r linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

148 

149 

150def _get_exc_type(cls: Type[Exception]) -> str: linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yeslinux-py3.10-mypy0.910linux-py3.10-mypy0.920linux-py3.10-mypy0.921macos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

151 if issubclass(cls, AssertionError): linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

152 return 'assertion_error' linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

153 

154 base_name = 'type_error' if issubclass(cls, TypeError) else 'value_error' linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

155 if cls in (TypeError, ValueError): linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

156 # just TypeError or ValueError, no extra code 

157 return base_name linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

158 

159 # if it's not a TypeError or ValueError, we just take the lowercase of the exception name 

160 # no chaining or snake case logic, use "code" for more complex error types. 

161 code = getattr(cls, 'code', None) or cls.__name__.replace('Error', '').lower() linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10

162 return base_name + '.' + code linux-py3.7-compiled-no-deps-nolinux-py3.7-compiled-yes-deps-nolinux-py3.7-compiled-yes-deps-yeslinux-py3.8-compiled-no-deps-nolinux-py3.8-compiled-yes-deps-nolinux-py3.8-compiled-yes-deps-yeslinux-py3.9-compiled-no-deps-nolinux-py3.9-compiled-yes-deps-nolinux-py3.9-compiled-yes-deps-yeslinux-py3.10-compiled-no-deps-nolinux-py3.10-compiled-yes-deps-nolinux-py3.10-compiled-yes-deps-yesmacos-py3.7macos-py3.8macos-py3.9macos-py3.10windows-py3.7windows-py3.8windows-py3.9windows-py3.10