From 1905167de97928fcbf80b262af7dabd3fb229c14 Mon Sep 17 00:00:00 2001 From: Pavan Kumar Date: Wed, 9 Jul 2025 13:06:27 +0100 Subject: [PATCH] Make amazon provider compatible with mypy 1.16.1 --- .../providers/amazon/aws/hooks/redshift_cluster.py | 8 ++++---- .../tests/unit/amazon/aws/utils/eks_test_constants.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/providers/amazon/src/airflow/providers/amazon/aws/hooks/redshift_cluster.py b/providers/amazon/src/airflow/providers/amazon/aws/hooks/redshift_cluster.py index eff7af4caf519..62b4700d17866 100644 --- a/providers/amazon/src/airflow/providers/amazon/aws/hooks/redshift_cluster.py +++ b/providers/amazon/src/airflow/providers/amazon/aws/hooks/redshift_cluster.py @@ -77,7 +77,7 @@ def create_cluster( return response # TODO: Wrap create_cluster_snapshot - def cluster_status(self, cluster_identifier: str) -> str: + def cluster_status(self, cluster_identifier: str) -> Any | None: """ Get status of a cluster. @@ -92,7 +92,7 @@ def cluster_status(self, cluster_identifier: str) -> str: except self.conn.exceptions.ClusterNotFoundFault: return "cluster_not_found" - async def cluster_status_async(self, cluster_identifier: str) -> str: + async def cluster_status_async(self, cluster_identifier: str) -> Any | None: async with await self.get_async_conn() as client: response = await client.describe_clusters(ClusterIdentifier=cluster_identifier) return response["Clusters"][0]["ClusterStatus"] if response else None @@ -139,7 +139,7 @@ def describe_cluster_snapshots(self, cluster_identifier: str) -> list[str] | Non snapshots.sort(key=lambda x: x["SnapshotCreateTime"], reverse=True) return snapshots - def restore_from_cluster_snapshot(self, cluster_identifier: str, snapshot_identifier: str) -> str: + def restore_from_cluster_snapshot(self, cluster_identifier: str, snapshot_identifier: str) -> Any | None: """ Restore a cluster from its snapshot. @@ -160,7 +160,7 @@ def create_cluster_snapshot( cluster_identifier: str, retention_period: int = -1, tags: list[Any] | None = None, - ) -> str: + ) -> Any | None: """ Create a snapshot of a cluster. diff --git a/providers/amazon/tests/unit/amazon/aws/utils/eks_test_constants.py b/providers/amazon/tests/unit/amazon/aws/utils/eks_test_constants.py index e65c5cadf8765..559529cf5511b 100644 --- a/providers/amazon/tests/unit/amazon/aws/utils/eks_test_constants.py +++ b/providers/amazon/tests/unit/amazon/aws/utils/eks_test_constants.py @@ -135,8 +135,8 @@ class NodegroupInputs: class PossibleTestResults(Enum): """Possible test results.""" - SUCCESS: str = "SUCCESS" - FAILURE: str = "FAILURE" + SUCCESS = "SUCCESS" + FAILURE = "FAILURE" class ClusterAttributes: