Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update providers to use functools compat for cached_property #24582

Merged
merged 1 commit into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions airflow/providers/alibaba/cloud/log/oss_task_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@
import contextlib
import os
import pathlib
import sys

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

from airflow.compat.functools import cached_property
from airflow.configuration import conf
from airflow.providers.alibaba.cloud.hooks.oss import OSSHook
from airflow.utils.log.file_task_handler import FileTaskHandler
Expand Down
7 changes: 1 addition & 6 deletions airflow/providers/alibaba/cloud/sensors/oss_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,11 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import sys

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

from typing import TYPE_CHECKING, Optional, Sequence
from urllib.parse import urlparse

from airflow.compat.functools import cached_property
from airflow.exceptions import AirflowException
from airflow.providers.alibaba.cloud.hooks.oss import OSSHook
from airflow.sensors.base import BaseSensorOperator
Expand Down
7 changes: 1 addition & 6 deletions airflow/providers/amazon/aws/hooks/glue_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import sys
import warnings
from time import sleep

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

from airflow.compat.functools import cached_property
from airflow.exceptions import AirflowException
from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook

Expand Down
7 changes: 1 addition & 6 deletions airflow/providers/amazon/aws/hooks/quicksight.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,15 @@
# specific language governing permissions and limitations
# under the License.

import sys
import time

from botocore.exceptions import ClientError

from airflow import AirflowException
from airflow.compat.functools import cached_property
from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
from airflow.providers.amazon.aws.hooks.sts import StsHook

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property


class QuickSightHook(AwsBaseHook):
"""
Expand Down
7 changes: 1 addition & 6 deletions airflow/providers/amazon/aws/hooks/redshift_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,16 @@
# specific language governing permissions and limitations
# under the License.

import sys
from typing import Dict, List, Optional, Union

import redshift_connector
from redshift_connector import Connection as RedshiftConnection
from sqlalchemy import create_engine
from sqlalchemy.engine.url import URL

from airflow.compat.functools import cached_property
from airflow.hooks.dbapi import DbApiHook

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property


class RedshiftSQLHook(DbApiHook):
"""
Expand Down
7 changes: 1 addition & 6 deletions airflow/providers/amazon/aws/log/cloudwatch_task_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import sys
from datetime import datetime
from typing import Optional

import watchtower

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

from airflow.compat.functools import cached_property
from airflow.configuration import conf
from airflow.utils.log.file_task_handler import FileTaskHandler
from airflow.utils.log.logging_mixin import LoggingMixin
Expand Down
7 changes: 1 addition & 6 deletions airflow/providers/amazon/aws/log/s3_task_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,9 @@
# under the License.
import os
import pathlib
import sys
from typing import Optional

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

from airflow.compat.functools import cached_property
from airflow.configuration import conf
from airflow.utils.log.file_task_handler import FileTaskHandler
from airflow.utils.log.logging_mixin import LoggingMixin
Expand Down
7 changes: 1 addition & 6 deletions airflow/providers/amazon/aws/operators/athena.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,10 @@
# specific language governing permissions and limitations
# under the License.
#
import sys
import warnings
from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

from airflow.compat.functools import cached_property
from airflow.models import BaseOperator
from airflow.providers.amazon.aws.hooks.athena import AthenaHook

Expand Down
12 changes: 2 additions & 10 deletions airflow/providers/amazon/aws/operators/emr.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,19 @@
# specific language governing permissions and limitations
# under the License.
import ast
import sys
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Union
from uuid import uuid4

from airflow.compat.functools import cached_property
from airflow.exceptions import AirflowException
from airflow.models import BaseOperator
from airflow.providers.amazon.aws.hooks.emr import EmrHook
from airflow.providers.amazon.aws.hooks.emr import EmrContainerHook, EmrHook
from airflow.providers.amazon.aws.links.emr import EmrClusterLink

if TYPE_CHECKING:
from airflow.utils.context import Context


if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

from airflow.providers.amazon.aws.hooks.emr import EmrContainerHook


