mirror of
https://github.com/fastapi/sqlmodel.git
synced 2026-03-13 09:29:54 +08:00
⬆️ Add support for Python 3.14 (#1578)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0cbf2e6049
commit
45215fceca
@@ -1,3 +1,4 @@
|
||||
import sys
|
||||
import types
|
||||
from contextlib import contextmanager
|
||||
from contextvars import ContextVar
|
||||
@@ -123,7 +124,20 @@ if IS_PYDANTIC_V2:
|
||||
object.__setattr__(new_object, "__pydantic_private__", None)
|
||||
|
||||
def get_annotations(class_dict: Dict[str, Any]) -> Dict[str, Any]:
|
||||
return class_dict.get("__annotations__", {}) # type: ignore[no-any-return]
|
||||
raw_annotations: Dict[str, Any] = class_dict.get("__annotations__", {})
|
||||
if sys.version_info >= (3, 14) and "__annotations__" not in class_dict:
|
||||
# See https://github.com/pydantic/pydantic/pull/11991
|
||||
from annotationlib import (
|
||||
Format,
|
||||
call_annotate_function,
|
||||
get_annotate_from_class_namespace,
|
||||
)
|
||||
|
||||
if annotate := get_annotate_from_class_namespace(class_dict):
|
||||
raw_annotations = call_annotate_function(
|
||||
annotate, format=Format.FORWARDREF
|
||||
)
|
||||
return raw_annotations
|
||||
|
||||
def is_table_model_class(cls: Type[Any]) -> bool:
|
||||
config = getattr(cls, "model_config", {})
|
||||
|
||||
Reference in New Issue
Block a user