Skip to content

Commit e7bb17a

Browse files
authored
Use built-in cached_property on Python 3.8 where possible (#14606)
Functionality is the same, this just removes one dep for Py 3.8+
1 parent e468b31 commit e7bb17a

File tree

31 files changed

+128
-31
lines changed

31 files changed

+128
-31
lines changed

‎Dockerfile.ci

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ENV DEBIAN_FRONTEND=noninteractive LANGUAGE=C.UTF-8 LANG=C.UTF-8 LC_ALL=C.UTF-8
3838
LC_CTYPE=C.UTF-8 LC_MESSAGES=C.UTF-8
3939

4040
# By increasing this number we can do force build of all dependencies
41-
ARG DEPENDENCIES_EPOCH_NUMBER="5"
41+
ARG DEPENDENCIES_EPOCH_NUMBER="6"
4242
# Increase the value below to force reinstalling of all dependencies
4343
ENV DEPENDENCIES_EPOCH_NUMBER=${DEPENDENCIES_EPOCH_NUMBER}
4444

‎airflow/models/baseoperator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@
4343

4444
import attr
4545
import jinja2
46-
from cached_property import cached_property
46+
47+
try:
48+
from functools import cached_property
49+
except ImportError:
50+
from cached_property import cached_property
4751
from dateutil.relativedelta import relativedelta
4852
from sqlalchemy.orm import Session
4953

‎airflow/operators/bash.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
import os
1919
from typing import Dict, Optional
2020

21-
from cached_property import cached_property
21+
try:
22+
from functools import cached_property
23+
except ImportError:
24+
from cached_property import cached_property
2225

2326
from airflow.exceptions import AirflowException, AirflowSkipException
2427
from airflow.hooks.subprocess import EXIT_CODE_SKIP, SubprocessHook

‎airflow/operators/sql.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
from distutils.util import strtobool
1919
from typing import Any, Dict, Iterable, List, Mapping, Optional, SupportsAbs, Union
2020

21-
from cached_property import cached_property
21+
try:
22+
from functools import cached_property
23+
except ImportError:
24+
from cached_property import cached_property
2225

2326
from airflow.exceptions import AirflowException
2427
from airflow.hooks.base import BaseHook

‎airflow/providers/amazon/aws/hooks/base_aws.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@
3434
import botocore.session
3535
from botocore.config import Config
3636
from botocore.credentials import ReadOnlyCredentials
37-
from cached_property import cached_property
37+
38+
try:
39+
from functools import cached_property
40+
except ImportError:
41+
from cached_property import cached_property
3842
from dateutil.tz import tzlocal
3943

4044
from airflow.exceptions import AirflowException

‎airflow/providers/amazon/aws/hooks/glue_crawler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818

1919
from time import sleep
2020

21-
from cached_property import cached_property
21+
try:
22+
from functools import cached_property
23+
except ImportError:
24+
from cached_property import cached_property
2225

2326
from airflow.exceptions import AirflowException
2427
from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook

‎airflow/providers/amazon/aws/log/cloudwatch_task_handler.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
# under the License.
1818

1919
import watchtower
20-
from cached_property import cached_property
20+
21+
try:
22+
from functools import cached_property
23+
except ImportError:
24+
from cached_property import cached_property
2125

2226
from airflow.configuration import conf
2327
from airflow.utils.log.file_task_handler import FileTaskHandler

‎airflow/providers/amazon/aws/log/s3_task_handler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
# under the License.
1818
import os
1919

20-
from cached_property import cached_property
20+
try:
21+
from functools import cached_property
22+
except ImportError:
23+
from cached_property import cached_property
2124

2225
from airflow.configuration import conf
2326
from airflow.utils.log.file_task_handler import FileTaskHandler

‎airflow/providers/amazon/aws/operators/athena.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
from typing import Any, Dict, Optional
2020
from uuid import uuid4
2121

22-
from cached_property import cached_property
22+
try:
23+
from functools import cached_property
24+
except ImportError:
25+
from cached_property import cached_property
2326

2427
from airflow.models import BaseOperator
2528
from airflow.providers.amazon.aws.hooks.athena import AWSAthenaHook

‎airflow/providers/amazon/aws/operators/glue_crawler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
# specific language governing permissions and limitations
1717
# under the License.
1818

19-
from cached_property import cached_property
19+
try:
20+
from functools import cached_property
21+
except ImportError:
22+
from cached_property import cached_property
2023

2124
from airflow.models import BaseOperator
2225
from airflow.providers.amazon.aws.hooks.glue_crawler import AwsGlueCrawlerHook

0 commit comments

Comments
 (0)