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,5 +1,5 @@
# sqlalchemy/inspect.py
# Copyright (C) 2005-2023 the SQLAlchemy authors and contributors
# inspection.py
# Copyright (C) 2005-2025 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
@@ -74,8 +74,7 @@ class _InspectableTypeProtocol(Protocol[_TCov]):
"""
def _sa_inspect_type(self) -> _TCov:
...
def _sa_inspect_type(self) -> _TCov: ...
class _InspectableProtocol(Protocol[_TCov]):
@@ -84,35 +83,31 @@ class _InspectableProtocol(Protocol[_TCov]):
"""
def _sa_inspect_instance(self) -> _TCov:
...
def _sa_inspect_instance(self) -> _TCov: ...
@overload
def inspect(
subject: Type[_InspectableTypeProtocol[_IN]], raiseerr: bool = True
) -> _IN:
...
) -> _IN: ...
@overload
def inspect(subject: _InspectableProtocol[_IN], raiseerr: bool = True) -> _IN:
...
def inspect(
subject: _InspectableProtocol[_IN], raiseerr: bool = True
) -> _IN: ...
@overload
def inspect(subject: Inspectable[_IN], raiseerr: bool = True) -> _IN:
...
def inspect(subject: Inspectable[_IN], raiseerr: bool = True) -> _IN: ...
@overload
def inspect(subject: Any, raiseerr: Literal[False] = ...) -> Optional[Any]:
...
def inspect(subject: Any, raiseerr: Literal[False] = ...) -> Optional[Any]: ...
@overload
def inspect(subject: Any, raiseerr: bool = True) -> Any:
...
def inspect(subject: Any, raiseerr: bool = True) -> Any: ...
def inspect(subject: Any, raiseerr: bool = True) -> Any:
@@ -162,9 +157,7 @@ def _inspects(
def decorate(fn_or_cls: _F) -> _F:
for type_ in types:
if type_ in _registrars:
raise AssertionError(
"Type %s is already " "registered" % type_
)
raise AssertionError("Type %s is already registered" % type_)
_registrars[type_] = fn_or_cls
return fn_or_cls
@@ -176,6 +169,6 @@ _TT = TypeVar("_TT", bound="Type[Any]")
def _self_inspects(cls: _TT) -> _TT:
if cls in _registrars:
raise AssertionError("Type %s is already " "registered" % cls)
raise AssertionError("Type %s is already registered" % cls)
_registrars[cls] = True
return cls