This is an automated email from the ASF dual-hosted git repository.
pierrejeambrun 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 a14cd327c4d fix MyPy type errors in common (#56807)
a14cd327c4d is described below
commit a14cd327c4d023f3ea08291b92d058e80dfaf348
Author: rich7420 <[email protected]>
AuthorDate: Fri Oct 24 22:49:07 2025 +0800
fix MyPy type errors in common (#56807)
* fix MyPy type errors in common
* use cast to remove comment
* fix ruff error
* remove extra modification
---
airflow-core/src/airflow/api_fastapi/common/db/common.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/airflow-core/src/airflow/api_fastapi/common/db/common.py
b/airflow-core/src/airflow/api_fastapi/common/db/common.py
index b129aae6130..e738a3fb758 100644
--- a/airflow-core/src/airflow/api_fastapi/common/db/common.py
+++ b/airflow-core/src/airflow/api_fastapi/common/db/common.py
@@ -22,7 +22,7 @@ Database helpers for Airflow REST API.
from __future__ import annotations
-from collections.abc import Sequence
+from collections.abc import AsyncGenerator, Generator, Sequence
from typing import TYPE_CHECKING, Annotated, Literal, overload
from fastapi import Depends
@@ -38,7 +38,7 @@ if TYPE_CHECKING:
from airflow.api_fastapi.core_api.base import OrmClause
-def _get_session() -> Session:
+def _get_session() -> Generator[Session, None, None]:
with create_session(scoped=False) as session:
yield session
@@ -59,7 +59,7 @@ def apply_filters_to_select(
return statement
-async def _get_async_session() -> AsyncSession:
+async def _get_async_session() -> AsyncGenerator[AsyncSession, None]:
async with create_session_async() as session:
yield session