mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
SQLAlchemy: Remove some implementation details (#9492)
Stubs for the mypy plugin, which aren't useful if you're using typeshed's SQLAlchemy stubs, have been removed.
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from . import util
|
||||
|
||||
_AssignmentStmt: TypeAlias = Any # mypy.nodes.AssignmentStmt
|
||||
_NameExpr: TypeAlias = Any # mypy.nodes.NameExpr
|
||||
_StrExpr: TypeAlias = Any # mypy.nodes.StrExpr
|
||||
_SemanticAnalyzerPluginInterface: TypeAlias = Any # mypy.plugin.SemanticAnalyzerPluginInterface
|
||||
_ProperType: TypeAlias = Any # mypy.types.ProperType
|
||||
|
||||
def apply_mypy_mapped_attr(
|
||||
cls, api: _SemanticAnalyzerPluginInterface, item: _NameExpr | _StrExpr, attributes: list[util.SQLAlchemyAttribute]
|
||||
) -> None: ...
|
||||
def re_apply_declarative_assignments(
|
||||
cls, api: _SemanticAnalyzerPluginInterface, attributes: list[util.SQLAlchemyAttribute]
|
||||
) -> None: ...
|
||||
def apply_type_to_mapped_statement(
|
||||
api: _SemanticAnalyzerPluginInterface,
|
||||
stmt: _AssignmentStmt,
|
||||
lvalue: _NameExpr,
|
||||
left_hand_explicit_type: _ProperType | None,
|
||||
python_type_for_type: _ProperType | None,
|
||||
) -> None: ...
|
||||
def add_additional_orm_attributes(
|
||||
cls, api: _SemanticAnalyzerPluginInterface, attributes: list[util.SQLAlchemyAttribute]
|
||||
) -> None: ...
|
||||
@@ -1,10 +0,0 @@
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from . import util
|
||||
|
||||
_SemanticAnalyzerPluginInterface: TypeAlias = Any # mypy.plugin.SemanticAnalyzerPluginInterface
|
||||
|
||||
def scan_declarative_assignments_and_apply_types(
|
||||
cls, api: _SemanticAnalyzerPluginInterface, is_mixin_scan: bool = ...
|
||||
) -> list[util.SQLAlchemyAttribute] | None: ...
|
||||
@@ -1,25 +0,0 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
_AssignmentStmt: TypeAlias = Any # mypy.nodes.AssignmentStmt
|
||||
_Expression: TypeAlias = Any # mypy.nodes.Expression
|
||||
_RefExpr: TypeAlias = Any # mypy.nodes.RefExpr
|
||||
_TypeInfo: TypeAlias = Any # mypy.nodes.TypeInfo
|
||||
_Var: TypeAlias = Any # mypy.nodes.Var
|
||||
_SemanticAnalyzerPluginInterface: TypeAlias = Any # mypy.plugin.SemanticAnalyzerPluginInterface
|
||||
_ProperType: TypeAlias = Any # mypy.types.ProperType
|
||||
|
||||
def infer_type_from_right_hand_nameexpr(
|
||||
api: _SemanticAnalyzerPluginInterface,
|
||||
stmt: _AssignmentStmt,
|
||||
node: _Var,
|
||||
left_hand_explicit_type: _ProperType | None,
|
||||
infer_from_right_side: _RefExpr,
|
||||
) -> _ProperType | None: ...
|
||||
def infer_type_from_left_hand_type_only(
|
||||
api: _SemanticAnalyzerPluginInterface, node: _Var, left_hand_explicit_type: _ProperType | None
|
||||
) -> _ProperType | None: ...
|
||||
def extract_python_type_from_typeengine(
|
||||
api: _SemanticAnalyzerPluginInterface, node: _TypeInfo, type_args: Sequence[_Expression]
|
||||
) -> _ProperType: ...
|
||||
@@ -1,38 +0,0 @@
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from ...util import symbol
|
||||
|
||||
_ClassDef: TypeAlias = Any # mypy.nodes.ClassDef
|
||||
_Expression: TypeAlias = Any # mypy.nodes.Expression
|
||||
_MemberExpr: TypeAlias = Any # mypy.nodes.MemberExpr
|
||||
_NameExpr: TypeAlias = Any # mypy.nodes.NameExpr
|
||||
_SymbolNode: TypeAlias = Any # mypy.nodes.SymbolNode
|
||||
_TypeInfo: TypeAlias = Any # mypy.nodes.TypeInfo
|
||||
_SemanticAnalyzerPluginInterface: TypeAlias = Any # mypy.plugin.SemanticAnalyzerPluginInterface
|
||||
_UnboundType: TypeAlias = Any # mypy.types.UnboundType
|
||||
|
||||
COLUMN: symbol
|
||||
RELATIONSHIP: symbol
|
||||
REGISTRY: symbol
|
||||
COLUMN_PROPERTY: symbol
|
||||
TYPEENGINE: symbol
|
||||
MAPPED: symbol
|
||||
DECLARATIVE_BASE: symbol
|
||||
DECLARATIVE_META: symbol
|
||||
MAPPED_DECORATOR: symbol
|
||||
SYNONYM_PROPERTY: symbol
|
||||
COMPOSITE_PROPERTY: symbol
|
||||
DECLARED_ATTR: symbol
|
||||
MAPPER_PROPERTY: symbol
|
||||
AS_DECLARATIVE: symbol
|
||||
AS_DECLARATIVE_BASE: symbol
|
||||
DECLARATIVE_MIXIN: symbol
|
||||
QUERY_EXPRESSION: symbol
|
||||
|
||||
def has_base_type_id(info: _TypeInfo, type_id: int) -> bool: ...
|
||||
def mro_has_id(mro: list[_TypeInfo], type_id: int) -> bool: ...
|
||||
def type_id_for_unbound_type(type_: _UnboundType, cls: _ClassDef, api: _SemanticAnalyzerPluginInterface) -> int | None: ...
|
||||
def type_id_for_callee(callee: _Expression) -> int | None: ...
|
||||
def type_id_for_named_node(node: _NameExpr | _MemberExpr | _SymbolNode) -> int | None: ...
|
||||
def type_id_for_fullname(fullname: str) -> int | None: ...
|
||||
@@ -1,21 +0,0 @@
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
_MypyFile: TypeAlias = Any # mypy.nodes.MypyFile
|
||||
_AttributeContext: TypeAlias = Any # mypy.plugin.AttributeContext
|
||||
_ClassDefContext: TypeAlias = Any # mypy.plugin.ClassDefContext
|
||||
_DynamicClassDefContext: TypeAlias = Any # mypy.plugin.DynamicClassDefContext
|
||||
_Plugin: TypeAlias = Any # mypy.plugin.Plugin
|
||||
_Type: TypeAlias = Any # mypy.types.Type
|
||||
|
||||
class SQLAlchemyPlugin(_Plugin):
|
||||
def get_dynamic_class_hook(self, fullname: str) -> Callable[[_DynamicClassDefContext], None] | None: ...
|
||||
def get_customize_class_mro_hook(self, fullname: str) -> Callable[[_ClassDefContext], None] | None: ...
|
||||
def get_class_decorator_hook(self, fullname: str) -> Callable[[_ClassDefContext], None] | None: ...
|
||||
def get_metaclass_hook(self, fullname: str) -> Callable[[_ClassDefContext], None] | None: ...
|
||||
def get_base_class_hook(self, fullname: str) -> Callable[[_ClassDefContext], None] | None: ...
|
||||
def get_attribute_hook(self, fullname: str) -> Callable[[_AttributeContext], _Type] | None: ...
|
||||
def get_additional_deps(self, file: _MypyFile) -> list[tuple[int, str, int]]: ...
|
||||
|
||||
def plugin(version: str) -> type[SQLAlchemyPlugin]: ...
|
||||
@@ -1,49 +0,0 @@
|
||||
from collections.abc import Iterable, Iterator
|
||||
from typing import Any, TypeVar, overload
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
_CallExpr: TypeAlias = Any # mypy.nodes._CallExpr
|
||||
_Context: TypeAlias = Any # mypy.nodes._Context
|
||||
_Expression: TypeAlias = Any # mypy.nodes._Expression
|
||||
_JsonDict: TypeAlias = Any # mypy.nodes._JsonDict
|
||||
_NameExpr: TypeAlias = Any # mypy.nodes._NameExpr
|
||||
_Statement: TypeAlias = Any # mypy.nodes._Statement
|
||||
_TypeInfo: TypeAlias = Any # mypy.nodes._TypeInfo
|
||||
_ClassDefContext: TypeAlias = Any # mypy.plugin._ClassDefContext
|
||||
_DynamicClassDefContext: TypeAlias = Any # mypy.plugin._DynamicClassDefContext
|
||||
_SemanticAnalyzerPluginInterface: TypeAlias = Any # mypy.plugin._SemanticAnalyzerPluginInterface
|
||||
_Type: TypeAlias = Any # mypy.types._Type
|
||||
|
||||
_TArgType = TypeVar("_TArgType", bound=_CallExpr | _NameExpr)
|
||||
|
||||
class SQLAlchemyAttribute:
|
||||
name: Any
|
||||
line: Any
|
||||
column: Any
|
||||
type: Any
|
||||
info: Any
|
||||
def __init__(self, name: str, line: int, column: int, typ: _Type | None, info: _TypeInfo) -> None: ...
|
||||
def serialize(self) -> _JsonDict: ...
|
||||
def expand_typevar_from_subtype(self, sub_type: _TypeInfo) -> None: ...
|
||||
@classmethod
|
||||
def deserialize(cls, info: _TypeInfo, data: _JsonDict, api: _SemanticAnalyzerPluginInterface) -> SQLAlchemyAttribute: ...
|
||||
|
||||
def name_is_dunder(name): ...
|
||||
def establish_as_sqlalchemy(info: _TypeInfo) -> None: ...
|
||||
def set_is_base(info: _TypeInfo) -> None: ...
|
||||
def get_is_base(info: _TypeInfo) -> bool: ...
|
||||
def has_declarative_base(info: _TypeInfo) -> bool: ...
|
||||
def set_has_table(info: _TypeInfo) -> None: ...
|
||||
def get_has_table(info: _TypeInfo) -> bool: ...
|
||||
def get_mapped_attributes(info: _TypeInfo, api: _SemanticAnalyzerPluginInterface) -> list[SQLAlchemyAttribute] | None: ...
|
||||
def set_mapped_attributes(info: _TypeInfo, attributes: list[SQLAlchemyAttribute]) -> None: ...
|
||||
def fail(api: _SemanticAnalyzerPluginInterface, msg: str, ctx: _Context) -> None: ...
|
||||
def add_global(ctx: _ClassDefContext | _DynamicClassDefContext, module: str, symbol_name: str, asname: str) -> None: ...
|
||||
@overload
|
||||
def get_callexpr_kwarg(callexpr: _CallExpr, name: str, *, expr_types: None = ...) -> _CallExpr | _NameExpr | None: ...
|
||||
@overload
|
||||
def get_callexpr_kwarg(callexpr: _CallExpr, name: str, *, expr_types: tuple[type[_TArgType], ...]) -> _TArgType | None: ...
|
||||
def flatten_typechecking(stmts: Iterable[_Statement]) -> Iterator[_Statement]: ...
|
||||
def unbound_to_instance(api: _SemanticAnalyzerPluginInterface, typ: _Type) -> _Type: ...
|
||||
def info_for_cls(cls, api: _SemanticAnalyzerPluginInterface) -> _TypeInfo | None: ...
|
||||
def expr_to_mapped_constructor(expr: _Expression) -> _CallExpr: ...
|
||||
@@ -1,19 +1,10 @@
|
||||
import asyncio as asyncio
|
||||
from collections.abc import Callable, Coroutine
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .langhelpers import memoized_property
|
||||
|
||||
_Greenlet: TypeAlias = Any # actually greenlet.greenlet
|
||||
|
||||
def is_exit_exception(e): ...
|
||||
|
||||
class _AsyncIoGreenlet(_Greenlet):
|
||||
driver: Any
|
||||
gr_context: Any
|
||||
def __init__(self, fn, driver) -> None: ...
|
||||
|
||||
def await_only(awaitable: Coroutine[Any, Any, Any]) -> Any: ...
|
||||
def await_fallback(awaitable: Coroutine[Any, Any, Any]) -> Any: ...
|
||||
async def greenlet_spawn(fn: Callable[..., Any], *args, _require_await: bool = ..., **kwargs) -> Any: ...
|
||||
|
||||
Reference in New Issue
Block a user