API refactor
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-07 16:25:52 +09:00
parent 76d0d86211
commit 91c7e04474
1171 changed files with 81940 additions and 44117 deletions

View File

@@ -1,8 +1,6 @@
import sys
import warnings
from typing import Any, Callable, Dict
from typing import Any, Callable
from ._internal._validators import import_string
from .version import version_short
MOVED_IN_V2 = {
@@ -273,7 +271,11 @@ def getattr_migration(module: str) -> Callable[[str], Any]:
The object.
"""
if name == '__path__':
raise AttributeError(f'module {__name__!r} has no attribute {name!r}')
raise AttributeError(f'module {module!r} has no attribute {name!r}')
import warnings
from ._internal._validators import import_string
import_path = f'{module}:{name}'
if import_path in MOVED_IN_V2.keys():
@@ -298,9 +300,9 @@ def getattr_migration(module: str) -> Callable[[str], Any]:
)
if import_path in REMOVED_IN_V2:
raise PydanticImportError(f'`{import_path}` has been removed in V2.')
globals: Dict[str, Any] = sys.modules[module].__dict__
globals: dict[str, Any] = sys.modules[module].__dict__
if name in globals:
return globals[name]
raise AttributeError(f'module {__name__!r} has no attribute {name!r}')
raise AttributeError(f'module {module!r} has no attribute {name!r}')
return wrapper