1
- from _typeshed import Incomplete , SupportsRichComparison
1
+ from _typeshed import Incomplete , SupportsRichComparison , sentinel
2
2
from collections import deque
3
- from collections .abc import Callable , Container , Iterable , Iterator , MutableMapping , Sequence
3
+ from collections .abc import Callable , Container , Iterable , Iterator , Mapping , MutableMapping , Sequence
4
+ from typing import Any
4
5
from typing_extensions import Self , TypeAlias , deprecated
5
6
6
- from jsonschema import _utils , protocols
7
- from jsonschema ._types import TypeChecker
7
+ from ._types import TypeChecker
8
+ from ._utils import Unset
9
+ from .protocols import Validator
8
10
9
11
_RelevanceFuncType : TypeAlias = Callable [[ValidationError ], SupportsRichComparison ]
10
12
@@ -19,24 +21,24 @@ class _Error(Exception):
19
21
relative_schema_path : deque [str | int ]
20
22
context : list [ValidationError ] | None
21
23
cause : Exception | None
22
- validator : protocols . Validator | None
23
- validator_value : Incomplete
24
- instance : Incomplete
25
- schema : Incomplete
24
+ validator : Validator | Unset
25
+ validator_value : Any | Unset
26
+ instance : Any | Unset
27
+ schema : Mapping [ str , Any ] | bool | Unset
26
28
parent : _Error | None
27
29
def __init__ (
28
30
self ,
29
31
message : str ,
30
- validator : _utils . Unset | None | protocols . Validator = ... ,
31
- path : Sequence [str | int ] = (),
32
- cause : Incomplete | None = None ,
32
+ validator : str | Unset = sentinel ,
33
+ path : Iterable [str | int ] = (),
34
+ cause : Exception | None = None ,
33
35
context : Sequence [ValidationError ] = (),
34
- validator_value = ... ,
35
- instance = ... ,
36
- schema = ... ,
37
- schema_path : Sequence [str | int ] = (),
36
+ validator_value : Any | Unset = sentinel ,
37
+ instance : Any | Unset = sentinel ,
38
+ schema : Mapping [ str , Any ] | bool | Unset = sentinel ,
39
+ schema_path : Iterable [str | int ] = (),
38
40
parent : _Error | None = None ,
39
- type_checker : _utils . Unset | TypeChecker = ... ,
41
+ type_checker : TypeChecker | Unset = sentinel ,
40
42
) -> None : ...
41
43
@classmethod
42
44
def create_from (cls , other : _Error ) -> Self : ...
0 commit comments