From b8f337a452fcb92d17b2c3764c251a31cc87af8b Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 11 Jan 2023 16:01:11 +0100 Subject: [PATCH] SQLAlchemy: Annotate text() (#9498) --- stubs/SQLAlchemy/sqlalchemy/sql/elements.pyi | 5 +++-- stubs/SQLAlchemy/sqlalchemy/sql/expression.pyi | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/elements.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/elements.pyi index 367827958..89463124b 100644 --- a/stubs/SQLAlchemy/sqlalchemy/sql/elements.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/sql/elements.pyi @@ -1,3 +1,4 @@ +from _typeshed import Incomplete, Self from typing import Any, Generic, TypeVar from typing_extensions import Literal @@ -136,8 +137,8 @@ class TextClause( def __and__(self, other): ... key: Any text: Any - def __init__(self, text, bind: Any | None = ...): ... - def bindparams(self, *binds, **names_to_values) -> None: ... + def __init__(self, text: str, bind: Incomplete | None = None) -> None: ... + def bindparams(self: Self, *binds, **names_to_values) -> Self: ... def columns(self, *cols, **types): ... @property def type(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/expression.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/expression.pyi index 8364b0e69..44ca4b6ed 100644 --- a/stubs/SQLAlchemy/sqlalchemy/sql/expression.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/sql/expression.pyi @@ -163,7 +163,9 @@ lateral: Incomplete or_: Incomplete bindparam: Incomplete select: Incomplete -text: Incomplete + +def text(text: str, bind: Incomplete | None = None) -> TextClause: ... + table: Incomplete column: Incomplete over: Incomplete