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 2022/06/29 03:55:05 UTC

[airflow] branch main updated: Use our yaml util in all providers (#24720)

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 45b11d4ed1 Use our yaml util in all providers (#24720)
45b11d4ed1 is described below

commit 45b11d4ed1412c00ebf32a03ab5ea3a06274f208
Author: Jed Cunningham <66...@users.noreply.github.com>
AuthorDate: Tue Jun 28 21:54:44 2022 -0600

    Use our yaml util in all providers (#24720)
    
    Our yaml util, which uses libyaml where possible, has been available in
    core since 2.0.2. Providers now require 2.2.0+, so we can safely use it
    now.
---
 airflow/providers/amazon/aws/hooks/eks.py               | 2 +-
 airflow/providers/cncf/kubernetes/hooks/kubernetes.py   | 9 ++-------
 airflow/providers/google/cloud/operators/cloud_build.py | 2 +-
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/airflow/providers/amazon/aws/hooks/eks.py b/airflow/providers/amazon/aws/hooks/eks.py
index d2a795e498..298d9f641e 100644
--- a/airflow/providers/amazon/aws/hooks/eks.py
+++ b/airflow/providers/amazon/aws/hooks/eks.py
@@ -26,11 +26,11 @@ from enum import Enum
 from functools import partial
 from typing import Callable, Dict, Generator, List, Optional
 
-import yaml
 from botocore.exceptions import ClientError
 from botocore.signers import RequestSigner
 
 from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
+from airflow.utils import yaml
 from airflow.utils.json import AirflowJsonEncoder
 
 DEFAULT_PAGINATION_TOKEN = ''
diff --git a/airflow/providers/cncf/kubernetes/hooks/kubernetes.py b/airflow/providers/cncf/kubernetes/hooks/kubernetes.py
index ed794cd553..5752de5041 100644
--- a/airflow/providers/cncf/kubernetes/hooks/kubernetes.py
+++ b/airflow/providers/cncf/kubernetes/hooks/kubernetes.py
@@ -22,15 +22,10 @@ from kubernetes import client, config, watch
 from kubernetes.config import ConfigException
 
 from airflow.compat.functools import cached_property
-from airflow.kubernetes.kube_client import _disable_verify_ssl, _enable_tcp_keepalive
-
-try:
-    import airflow.utils.yaml as yaml
-except ImportError:
-    import yaml  # type: ignore[no-redef]
-
 from airflow.exceptions import AirflowException
 from airflow.hooks.base import BaseHook
+from airflow.kubernetes.kube_client import _disable_verify_ssl, _enable_tcp_keepalive
+from airflow.utils import yaml
 
 
 def _load_body_to_dict(body):
diff --git a/airflow/providers/google/cloud/operators/cloud_build.py b/airflow/providers/google/cloud/operators/cloud_build.py
index c377af6732..49602b39e7 100644
--- a/airflow/providers/google/cloud/operators/cloud_build.py
+++ b/airflow/providers/google/cloud/operators/cloud_build.py
@@ -24,7 +24,6 @@ from copy import deepcopy
 from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence, Tuple, Union
 from urllib.parse import unquote, urlparse
 
-import yaml
 from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
 from google.api_core.retry import Retry
 from google.cloud.devtools.cloudbuild_v1.types import Build, BuildTrigger, RepoSource
@@ -32,6 +31,7 @@ from google.cloud.devtools.cloudbuild_v1.types import Build, BuildTrigger, RepoS
 from airflow.exceptions import AirflowException
 from airflow.models import BaseOperator
 from airflow.providers.google.cloud.hooks.cloud_build import CloudBuildHook
+from airflow.utils import yaml
 
 if TYPE_CHECKING:
     from airflow.utils.context import Context