make mypy happy

This commit is contained in:
svlandeg 2026-03-12 22:35:11 +01:00
parent a1abbce3a5
commit 97ce5de0bf
1 changed files with 11 additions and 6 deletions

View File

@ -1,6 +1,6 @@
import re
import warnings
from collections.abc import Sequence
from collections.abc import Callable, Sequence
from copy import copy
from dataclasses import dataclass, is_dataclass
from enum import Enum
@ -39,11 +39,16 @@ from pydantic_core.core_schema import (
RequiredParam = PydanticUndefined
Undefined = PydanticUndefined
# eval_type_lenient has been deprecated since Pydantic v2.10.0b1 (PR #10530)
evaluate_forwardref = getattr(_pydantic_typing_extra, "try_eval_type", None)
if evaluate_forwardref is None:
evaluate_forwardref = _pydantic_typing_extra.eval_type_lenient
assert evaluate_forwardref is not None
def define_forwardref() -> Callable[..., Any]:
# eval_type_lenient has been deprecated since Pydantic v2.10.0b1 (PR #10530)
eval_type = getattr(_pydantic_typing_extra, "try_eval_type", None)
if eval_type is not None:
return cast(Callable[..., Any], eval_type)
return _pydantic_typing_extra.eval_type_lenient
evaluate_forwardref = define_forwardref()
class GenerateJsonSchema(_GenerateJsonSchema):