1
1
import sys
2
- from typing import Any , Dict , List , Optional , TypedDict , Union
2
+ from typing import Any , TypedDict
3
3
4
4
from pydantic_core ._types import Config , Schema
5
5
@@ -12,39 +12,37 @@ __all__ = '__version__', 'SchemaValidator', 'SchemaError', 'ValidationError', 'P
12
12
__version__ : str
13
13
14
14
class SchemaValidator :
15
- def __init__ (self , schema : Schema , config : Optional [ Config ] = None ) -> None : ...
16
- def validate_python (self , input : Any , strict : Optional [ bool ] = None , context : Any = None ) -> Any : ...
17
- def isinstance_python (self , input : Any , strict : Optional [ bool ] = None , context : Any = None ) -> bool : ...
15
+ def __init__ (self , schema : Schema , config : ' Config | None' = None ) -> None : ...
16
+ def validate_python (self , input : Any , strict : ' bool | None' = None , context : Any = None ) -> Any : ...
17
+ def isinstance_python (self , input : Any , strict : ' bool | None' = None , context : Any = None ) -> bool : ...
18
18
def validate_json (
19
- self , input : Union [ str , bytes , bytearray ] , strict : Optional [ bool ] = None , context : Any = None
19
+ self , input : ' str | bytes | bytearray' , strict : ' bool | None' = None , context : Any = None
20
20
) -> Any : ...
21
21
def isinstance_json (
22
- self , input : Union [ str , bytes , bytearray ] , strict : Optional [ bool ] = None , context : Any = None
22
+ self , input : ' str | bytes | bytearray' , strict : ' bool | None' = None , context : Any = None
23
23
) -> bool : ...
24
- def validate_assignment (self , field : str , input : Any , data : Dict [str , Any ]) -> Dict [str , Any ]: ...
24
+ def validate_assignment (self , field : str , input : Any , data : 'dict [str, Any]' ) -> 'dict [str, Any]' : ...
25
25
26
26
class SchemaError (Exception ):
27
27
pass
28
28
29
29
class ErrorDetails (TypedDict ):
30
30
kind : str
31
- loc : List [ Union [ int , str ]]
31
+ loc : 'list[ int | str]'
32
32
message : str
33
33
input_value : Any
34
- context : NotRequired [Dict [str , Any ]]
34
+ context : NotRequired ['dict [str, Any]' ]
35
35
36
36
class ValidationError (ValueError ):
37
37
title : str
38
38
39
39
def error_count (self ) -> int : ...
40
- def errors (self ) -> List [ErrorDetails ]: ...
40
+ def errors (self ) -> 'list [ErrorDetails]' : ...
41
41
42
42
class PydanticValueError (ValueError ):
43
43
kind : str
44
44
message_template : str
45
- context : Optional [ Dict [ str , Union [ str , int ]]]
45
+ context : 'dict[ str, str | int] | None'
46
46
47
- def __init__ (
48
- self , kind : str , message_template : str , context : Optional [Dict [str , Union [str , int ]]] = None
49
- ) -> None : ...
47
+ def __init__ (self , kind : str , message_template : str , context : 'dict[str, str | int] | None' = None ) -> None : ...
50
48
def message (self ) -> str : ...
0 commit comments