amoghrajesh commented on code in PR #52565:
URL: https://github.com/apache/airflow/pull/52565#discussion_r2174986984


##########
providers/papermill/src/airflow/providers/papermill/operators/papermill.py:
##########
@@ -24,17 +24,16 @@
 import attr
 import papermill as pm
 
-from airflow.models import BaseOperator
 from airflow.providers.common.compat.lineage.entities import File
 from airflow.providers.common.compat.version_compat import AIRFLOW_V_3_0_PLUS
 from airflow.providers.papermill.hooks.kernel import REMOTE_KERNEL_ENGINE, 
KernelHook
+from airflow.providers.papermill.version_compat import BaseOperator
 
 if TYPE_CHECKING:
-    try:
+    if AIRFLOW_V_3_0_PLUS:
         from airflow.sdk.definitions.context import Context
-    except ImportError:
-        # TODO: Remove once provider drops support for Airflow 2
-        from airflow.utils.context import Context
+    else:
+        from airflow.utils.context import Context  # type: ignore[no-redef]

Review Comment:
   Technically the try / catch here is right. 
   
   I think we should enforce a general pattern over here, the 3.0 / 3.1 check 
was relevant for BaseOperator mainly due to a 3.1 xcom bug in decorators.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to