This commit is contained in:
Iliyan Angelov
2025-12-01 06:50:10 +02:00
parent 91f51bc6fe
commit 62c1fe5951
4682 changed files with 544807 additions and 31208 deletions

View File

@@ -1,9 +1,9 @@
from __future__ import annotations as _annotations
import warnings
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING, Any, Literal
from typing_extensions import Literal, deprecated
from typing_extensions import deprecated
from .._internal import _config
from ..warnings import PydanticDeprecatedSince20
@@ -18,10 +18,10 @@ __all__ = 'BaseConfig', 'Extra'
class _ConfigMetaclass(type):
def __getattr__(self, item: str) -> Any:
warnings.warn(_config.DEPRECATION_MESSAGE, DeprecationWarning)
try:
return _config.config_defaults[item]
obj = _config.config_defaults[item]
warnings.warn(_config.DEPRECATION_MESSAGE, DeprecationWarning)
return obj
except KeyError as exc:
raise AttributeError(f"type object '{self.__name__}' has no attribute {exc}") from exc
@@ -35,9 +35,10 @@ class BaseConfig(metaclass=_ConfigMetaclass):
"""
def __getattr__(self, item: str) -> Any:
warnings.warn(_config.DEPRECATION_MESSAGE, DeprecationWarning)
try:
return super().__getattribute__(item)
obj = super().__getattribute__(item)
warnings.warn(_config.DEPRECATION_MESSAGE, DeprecationWarning)
return obj
except AttributeError as exc:
try:
return getattr(type(self), item)