From ceec98e1d4d24389b10b3a26a693e94ddb70d65e Mon Sep 17 00:00:00 2001 From: Martijn Pieters Date: Mon, 17 Apr 2023 19:24:57 -0400 Subject: Define type hints for remaining column operators Added typing information for recently added operators :meth:`.ColumnOperators.icontains`, :meth:`.ColumnOperators.istartswith`, :meth:`.ColumnOperators.iendswith`, and bitwise operators :meth:`.ColumnOperators.bitwise_and`, :meth:`.ColumnOperators.bitwise_or`, :meth:`.ColumnOperators.bitwise_xor`, :meth:`.ColumnOperators.bitwise_not`, :meth:`.ColumnOperators.bitwise_lshift` :meth:`.ColumnOperators.bitwise_rshift`. Pull request courtesy Martijn Pieters. Fixes: #9650 Closes: #9652 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9652 Pull-request-sha: 005c56848af8cff6bb19f71541873027f141eb6e Change-Id: I2fa06eb42ce668df9d9c760d233906f87484dd12 --- lib/sqlalchemy/sql/elements.py | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 0f356ae27..b32201c7f 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -833,6 +833,12 @@ class SQLCoreOperations(Generic[_T], ColumnOperators, TypingOnly): def __getitem__(self, index: Any) -> ColumnElement[Any]: ... + def __lshift__(self, other: Any) -> ColumnElement[Any]: + ... + + def __rshift__(self, other: Any) -> ColumnElement[Any]: + ... + @overload def concat(self: _SQO[str], other: Any) -> ColumnElement[str]: ... @@ -854,6 +860,24 @@ class SQLCoreOperations(Generic[_T], ColumnOperators, TypingOnly): ) -> BinaryExpression[bool]: ... + def bitwise_xor(self, other: Any) -> BinaryExpression[Any]: + ... + + def bitwise_or(self, other: Any) -> BinaryExpression[Any]: + ... + + def bitwise_and(self, other: Any) -> BinaryExpression[Any]: + ... + + def bitwise_not(self) -> UnaryExpression[_T]: + ... + + def bitwise_lshift(self, other: Any) -> BinaryExpression[Any]: + ... + + def bitwise_rshift(self, other: Any) -> BinaryExpression[Any]: + ... + def in_( self, other: Union[ @@ -915,6 +939,14 @@ class SQLCoreOperations(Generic[_T], ColumnOperators, TypingOnly): ) -> ColumnElement[bool]: ... + def istartswith( + self, + other: Any, + escape: Optional[str] = None, + autoescape: bool = False, + ) -> ColumnElement[bool]: + ... + def endswith( self, other: Any, @@ -923,9 +955,20 @@ class SQLCoreOperations(Generic[_T], ColumnOperators, TypingOnly): ) -> ColumnElement[bool]: ... + def iendswith( + self, + other: Any, + escape: Optional[str] = None, + autoescape: bool = False, + ) -> ColumnElement[bool]: + ... + def contains(self, other: Any, **kw: Any) -> ColumnElement[bool]: ... + def icontains(self, other: Any, **kw: Any) -> ColumnElement[bool]: + ... + def match(self, other: Any, **kwargs: Any) -> ColumnElement[bool]: ... -- cgit v1.2.1