kaxil commented on code in PR #52664:
URL: https://github.com/apache/airflow/pull/52664#discussion_r2178347814
##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/version_compat.py:
##########
@@ -33,3 +33,30 @@ def get_base_airflow_version_tuple() -> tuple[int, int, int]:
AIRFLOW_V_3_0_PLUS = get_base_airflow_version_tuple() >= (3, 0, 0)
+AIRFLOW_V_3_1_PLUS = get_base_airflow_version_tuple() >= (3, 1, 0)
+
+if AIRFLOW_V_3_1_PLUS:
+ from airflow.sdk import BaseOperator
+else:
+ from airflow.models import BaseOperator # type: ignore[no-redef]
+
+if AIRFLOW_V_3_0_PLUS:
+ from airflow.sdk import BaseSensorOperator
+ from airflow.sdk.bases.decorator import DecoratedOperator, TaskDecorator,
task_decorator_factory
+else:
+ from airflow.decorators.base import ( # type: ignore[no-redef]
+ DecoratedOperator,
+ TaskDecorator,
+ task_decorator_factory,
+ )
+
+ from airflow.sensors.base import BaseSensorOperator # type:
ignore[no-redef]
+
+__all__ = [
+ "AIRFLOW_V_3_0_PLUS",
+ "BaseOperator",
Review Comment:
```suggestion
"AIRFLOW_V_3_0_PLUS",
"AIRFLOW_V_3_1_PLUS",
"BaseOperator",
```
--
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]