]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add type annotations to postgresql's Any() and All()
authorDenis Laxalde <denis@laxalde.org>
Fri, 28 Feb 2025 12:01:35 +0000 (13:01 +0100)
committerDenis Laxalde <denis@laxalde.org>
Thu, 13 Mar 2025 20:03:27 +0000 (21:03 +0100)
lib/sqlalchemy/dialects/postgresql/array.py

index 814586efe2b6ebb73476fbc0e0990502e02bfb02..af3c386af17eaa56f9e318e6d370915d58c635ed 100644 (file)
@@ -4,7 +4,6 @@
 #
 # This module is part of SQLAlchemy and is released under
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
-# mypy: ignore-errors
 
 
 from __future__ import annotations
@@ -29,6 +28,7 @@ from ...sql import operators
 
 if TYPE_CHECKING:
     from ...engine.interfaces import Dialect
+    from ...sql._typing import _ColumnExpressionArgument
     from ...sql._typing import _TypeEngineArgument
     from ...sql.elements import ColumnElement
     from ...sql.elements import Grouping
@@ -45,22 +45,30 @@ if TYPE_CHECKING:
 _T = TypeVar("_T", bound=typing_Any)
 
 
-def Any(other, arrexpr, operator=operators.eq):
+def Any(
+    other: typing_Any,
+    arrexpr: _ColumnExpressionArgument[_T],
+    operator: OperatorType = operators.eq,
+) -> ColumnElement[bool]:
     """A synonym for the ARRAY-level :meth:`.ARRAY.Comparator.any` method.
     See that method for details.
 
     """
 
-    return arrexpr.any(other, operator)
+    return arrexpr.any(other, operator)  # type: ignore[no-any-return, union-attr]  # noqa: E501
 
 
-def All(other, arrexpr, operator=operators.eq):
+def All(
+    other: typing_Any,
+    arrexpr: _ColumnExpressionArgument[_T],
+    operator: OperatorType = operators.eq,
+) -> ColumnElement[bool]:
     """A synonym for the ARRAY-level :meth:`.ARRAY.Comparator.all` method.
     See that method for details.
 
     """
 
-    return arrexpr.all(other, operator)
+    return arrexpr.all(other, operator)  # type: ignore[no-any-return, union-attr]  # noqa: E501
 
 
 class array(expression.ExpressionClauseList[_T]):