This is an automated email from the ASF dual-hosted git repository.

vincbeck pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new e0648f93e33 fix: MyPy type errors in pool.py (#57810)
e0648f93e33 is described below

commit e0648f93e33a7563cdb4eb3a3e553cb3ce7e714d
Author: Henry Chen <[email protected]>
AuthorDate: Thu Nov 6 23:24:36 2025 +0800

    fix: MyPy type errors in pool.py (#57810)
---
 airflow-core/src/airflow/models/pool.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/airflow-core/src/airflow/models/pool.py 
b/airflow-core/src/airflow/models/pool.py
index f39e540df5d..477c9c9b3e2 100644
--- a/airflow-core/src/airflow/models/pool.py
+++ b/airflow-core/src/airflow/models/pool.py
@@ -17,6 +17,7 @@
 # under the License.
 from __future__ import annotations
 
+from collections.abc import Sequence
 from typing import TYPE_CHECKING, Any, TypedDict
 
 from sqlalchemy import Boolean, ForeignKey, Integer, String, Text, func, select
@@ -33,7 +34,9 @@ from airflow.utils.sqlalchemy import mapped_column, 
with_row_locks
 from airflow.utils.state import TaskInstanceState
 
 if TYPE_CHECKING:
+    from sqlalchemy.orm import Query
     from sqlalchemy.orm.session import Session
+    from sqlalchemy.sql import Select
 
 
 class PoolStats(TypedDict):
@@ -67,7 +70,7 @@ class Pool(Base):
 
     @staticmethod
     @provide_session
-    def get_pools(session: Session = NEW_SESSION) -> list[Pool]:
+    def get_pools(session: Session = NEW_SESSION) -> Sequence[Pool]:
         """Get all pools."""
         return session.scalars(select(Pool)).all()
 
@@ -173,7 +176,7 @@ class Pool(Base):
         pools: dict[str, PoolStats] = {}
         pool_includes_deferred: dict[str, bool] = {}
 
-        query = select(Pool.pool, Pool.slots, Pool.include_deferred)
+        query: Select[Any] | Query[Any] = select(Pool.pool, Pool.slots, 
Pool.include_deferred)
 
         if lock_rows:
             query = with_row_locks(query, session=session, nowait=True)

Reply via email to