Skip to content

Commit 6c3a53f

Browse files
committed
chore: ♻️ Make linter happy again
1 parent 4e7b0ff commit 6c3a53f

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

pydantic_async_validation/mixins.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import ClassVar, List, Tuple, Union, cast
1+
from typing import ClassVar, List, Tuple, Union
22

33
import pydantic
44
from pydantic_core import InitErrorDetails, PydanticCustomError, ValidationError
@@ -91,10 +91,7 @@ async def extend_with_validation_errors_by(
9191
validation_errors.extend(
9292
prefix_errors(
9393
prefix,
94-
cast(
95-
List[InitErrorDetails],
96-
O_o.errors(),
97-
),
94+
O_o.errors(),
9895
),
9996
)
10097

pydantic_async_validation/utils.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def generic_model_validator_wrapper(
164164

165165
def prefix_errors(
166166
prefix: Tuple[Union[int, str], ...],
167-
errors: List[Union[InitErrorDetails, ErrorDetails]],
167+
errors: Union[List[InitErrorDetails], List[ErrorDetails]],
168168
) -> List[InitErrorDetails]:
169169
"""
170170
Extend all errors passed as list to include an additional prefix.
@@ -180,7 +180,14 @@ def prefix_errors(
180180
# Original data is ErrorDetails, we need to convert it back to
181181
# InitErrorDetails
182182
**error,
183-
'type': PydanticCustomError(error['type'], error['msg']),
183+
'type': (
184+
PydanticCustomError(
185+
error['type'],
186+
cast(ErrorDetails, error)['msg'],
187+
)
188+
if isinstance(error['type'], str)
189+
else error['type']
190+
),
184191
'loc': (*prefix, *error['loc']),
185192
},
186193
)

0 commit comments

Comments
 (0)