class EmrAddStepsOperator(BaseOperator):
"""
An operator that adds steps to an existing EMR job_flow.
Expand Down
8 changes: 1 addition & 7 deletions airflow/providers/amazon/aws/operators/glue_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,13 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import sys
import warnings
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from airflow.utils.context import Context


if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

from airflow.compat.functools import cached_property
from airflow.models import BaseOperator
from airflow.providers.amazon.aws.hooks.glue_crawler import GlueCrawlerHook

Expand Down
8 changes: 1 addition & 7 deletions airflow/providers/amazon/aws/operators/redshift_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

import sys
from time import sleep
from typing import TYPE_CHECKING, Any, Dict, Optional

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

from airflow.compat.functools import cached_property
from airflow.models import BaseOperator
from airflow.providers.amazon.aws.hooks.redshift_data import RedshiftDataHook

Expand Down
7 changes: 1 addition & 6 deletions airflow/providers/amazon/aws/operators/sagemaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,16 @@
# under the License.

import json
import sys
from typing import TYPE_CHECKING, Any, List, Optional, Sequence

from botocore.exceptions import ClientError

from airflow.compat.functools import cached_property
from airflow.exceptions import AirflowException
from airflow.models import BaseOperator
from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
from airflow.providers.amazon.aws.hooks.sagemaker import SageMakerHook

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

if TYPE_CHECKING:
from airflow.utils.context import Context

Expand Down
8 changes: 1 addition & 7 deletions airflow/providers/amazon/aws/secrets/secrets_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,14 @@
import ast
import json
import re
import sys
import warnings
from typing import Optional
from urllib.parse import urlencode

import boto3

from airflow.compat.functools import cached_property
from airflow.providers.amazon.aws.utils import get_airflow_version

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

from airflow.secrets import BaseSecretsBackend
from airflow.utils.log.logging_mixin import LoggingMixin

Expand Down
8 changes: 1 addition & 7 deletions airflow/providers/amazon/aws/secrets/systems_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,13 @@
# under the License.
"""Objects relating to sourcing connections from AWS SSM Parameter Store"""
import re
import sys
import warnings
from typing import Optional

import boto3

from airflow.compat.functools import cached_property
from airflow.providers.amazon.aws.utils import get_airflow_version

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

from airflow.secrets import BaseSecretsBackend
from airflow.utils.log.logging_mixin import LoggingMixin

Expand Down
7 changes: 1 addition & 6 deletions airflow/providers/amazon/aws/sensors/athena.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import sys
from typing import TYPE_CHECKING, Any, Optional, Sequence

if TYPE_CHECKING:
from airflow.utils.context import Context

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

from airflow.compat.functools import cached_property
from airflow.exceptions import AirflowException
from airflow.providers.amazon.aws.hooks.athena import AthenaHook
from airflow.sensors.base import BaseSensorOperator
Expand Down
7 changes: 1 addition & 6 deletions airflow/providers/amazon/aws/sensors/cloud_formation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,12 @@
# specific language governing permissions and limitations
# under the License.
"""This module contains sensors for AWS CloudFormation."""
import sys
from typing import TYPE_CHECKING, Optional, Sequence

if TYPE_CHECKING:
from airflow.utils.context import Context

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

from airflow.compat.functools import cached_property
from airflow.providers.amazon.aws.hooks.cloud_formation import CloudFormationHook
from airflow.sensors.base import BaseSensorOperator

Expand Down
8 changes: 1 addition & 7 deletions airflow/providers/amazon/aws/sensors/emr.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,12 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import sys
from typing import TYPE_CHECKING, Any, Dict, Iterable, Optional, Sequence

if TYPE_CHECKING:
from airflow.utils.context import Context


if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

from airflow.compat.functools import cached_property
from airflow.exceptions import AirflowException
from airflow.providers.amazon.aws.hooks.emr import EmrContainerHook, EmrHook
from airflow.sensors.base import BaseSensorOperator
Expand Down
7 changes: 1 addition & 6 deletions airflow/providers/amazon/aws/sensors/quicksight.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
# specific language governing permissions and limitations
# under the License.

import sys
from typing import TYPE_CHECKING, Optional

from airflow.compat.functools import cached_property
from airflow.exceptions import AirflowException
from airflow.providers.amazon.aws.hooks.quicksight import QuickSightHook
from airflow.providers.amazon.aws.hooks.sts import StsHook
Expand All @@ -27,11 +27,6 @@
if TYPE_CHECKING:
from airflow.utils.context import Context

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property


class QuickSightSensor(BaseSensorOperator):
"""
Expand Down
8 changes: 1 addition & 7 deletions airflow/providers/amazon/aws/sensors/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,14 @@
import fnmatch
import os
import re
import sys
import warnings
from datetime import datetime
from typing import TYPE_CHECKING, Callable, List, Optional, Sequence, Set, Union

if TYPE_CHECKING:
from airflow.utils.context import Context


if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

from airflow.compat.functools import cached_property
from airflow.exceptions import AirflowException
from airflow.providers.amazon.aws.hooks.s3 import S3Hook
from airflow.sensors.base import BaseSensorOperator, poke_mode_only
Expand Down
Loading