You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2021/12/19 10:48:32 UTC
[airflow] branch main updated: Fix mypy errors in providers/amazon/aws/operators (#20401)
This is an automated email from the ASF dual-hosted git repository.
potiuk 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 1f4710f Fix mypy errors in providers/amazon/aws/operators (#20401)
1f4710f is described below
commit 1f4710f16af725f45cd7b90fb1311b4b80e4cc29
Author: Kanthi <su...@gmail.com>
AuthorDate: Sun Dec 19 05:48:08 2021 -0500
Fix mypy errors in providers/amazon/aws/operators (#20401)
---
airflow/providers/amazon/aws/operators/dms.py | 8 ++++----
airflow/providers/amazon/aws/operators/eks.py | 6 +++---
airflow/providers/amazon/aws/operators/emr.py | 5 +++--
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/airflow/providers/amazon/aws/operators/dms.py b/airflow/providers/amazon/aws/operators/dms.py
index f50bc1f..e753f1a 100644
--- a/airflow/providers/amazon/aws/operators/dms.py
+++ b/airflow/providers/amazon/aws/operators/dms.py
@@ -17,7 +17,7 @@
# under the License.
-from typing import Optional
+from typing import Dict, Optional
from airflow.models import BaseOperator
from airflow.providers.amazon.aws.hooks.dms import DmsHook
@@ -133,7 +133,7 @@ class DmsDeleteTaskOperator(BaseOperator):
template_fields = ('replication_task_arn',)
template_ext = ()
- template_fields_renderers = {}
+ template_fields_renderers: Dict[str, str] = {}
def __init__(
self,
@@ -173,7 +173,7 @@ class DmsDescribeTasksOperator(BaseOperator):
template_fields = ('describe_tasks_kwargs',)
template_ext = ()
- template_fields_renderers = {'describe_tasks_kwargs': 'json'}
+ template_fields_renderers: Dict[str, str] = {'describe_tasks_kwargs': 'json'}
def __init__(
self,
@@ -275,7 +275,7 @@ class DmsStopTaskOperator(BaseOperator):
template_fields = ('replication_task_arn',)
template_ext = ()
- template_fields_renderers = {}
+ template_fields_renderers: Dict[str, str] = {}
def __init__(
self,
diff --git a/airflow/providers/amazon/aws/operators/eks.py b/airflow/providers/amazon/aws/operators/eks.py
index 8aeb6f8..cca03d5 100644
--- a/airflow/providers/amazon/aws/operators/eks.py
+++ b/airflow/providers/amazon/aws/operators/eks.py
@@ -635,9 +635,9 @@ class EKSPodOperator(KubernetesPodOperator):
# file is stored locally in the worker and not in the cluster.
in_cluster: bool = False,
namespace: str = DEFAULT_NAMESPACE_NAME,
- pod_context: str = None,
- pod_name: str = None,
- pod_username: str = None,
+ pod_context: Optional[str] = None,
+ pod_name: Optional[str] = None,
+ pod_username: Optional[str] = None,
aws_conn_id: str = DEFAULT_CONN_ID,
region: Optional[str] = None,
**kwargs,
diff --git a/airflow/providers/amazon/aws/operators/emr.py b/airflow/providers/amazon/aws/operators/emr.py
index fdf41dd..407dbd8 100644
--- a/airflow/providers/amazon/aws/operators/emr.py
+++ b/airflow/providers/amazon/aws/operators/emr.py
@@ -16,6 +16,7 @@
# specific language governing permissions and limitations
# under the License.
import ast
+import sys
from datetime import datetime
from typing import Any, Dict, List, Optional, Union
from uuid import uuid4
@@ -24,9 +25,9 @@ from airflow.exceptions import AirflowException
from airflow.models import BaseOperator, BaseOperatorLink, TaskInstance
from airflow.providers.amazon.aws.hooks.emr import EmrHook
-try:
+if sys.version_info >= (3, 8):
from functools import cached_property
-except ImportError:
+else:
from cached_property import cached_property
from airflow.providers.amazon.aws.hooks.emr_containers import EMRContainerHook