From babe718ed2cf9afbed42b9ad790063ea6e6b8f5c Mon Sep 17 00:00:00 2001 From: LIU ZHE YOU Date: Wed, 4 Mar 2026 16:15:39 +0800 Subject: [PATCH 1/4] Remove inline mypy ignore comment Initial plan --- task-sdk/src/airflow/sdk/io/path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/task-sdk/src/airflow/sdk/io/path.py b/task-sdk/src/airflow/sdk/io/path.py index cf78bb4ebc6be..383d9a49a49b1 100644 --- a/task-sdk/src/airflow/sdk/io/path.py +++ b/task-sdk/src/airflow/sdk/io/path.py @@ -117,7 +117,7 @@ def __init__( self._conn_id = storage_options.pop("conn_id", None) super().__init__(*args, protocol=protocol, **storage_options) - @classmethod_or_method # type: ignore[arg-type] + @classmethod_or_method def _from_upath(cls_or_self, upath, /): """Wrap a UPath, propagating conn_id from the calling instance.""" is_instance = isinstance(cls_or_self, ObjectStoragePath) From 24d16b0170df22f3e2eadae48272bc4725e9b611 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 08:45:22 +0000 Subject: [PATCH 2/4] Fix mypy error for ObjectStoragePath._from_upath by aliasing classmethod_or_method to classmethod under TYPE_CHECKING Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> --- task-sdk/src/airflow/sdk/io/path.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/task-sdk/src/airflow/sdk/io/path.py b/task-sdk/src/airflow/sdk/io/path.py index 383d9a49a49b1..41de3d8761ff8 100644 --- a/task-sdk/src/airflow/sdk/io/path.py +++ b/task-sdk/src/airflow/sdk/io/path.py @@ -23,7 +23,7 @@ from fsspec.utils import stringify_path from upath import UPath -from upath.extensions import ProxyUPath, classmethod_or_method +from upath.extensions import ProxyUPath from airflow.sdk.io.stat import stat_result from airflow.sdk.io.store import attach @@ -33,6 +33,10 @@ from typing_extensions import Self from upath.types import JoinablePathLike + _classmethod_or_method = classmethod +else: + from upath.extensions import classmethod_or_method as _classmethod_or_method + class _TrackingFileWrapper: """Wrapper that tracks file operations to intercept lineage.""" @@ -117,7 +121,7 @@ def __init__( self._conn_id = storage_options.pop("conn_id", None) super().__init__(*args, protocol=protocol, **storage_options) - @classmethod_or_method + @_classmethod_or_method def _from_upath(cls_or_self, upath, /): """Wrap a UPath, propagating conn_id from the calling instance.""" is_instance = isinstance(cls_or_self, ObjectStoragePath) From dff42c7b867827e0f64a17b14f4031b9df53d258 Mon Sep 17 00:00:00 2001 From: "Jason(Zhe-You) Liu" <68415893+jason810496@users.noreply.github.com> Date: Wed, 11 Mar 2026 15:39:41 +0800 Subject: [PATCH 3/4] Move classmethod_or_method runtime import to top level Keep the runtime import at top level instead of behind an if/else TYPE_CHECKING block, which is more conventional and easier to read. The TYPE_CHECKING override still aliases _classmethod_or_method to classmethod for mypy. Co-authored-by: Cursor Agent Co-authored-by: Jason(Zhe-You) Liu --- task-sdk/src/airflow/sdk/io/path.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/task-sdk/src/airflow/sdk/io/path.py b/task-sdk/src/airflow/sdk/io/path.py index 41de3d8761ff8..a6dafab22a1b0 100644 --- a/task-sdk/src/airflow/sdk/io/path.py +++ b/task-sdk/src/airflow/sdk/io/path.py @@ -23,7 +23,7 @@ from fsspec.utils import stringify_path from upath import UPath -from upath.extensions import ProxyUPath +from upath.extensions import ProxyUPath, classmethod_or_method as _classmethod_or_method from airflow.sdk.io.stat import stat_result from airflow.sdk.io.store import attach @@ -34,8 +34,6 @@ from upath.types import JoinablePathLike _classmethod_or_method = classmethod -else: - from upath.extensions import classmethod_or_method as _classmethod_or_method class _TrackingFileWrapper: From f7919ab215fd717b315e695093ae7c9892c44d83 Mon Sep 17 00:00:00 2001 From: LIU ZHE YOU Date: Thu, 12 Mar 2026 10:38:05 +0800 Subject: [PATCH 4/4] Fix mypy error at top-level import --- task-sdk/src/airflow/sdk/io/path.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/task-sdk/src/airflow/sdk/io/path.py b/task-sdk/src/airflow/sdk/io/path.py index a6dafab22a1b0..ef045cf542e9b 100644 --- a/task-sdk/src/airflow/sdk/io/path.py +++ b/task-sdk/src/airflow/sdk/io/path.py @@ -23,7 +23,12 @@ from fsspec.utils import stringify_path from upath import UPath -from upath.extensions import ProxyUPath, classmethod_or_method as _classmethod_or_method +from upath.extensions import ProxyUPath, classmethod_or_method + +if TYPE_CHECKING: + _classmethod_or_method = classmethod +else: + _classmethod_or_method = classmethod_or_method from airflow.sdk.io.stat import stat_result from airflow.sdk.io.store import attach @@ -33,8 +38,6 @@ from typing_extensions import Self from upath.types import JoinablePathLike - _classmethod_or_method = classmethod - class _TrackingFileWrapper: """Wrapper that tracks file operations to intercept lineage."""