|
|
@ -1,6 +1,6 @@ |
|
|
import re |
|
|
import re |
|
|
import warnings |
|
|
import warnings |
|
|
from collections.abc import Callable, Sequence |
|
|
from collections.abc import Sequence |
|
|
from copy import copy |
|
|
from copy import copy |
|
|
from dataclasses import dataclass, is_dataclass |
|
|
from dataclasses import dataclass, is_dataclass |
|
|
from enum import Enum |
|
|
from enum import Enum |
|
|
@ -40,17 +40,18 @@ RequiredParam = PydanticUndefined |
|
|
Undefined = PydanticUndefined |
|
|
Undefined = PydanticUndefined |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def define_forwardref() -> Callable[..., Any]: |
|
|
def evaluate_forwardref( |
|
|
|
|
|
value: Any, |
|
|
|
|
|
globalns: dict[str, Any] | None = None, |
|
|
|
|
|
localns: dict[str, Any] | None = None, |
|
|
|
|
|
) -> Any: |
|
|
# eval_type_lenient has been deprecated since Pydantic v2.10.0b1 (PR #10530) |
|
|
# eval_type_lenient has been deprecated since Pydantic v2.10.0b1 (PR #10530) |
|
|
try_eval_type = getattr(_pydantic_typing_extra, "try_eval_type", None) |
|
|
try_eval_type = getattr(_pydantic_typing_extra, "try_eval_type", None) |
|
|
if try_eval_type is not None: |
|
|
if try_eval_type is not None: |
|
|
return lambda *args: try_eval_type(*args)[0] |
|
|
return try_eval_type(value, globalns, localns)[0] |
|
|
return ( |
|
|
return _pydantic_typing_extra.eval_type_lenient( # ty: ignore[deprecated] |
|
|
_pydantic_typing_extra.eval_type_lenient |
|
|
value, globalns, localns |
|
|
) # pragma: no cover # ty: ignore[deprecated] |
|
|
) # pragma: no cover |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
evaluate_forwardref = define_forwardref() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GenerateJsonSchema(_GenerateJsonSchema): |
|
|
class GenerateJsonSchema(_GenerateJsonSchema): |
|
|
|