|
1 | 1 | """Logic for V1 validators, e.g. `@validator` and `@root_validator`."""
|
| 2 | + |
2 | 3 | from __future__ import annotations as _annotations
|
3 | 4 |
|
4 | 5 | from inspect import Parameter, signature
|
|
14 | 15 | class V1OnlyValueValidator(Protocol):
|
15 | 16 | """A simple validator, supported for V1 validators and V2 validators."""
|
16 | 17 |
|
17 |
| - def __call__(self, __value: Any) -> Any: |
18 |
| - ... |
| 18 | + def __call__(self, __value: Any) -> Any: ... |
19 | 19 |
|
20 | 20 |
|
21 | 21 | class V1ValidatorWithValues(Protocol):
|
22 | 22 | """A validator with `values` argument, supported for V1 validators and V2 validators."""
|
23 | 23 |
|
24 |
| - def __call__(self, __value: Any, values: dict[str, Any]) -> Any: |
25 |
| - ... |
| 24 | + def __call__(self, __value: Any, values: dict[str, Any]) -> Any: ... |
26 | 25 |
|
27 | 26 |
|
28 | 27 | class V1ValidatorWithValuesKwOnly(Protocol):
|
29 | 28 | """A validator with keyword only `values` argument, supported for V1 validators and V2 validators."""
|
30 | 29 |
|
31 |
| - def __call__(self, __value: Any, *, values: dict[str, Any]) -> Any: |
32 |
| - ... |
| 30 | + def __call__(self, __value: Any, *, values: dict[str, Any]) -> Any: ... |
33 | 31 |
|
34 | 32 |
|
35 | 33 | class V1ValidatorWithKwargs(Protocol):
|
36 | 34 | """A validator with `kwargs` argument, supported for V1 validators and V2 validators."""
|
37 | 35 |
|
38 |
| - def __call__(self, __value: Any, **kwargs: Any) -> Any: |
39 |
| - ... |
| 36 | + def __call__(self, __value: Any, **kwargs: Any) -> Any: ... |
40 | 37 |
|
41 | 38 |
|
42 | 39 | class V1ValidatorWithValuesAndKwargs(Protocol):
|
43 | 40 | """A validator with `values` and `kwargs` arguments, supported for V1 validators and V2 validators."""
|
44 | 41 |
|
45 |
| - def __call__(self, __value: Any, values: dict[str, Any], **kwargs: Any) -> Any: |
46 |
| - ... |
| 42 | + def __call__(self, __value: Any, values: dict[str, Any], **kwargs: Any) -> Any: ... |
47 | 43 |
|
48 | 44 |
|
49 | 45 | V1Validator = Union[
|
@@ -117,24 +113,21 @@ def wrapper2(value: Any, _: core_schema.ValidationInfo) -> Any:
|
117 | 113 | class V1RootValidatorFunction(Protocol):
|
118 | 114 | """A simple root validator, supported for V1 validators and V2 validators."""
|
119 | 115 |
|
120 |
| - def __call__(self, __values: RootValidatorValues) -> RootValidatorValues: |
121 |
| - ... |
| 116 | + def __call__(self, __values: RootValidatorValues) -> RootValidatorValues: ... |
122 | 117 |
|
123 | 118 |
|
124 | 119 | class V2CoreBeforeRootValidator(Protocol):
|
125 | 120 | """V2 validator with mode='before'."""
|
126 | 121 |
|
127 |
| - def __call__(self, __values: RootValidatorValues, __info: core_schema.ValidationInfo) -> RootValidatorValues: |
128 |
| - ... |
| 122 | + def __call__(self, __values: RootValidatorValues, __info: core_schema.ValidationInfo) -> RootValidatorValues: ... |
129 | 123 |
|
130 | 124 |
|
131 | 125 | class V2CoreAfterRootValidator(Protocol):
|
132 | 126 | """V2 validator with mode='after'."""
|
133 | 127 |
|
134 | 128 | def __call__(
|
135 | 129 | self, __fields_tuple: RootValidatorFieldsTuple, __info: core_schema.ValidationInfo
|
136 |
| - ) -> RootValidatorFieldsTuple: |
137 |
| - ... |
| 130 | + ) -> RootValidatorFieldsTuple: ... |
138 | 131 |
|
139 | 132 |
|
140 | 133 | def make_v1_generic_root_validator(
|
|
0 commit comments