updates
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user