From 2df1da9da328797290a9f9c61fb98a225395bf17 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Thu, 30 Dec 2021 01:36:37 +0100 Subject: [PATCH] Fix template_fields type to have MyPy friendly Sequence type Part of #19891 --- .../providers/airbyte/operators/airbyte.py | 4 +- airflow/providers/airbyte/sensors/airbyte.py | 4 +- .../alibaba/cloud/sensors/oss_key.py | 4 +- .../providers/amazon/aws/operators/athena.py | 4 +- .../providers/amazon/aws/operators/batch.py | 4 +- .../amazon/aws/operators/cloud_formation.py | 6 +- .../amazon/aws/operators/datasync.py | 4 +- airflow/providers/amazon/aws/operators/dms.py | 12 ++-- airflow/providers/amazon/aws/operators/ec2.py | 6 +- airflow/providers/amazon/aws/operators/ecs.py | 4 +- airflow/providers/amazon/aws/operators/eks.py | 33 +++++----- airflow/providers/amazon/aws/operators/emr.py | 18 ++++-- .../providers/amazon/aws/operators/glacier.py | 4 +- .../providers/amazon/aws/operators/glue.py | 4 +- .../amazon/aws/operators/redshift_cluster.py | 6 +- .../amazon/aws/operators/redshift_sql.py | 4 +- airflow/providers/amazon/aws/operators/s3.py | 27 +++++---- .../amazon/aws/operators/sagemaker.py | 4 +- airflow/providers/amazon/aws/operators/sns.py | 4 +- airflow/providers/amazon/aws/operators/sqs.py | 4 +- .../amazon/aws/operators/step_function.py | 6 +- .../providers/amazon/aws/sensors/athena.py | 4 +- airflow/providers/amazon/aws/sensors/batch.py | 4 +- .../amazon/aws/sensors/cloud_formation.py | 6 +- airflow/providers/amazon/aws/sensors/dms.py | 6 +- airflow/providers/amazon/aws/sensors/ec2.py | 4 +- airflow/providers/amazon/aws/sensors/eks.py | 20 +++++-- airflow/providers/amazon/aws/sensors/emr.py | 8 +-- .../providers/amazon/aws/sensors/glacier.py | 4 +- airflow/providers/amazon/aws/sensors/glue.py | 4 +- .../aws/sensors/glue_catalog_partition.py | 4 +- .../amazon/aws/sensors/redshift_cluster.py | 4 +- airflow/providers/amazon/aws/sensors/s3.py | 8 +-- .../providers/amazon/aws/sensors/sagemaker.py | 10 ++-- airflow/providers/amazon/aws/sensors/sqs.py | 4 +- .../amazon/aws/sensors/step_function.py | 4 +- .../amazon/aws/transfers/exasol_to_s3.py | 4 +- .../amazon/aws/transfers/ftp_to_s3.py | 4 +- .../amazon/aws/transfers/gcs_to_s3.py | 4 +- .../amazon/aws/transfers/glacier_to_gcs.py | 2 +- .../amazon/aws/transfers/google_api_to_s3.py | 2 +- .../amazon/aws/transfers/hive_to_dynamodb.py | 4 +- .../aws/transfers/imap_attachment_to_s3.py | 4 +- .../amazon/aws/transfers/local_to_s3.py | 4 +- .../amazon/aws/transfers/mongo_to_s3.py | 4 +- .../amazon/aws/transfers/mysql_to_s3.py | 4 +- .../amazon/aws/transfers/redshift_to_s3.py | 11 +++- .../amazon/aws/transfers/s3_to_ftp.py | 4 +- .../amazon/aws/transfers/s3_to_redshift.py | 4 +- .../amazon/aws/transfers/s3_to_sftp.py | 4 +- .../amazon/aws/transfers/salesforce_to_s3.py | 4 +- .../amazon/aws/transfers/sftp_to_s3.py | 4 +- .../providers/apache/beam/operators/beam.py | 14 +++-- .../apache/cassandra/sensors/record.py | 4 +- .../apache/cassandra/sensors/table.py | 4 +- .../providers/apache/drill/operators/drill.py | 4 +- .../providers/apache/druid/operators/druid.py | 4 +- .../apache/druid/transfers/hive_to_druid.py | 4 +- airflow/providers/apache/hdfs/sensors/hdfs.py | 4 +- .../providers/apache/hdfs/sensors/web_hdfs.py | 4 +- .../providers/apache/hive/operators/hive.py | 4 +- .../apache/hive/operators/hive_stats.py | 4 +- .../apache/hive/sensors/hive_partition.py | 4 +- .../hive/sensors/metastore_partition.py | 4 +- .../hive/sensors/named_hive_partition.py | 4 +- .../apache/hive/transfers/hive_to_mysql.py | 4 +- .../apache/hive/transfers/hive_to_samba.py | 4 +- .../apache/hive/transfers/mssql_to_hive.py | 4 +- .../apache/hive/transfers/mysql_to_hive.py | 4 +- .../apache/hive/transfers/s3_to_hive.py | 4 +- .../apache/hive/transfers/vertica_to_hive.py | 4 +- .../apache/kylin/operators/kylin_cube.py | 4 +- .../providers/apache/livy/operators/livy.py | 2 +- airflow/providers/apache/livy/sensors/livy.py | 4 +- airflow/providers/apache/pig/operators/pig.py | 4 +- .../apache/spark/operators/spark_sql.py | 4 +- .../apache/spark/operators/spark_submit.py | 4 +- .../providers/apache/sqoop/operators/sqoop.py | 4 +- .../kubernetes/operators/kubernetes_pod.py | 4 +- .../kubernetes/operators/spark_kubernetes.py | 4 +- .../kubernetes/sensors/spark_kubernetes.py | 4 +- .../databricks/operators/databricks.py | 6 +- .../providers/dingding/operators/dingding.py | 4 +- .../discord/operators/discord_webhook.py | 4 +- airflow/providers/docker/decorators/docker.py | 4 +- airflow/providers/exasol/operators/exasol.py | 4 +- airflow/providers/ftp/sensors/ftp.py | 4 +- airflow/providers/google/ads/operators/ads.py | 2 +- .../google/ads/transfers/ads_to_gcs.py | 2 +- .../google/cloud/operators/automl.py | 26 ++++---- .../google/cloud/operators/bigquery.py | 36 +++++------ .../google/cloud/operators/bigquery_dts.py | 6 +- .../google/cloud/operators/bigtable.py | 24 ++++---- .../google/cloud/operators/cloud_build.py | 22 +++---- .../cloud/operators/cloud_memorystore.py | 44 ++++++++------ .../google/cloud/operators/cloud_sql.py | 18 +++--- .../cloud_storage_transfer_service.py | 20 +++---- .../google/cloud/operators/compute.py | 10 ++-- .../google/cloud/operators/datacatalog.py | 42 ++++++------- .../google/cloud/operators/dataflow.py | 16 ++--- .../google/cloud/operators/datafusion.py | 20 +++---- .../google/cloud/operators/dataprep.py | 8 +-- .../google/cloud/operators/dataproc.py | 48 +++++++-------- .../cloud/operators/dataproc_metastore.py | 20 +++---- .../google/cloud/operators/datastore.py | 22 +++---- .../providers/google/cloud/operators/dlp.py | 60 +++++++++---------- .../google/cloud/operators/functions.py | 6 +- .../providers/google/cloud/operators/gcs.py | 20 +++---- .../cloud/operators/kubernetes_engine.py | 8 +-- .../google/cloud/operators/life_sciences.py | 2 +- .../google/cloud/operators/mlengine.py | 48 +++++++-------- .../cloud/operators/natural_language.py | 8 +-- .../google/cloud/operators/pubsub.py | 24 ++++---- .../google/cloud/operators/spanner.py | 12 ++-- .../google/cloud/operators/speech_to_text.py | 2 +- .../google/cloud/operators/stackdriver.py | 20 +++---- .../providers/google/cloud/operators/tasks.py | 26 ++++---- .../google/cloud/operators/text_to_speech.py | 2 +- .../google/cloud/operators/translate.py | 2 +- .../cloud/operators/translate_speech.py | 2 +- .../cloud/operators/video_intelligence.py | 6 +- .../google/cloud/operators/vision.py | 34 +++++------ .../google/cloud/operators/workflows.py | 18 +++--- .../google/cloud/sensors/bigquery.py | 4 +- .../google/cloud/sensors/bigquery_dts.py | 2 +- .../google/cloud/sensors/bigtable.py | 4 +- .../sensors/cloud_storage_transfer_service.py | 2 +- .../google/cloud/sensors/dataflow.py | 8 +-- .../google/cloud/sensors/datafusion.py | 2 +- .../google/cloud/sensors/dataproc.py | 4 +- airflow/providers/google/cloud/sensors/gcs.py | 8 +-- .../providers/google/cloud/sensors/pubsub.py | 4 +- .../google/cloud/sensors/workflows.py | 2 +- .../cloud/transfers/azure_fileshare_to_gcs.py | 4 +- .../cloud/transfers/bigquery_to_bigquery.py | 2 +- .../google/cloud/transfers/bigquery_to_gcs.py | 2 +- .../cloud/transfers/bigquery_to_mssql.py | 2 +- .../cloud/transfers/bigquery_to_mysql.py | 2 +- .../cloud/transfers/cassandra_to_gcs.py | 2 +- .../cloud/transfers/facebook_ads_to_gcs.py | 2 +- .../google/cloud/transfers/gcs_to_bigquery.py | 2 +- .../google/cloud/transfers/gcs_to_gcs.py | 2 +- .../google/cloud/transfers/gcs_to_local.py | 2 +- .../google/cloud/transfers/gcs_to_sftp.py | 2 +- .../google/cloud/transfers/gdrive_to_gcs.py | 4 +- .../google/cloud/transfers/gdrive_to_local.py | 4 +- .../google/cloud/transfers/local_to_gcs.py | 2 +- .../google/cloud/transfers/s3_to_gcs.py | 4 +- .../cloud/transfers/salesforce_to_gcs.py | 4 +- .../google/cloud/transfers/sftp_to_gcs.py | 2 +- .../google/cloud/transfers/sheets_to_gcs.py | 4 +- .../google/cloud/transfers/sql_to_gcs.py | 2 +- .../google/firebase/operators/firestore.py | 2 +- .../marketing_platform/operators/analytics.py | 12 ++-- .../operators/campaign_manager.py | 12 ++-- .../operators/display_video.py | 16 ++--- .../operators/search_ads.py | 4 +- .../sensors/campaign_manager.py | 2 +- .../sensors/display_video.py | 4 +- .../marketing_platform/sensors/search_ads.py | 2 +- .../google/suite/operators/sheets.py | 4 +- .../providers/google/suite/sensors/drive.py | 2 +- .../google/suite/transfers/gcs_to_gdrive.py | 2 +- .../google/suite/transfers/gcs_to_sheets.py | 4 +- .../google/suite/transfers/sql_to_sheets.py | 2 +- airflow/providers/grpc/operators/grpc.py | 4 +- airflow/providers/http/operators/http.py | 6 +- airflow/providers/http/sensors/http.py | 4 +- .../providers/imap/sensors/imap_attachment.py | 4 +- .../providers/influxdb/operators/influxdb.py | 4 +- airflow/providers/jdbc/operators/jdbc.py | 4 +- .../jenkins/operators/jenkins_job_trigger.py | 4 +- airflow/providers/jira/operators/jira.py | 4 +- airflow/providers/jira/sensors/jira.py | 4 +- .../microsoft/azure/operators/adx.py | 4 +- .../microsoft/azure/operators/batch.py | 4 +- .../azure/operators/container_instances.py | 2 +- .../microsoft/azure/operators/cosmos.py | 4 +- .../microsoft/azure/operators/data_factory.py | 4 +- .../azure/operators/wasb_delete_blob.py | 4 +- .../microsoft/azure/sensors/cosmos.py | 4 +- .../microsoft/azure/sensors/data_factory.py | 9 ++- .../providers/microsoft/azure/sensors/wasb.py | 6 +- .../azure/transfers/azure_blob_to_gcs.py | 2 +- .../azure/transfers/local_to_adls.py | 4 +- .../azure/transfers/local_to_wasb.py | 4 +- .../transfers/oracle_to_azure_data_lake.py | 4 +- .../microsoft/azure/transfers/sftp_to_wasb.py | 4 +- .../microsoft/mssql/operators/mssql.py | 4 +- .../microsoft/psrp/operators/psrp.py | 4 +- .../microsoft/winrm/operators/winrm.py | 4 +- airflow/providers/mongo/sensors/mongo.py | 4 +- airflow/providers/mysql/operators/mysql.py | 4 +- .../mysql/transfers/presto_to_mysql.py | 4 +- .../providers/mysql/transfers/s3_to_mysql.py | 4 +- .../mysql/transfers/trino_to_mysql.py | 4 +- .../mysql/transfers/vertica_to_mysql.py | 4 +- airflow/providers/neo4j/operators/neo4j.py | 4 +- .../providers/opsgenie/operators/opsgenie.py | 4 +- airflow/providers/oracle/operators/oracle.py | 6 +- .../oracle/transfers/oracle_to_oracle.py | 4 +- .../papermill/operators/papermill.py | 4 +- .../providers/postgres/operators/postgres.py | 4 +- airflow/providers/qubole/operators/qubole.py | 4 +- .../qubole/operators/qubole_check.py | 6 +- airflow/providers/qubole/sensors/qubole.py | 4 +- .../redis/operators/redis_publish.py | 4 +- airflow/providers/redis/sensors/redis_key.py | 4 +- .../providers/redis/sensors/redis_pub_sub.py | 4 +- .../segment/operators/segment_track_event.py | 4 +- airflow/providers/sftp/operators/sftp.py | 4 +- airflow/providers/sftp/sensors/sftp.py | 4 +- .../singularity/operators/singularity.py | 4 +- airflow/providers/slack/operators/slack.py | 6 +- .../slack/operators/slack_webhook.py | 6 +- .../snowflake/operators/snowflake.py | 6 +- .../snowflake/transfers/s3_to_snowflake.py | 4 +- .../snowflake/transfers/snowflake_to_slack.py | 4 +- airflow/providers/sqlite/operators/sqlite.py | 4 +- airflow/providers/ssh/operators/ssh.py | 4 +- .../tableau/sensors/tableau_job_status.py | 4 +- .../providers/telegram/operators/telegram.py | 4 +- .../providers/vertica/operators/vertica.py | 4 +- .../yandex/operators/yandexcloud_dataproc.py | 12 ++-- .../slack/operators/test_slack_webhook.py | 4 +- 225 files changed, 818 insertions(+), 766 deletions(-) diff --git a/airflow/providers/airbyte/operators/airbyte.py b/airflow/providers/airbyte/operators/airbyte.py index a5d5e642c9bf5..73be9830248bf 100644 --- a/airflow/providers/airbyte/operators/airbyte.py +++ b/airflow/providers/airbyte/operators/airbyte.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.airbyte.hooks.airbyte import AirbyteHook @@ -51,7 +51,7 @@ class AirbyteTriggerSyncOperator(BaseOperator): :type timeout: float """ - template_fields = ('connection_id',) + template_fields: Sequence[str] = ('connection_id',) def __init__( self, diff --git a/airflow/providers/airbyte/sensors/airbyte.py b/airflow/providers/airbyte/sensors/airbyte.py index 2917065d911f1..6640dd0fb4c2e 100644 --- a/airflow/providers/airbyte/sensors/airbyte.py +++ b/airflow/providers/airbyte/sensors/airbyte.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. """This module contains a Airbyte Job sensor.""" -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.exceptions import AirflowException from airflow.providers.airbyte.hooks.airbyte import AirbyteHook @@ -39,7 +39,7 @@ class AirbyteJobSensor(BaseSensorOperator): :type api_version: str """ - template_fields = ('airbyte_job_id',) + template_fields: Sequence[str] = ('airbyte_job_id',) ui_color = '#6C51FD' def __init__( diff --git a/airflow/providers/alibaba/cloud/sensors/oss_key.py b/airflow/providers/alibaba/cloud/sensors/oss_key.py index 72224fb9e11e2..2788ea777d027 100644 --- a/airflow/providers/alibaba/cloud/sensors/oss_key.py +++ b/airflow/providers/alibaba/cloud/sensors/oss_key.py @@ -22,7 +22,7 @@ else: from cached_property import cached_property -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from urllib.parse import urlparse from airflow.exceptions import AirflowException @@ -51,7 +51,7 @@ class OSSKeySensor(BaseSensorOperator): :type oss_conn_id: Optional[str] """ - template_fields = ('bucket_key', 'bucket_name') + template_fields: Sequence[str] = ('bucket_key', 'bucket_name') def __init__( self, diff --git a/airflow/providers/amazon/aws/operators/athena.py b/airflow/providers/amazon/aws/operators/athena.py index 015b3b2dba232..0f257e46e9fd0 100644 --- a/airflow/providers/amazon/aws/operators/athena.py +++ b/airflow/providers/amazon/aws/operators/athena.py @@ -18,7 +18,7 @@ # import sys import warnings -from typing import TYPE_CHECKING, Any, Dict, Optional +from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence from uuid import uuid4 if sys.version_info >= (3, 8): @@ -64,7 +64,7 @@ class AthenaOperator(BaseOperator): """ ui_color = '#44b5e2' - template_fields = ('query', 'database', 'output_location') + template_fields: Sequence[str] = ('query', 'database', 'output_location') template_ext = ('.sql',) template_fields_renderers = {"query": "sql"} diff --git a/airflow/providers/amazon/aws/operators/batch.py b/airflow/providers/amazon/aws/operators/batch.py index 11793dbb83e2d..dfe81b05d4b0c 100644 --- a/airflow/providers/amazon/aws/operators/batch.py +++ b/airflow/providers/amazon/aws/operators/batch.py @@ -26,7 +26,7 @@ - http://boto3.readthedocs.io/en/latest/reference/services/batch.html - https://docs.aws.amazon.com/batch/latest/APIReference/Welcome.html """ -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any, Optional, Sequence from airflow.exceptions import AirflowException from airflow.models import BaseOperator @@ -97,7 +97,7 @@ class AwsBatchOperator(BaseOperator): ui_color = "#c3dae0" arn = None # type: Optional[str] - template_fields = ( + template_fields: Sequence[str] = ( "job_name", "overrides", "parameters", diff --git a/airflow/providers/amazon/aws/operators/cloud_formation.py b/airflow/providers/amazon/aws/operators/cloud_formation.py index 9e3c8cc10e0ec..0a413586d6796 100644 --- a/airflow/providers/amazon/aws/operators/cloud_formation.py +++ b/airflow/providers/amazon/aws/operators/cloud_formation.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. """This module contains CloudFormation create/delete stack operators.""" -from typing import TYPE_CHECKING, List, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.cloud_formation import CloudFormationHook @@ -40,7 +40,7 @@ class CloudFormationCreateStackOperator(BaseOperator): :type aws_conn_id: str """ - template_fields: List[str] = ['stack_name'] + template_fields: Sequence[str] = ('stack_name',) template_ext = () ui_color = '#6b9659' @@ -72,7 +72,7 @@ class CloudFormationDeleteStackOperator(BaseOperator): :type aws_conn_id: str """ - template_fields: List[str] = ['stack_name'] + template_fields: Sequence[str] = ('stack_name',) template_ext = () ui_color = '#1d472b' ui_fgcolor = '#FFF' diff --git a/airflow/providers/amazon/aws/operators/datasync.py b/airflow/providers/amazon/aws/operators/datasync.py index 801dfb15e7b75..c677ceb86604e 100644 --- a/airflow/providers/amazon/aws/operators/datasync.py +++ b/airflow/providers/amazon/aws/operators/datasync.py @@ -20,7 +20,7 @@ import logging import random import warnings -from typing import TYPE_CHECKING, List, Optional +from typing import TYPE_CHECKING, List, Optional, Sequence from airflow.exceptions import AirflowException, AirflowTaskTimeout from airflow.models import BaseOperator @@ -111,7 +111,7 @@ class DataSyncOperator(BaseOperator): :raises AirflowException: If Task creation, update, execution or delete fails. """ - template_fields = ( + template_fields: Sequence[str] = ( "task_arn", "source_location_uri", "destination_location_uri", diff --git a/airflow/providers/amazon/aws/operators/dms.py b/airflow/providers/amazon/aws/operators/dms.py index 7bf3918da9e75..5dabdb867e7fb 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 TYPE_CHECKING, Dict, Optional +from typing import TYPE_CHECKING, Dict, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.dms import DmsHook @@ -56,7 +56,7 @@ class DmsCreateTaskOperator(BaseOperator): :type aws_conn_id: Optional[str] """ - template_fields = ( + template_fields: Sequence[str] = ( 'replication_task_id', 'source_endpoint_arn', 'target_endpoint_arn', @@ -134,7 +134,7 @@ class DmsDeleteTaskOperator(BaseOperator): :type aws_conn_id: Optional[str] """ - template_fields = ('replication_task_arn',) + template_fields: Sequence[str] = ('replication_task_arn',) template_ext = () template_fields_renderers: Dict[str, str] = {} @@ -174,7 +174,7 @@ class DmsDescribeTasksOperator(BaseOperator): :type aws_conn_id: Optional[str] """ - template_fields = ('describe_tasks_kwargs',) + template_fields: Sequence[str] = ('describe_tasks_kwargs',) template_ext = () template_fields_renderers: Dict[str, str] = {'describe_tasks_kwargs': 'json'} @@ -223,7 +223,7 @@ class DmsStartTaskOperator(BaseOperator): :type aws_conn_id: Optional[str] """ - template_fields = ( + template_fields: Sequence[str] = ( 'replication_task_arn', 'start_replication_task_type', 'start_task_kwargs', @@ -276,7 +276,7 @@ class DmsStopTaskOperator(BaseOperator): :type aws_conn_id: Optional[str] """ - template_fields = ('replication_task_arn',) + template_fields: Sequence[str] = ('replication_task_arn',) template_ext = () template_fields_renderers: Dict[str, str] = {} diff --git a/airflow/providers/amazon/aws/operators/ec2.py b/airflow/providers/amazon/aws/operators/ec2.py index 0fabeec392777..fa6886acd2447 100644 --- a/airflow/providers/amazon/aws/operators/ec2.py +++ b/airflow/providers/amazon/aws/operators/ec2.py @@ -17,7 +17,7 @@ # under the License. # -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.ec2 import EC2Hook @@ -41,7 +41,7 @@ class EC2StartInstanceOperator(BaseOperator): :type check_interval: float """ - template_fields = ("instance_id", "region_name") + template_fields: Sequence[str] = ("instance_id", "region_name") ui_color = "#eeaa11" ui_fgcolor = "#ffffff" @@ -87,7 +87,7 @@ class EC2StopInstanceOperator(BaseOperator): :type check_interval: float """ - template_fields = ("instance_id", "region_name") + template_fields: Sequence[str] = ("instance_id", "region_name") ui_color = "#eeaa11" ui_fgcolor = "#ffffff" diff --git a/airflow/providers/amazon/aws/operators/ecs.py b/airflow/providers/amazon/aws/operators/ecs.py index 9a97fd7073d02..5ea364687e1c8 100644 --- a/airflow/providers/amazon/aws/operators/ecs.py +++ b/airflow/providers/amazon/aws/operators/ecs.py @@ -22,7 +22,7 @@ from datetime import datetime, timedelta from logging import Logger from threading import Event, Thread -from typing import Dict, Generator, Optional +from typing import Dict, Generator, Optional, Sequence from botocore.exceptions import ClientError from botocore.waiter import Waiter @@ -225,7 +225,7 @@ class ECSOperator(BaseOperator): """ ui_color = '#f0ede4' - template_fields = ('overrides',) + template_fields: Sequence[str] = ('overrides',) template_fields_renderers = { "overrides": "json", "network_configuration": "json", diff --git a/airflow/providers/amazon/aws/operators/eks.py b/airflow/providers/amazon/aws/operators/eks.py index c7abb9447cb8e..c904f0e2e9825 100644 --- a/airflow/providers/amazon/aws/operators/eks.py +++ b/airflow/providers/amazon/aws/operators/eks.py @@ -18,7 +18,7 @@ """This module contains Amazon EKS operators.""" import warnings from time import sleep -from typing import TYPE_CHECKING, Dict, Iterable, List, Optional +from typing import TYPE_CHECKING, Dict, List, Optional, Sequence from airflow import AirflowException from airflow.models import BaseOperator @@ -109,7 +109,7 @@ class EksCreateClusterOperator(BaseOperator): """ - template_fields: Iterable[str] = ( + template_fields: Sequence[str] = ( "cluster_name", "cluster_role_arn", "resources_vpc_config", @@ -246,7 +246,7 @@ class EksCreateNodegroupOperator(BaseOperator): """ - template_fields: Iterable[str] = ( + template_fields: Sequence[str] = ( "cluster_name", "nodegroup_subnets", "nodegroup_role_arn", @@ -316,7 +316,7 @@ class EksCreateFargateProfileOperator(BaseOperator): :type region: str """ - template_fields: Iterable[str] = ( + template_fields: Sequence[str] = ( "cluster_name", "pod_execution_role_arn", "selectors", @@ -382,7 +382,7 @@ class EksDeleteClusterOperator(BaseOperator): """ - template_fields: Iterable[str] = ( + template_fields: Sequence[str] = ( "cluster_name", "force_delete_compute", "aws_conn_id", @@ -506,7 +506,7 @@ class EksDeleteNodegroupOperator(BaseOperator): """ - template_fields: Iterable[str] = ( + template_fields: Sequence[str] = ( "cluster_name", "nodegroup_name", "aws_conn_id", @@ -559,7 +559,7 @@ class EksDeleteFargateProfileOperator(BaseOperator): :type region: str """ - template_fields: Iterable[str] = ( + template_fields: Sequence[str] = ( "cluster_name", "fargate_profile_name", "aws_conn_id", @@ -623,14 +623,17 @@ class EksPodOperator(KubernetesPodOperator): :type aws_conn_id: str """ - template_fields: Iterable[str] = { - "cluster_name", - "in_cluster", - "namespace", - "pod_name", - "aws_conn_id", - "region", - } | set(KubernetesPodOperator.template_fields) + template_fields: Sequence[str] = tuple( + { + "cluster_name", + "in_cluster", + "namespace", + "pod_name", + "aws_conn_id", + "region", + } + | set(KubernetesPodOperator.template_fields) + ) def __init__( self, diff --git a/airflow/providers/amazon/aws/operators/emr.py b/airflow/providers/amazon/aws/operators/emr.py index dede3c30adc47..e4be2736a8fe1 100644 --- a/airflow/providers/amazon/aws/operators/emr.py +++ b/airflow/providers/amazon/aws/operators/emr.py @@ -18,7 +18,7 @@ import ast import sys from datetime import datetime -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Union from uuid import uuid4 from airflow.exceptions import AirflowException @@ -59,7 +59,7 @@ class EmrAddStepsOperator(BaseOperator): :type do_xcom_push: bool """ - template_fields = ['job_flow_id', 'job_flow_name', 'cluster_states', 'steps'] + template_fields: Sequence[str] = ('job_flow_id', 'job_flow_name', 'cluster_states', 'steps') template_ext = ('.json',) template_fields_renderers = {"steps": "json"} ui_color = '#f9c915' @@ -149,7 +149,13 @@ class EmrContainerOperator(BaseOperator): :type max_tries: int """ - template_fields = ["name", "virtual_cluster_id", "execution_role_arn", "release_label", "job_driver"] + template_fields: Sequence[str] = ( + "name", + "virtual_cluster_id", + "execution_role_arn", + "release_label", + "job_driver", + ) ui_color = "#f9c915" def __init__( @@ -274,7 +280,7 @@ class EmrCreateJobFlowOperator(BaseOperator): :type region_name: Optional[str] """ - template_fields = ['job_flow_overrides'] + template_fields: Sequence[str] = ('job_flow_overrides',) template_ext = ('.json',) template_fields_renderers = {"job_flow_overrides": "json"} ui_color = '#f9c915' @@ -333,7 +339,7 @@ class EmrModifyClusterOperator(BaseOperator): :type do_xcom_push: bool """ - template_fields = ['cluster_id', 'step_concurrency_level'] + template_fields: Sequence[str] = ('cluster_id', 'step_concurrency_level') template_ext = () ui_color = '#f9c915' @@ -377,7 +383,7 @@ class EmrTerminateJobFlowOperator(BaseOperator): :type aws_conn_id: str """ - template_fields = ['job_flow_id'] + template_fields: Sequence[str] = ('job_flow_id',) template_ext = () ui_color = '#f9c915' diff --git a/airflow/providers/amazon/aws/operators/glacier.py b/airflow/providers/amazon/aws/operators/glacier.py index 7c30b5422ce86..285813995eea3 100644 --- a/airflow/providers/amazon/aws/operators/glacier.py +++ b/airflow/providers/amazon/aws/operators/glacier.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.glacier import GlacierHook @@ -38,7 +38,7 @@ class GlacierCreateJobOperator(BaseOperator): :type vault_name: str """ - template_fields = ("vault_name",) + template_fields: Sequence[str] = ("vault_name",) def __init__( self, diff --git a/airflow/providers/amazon/aws/operators/glue.py b/airflow/providers/amazon/aws/operators/glue.py index c7579b795ade4..f33af8c34a65b 100644 --- a/airflow/providers/amazon/aws/operators/glue.py +++ b/airflow/providers/amazon/aws/operators/glue.py @@ -18,7 +18,7 @@ import os.path import warnings -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.glue import GlueJobHook @@ -62,7 +62,7 @@ class GlueJobOperator(BaseOperator): :type wait_for_completion: bool """ - template_fields = ('script_args',) + template_fields: Sequence[str] = ('script_args',) template_ext = () template_fields_renderers = { "script_args": "json", diff --git a/airflow/providers/amazon/aws/operators/redshift_cluster.py b/airflow/providers/amazon/aws/operators/redshift_cluster.py index 4370cb4e1faba..816f27efac280 100644 --- a/airflow/providers/amazon/aws/operators/redshift_cluster.py +++ b/airflow/providers/amazon/aws/operators/redshift_cluster.py @@ -14,7 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.redshift_cluster import RedshiftHook @@ -37,7 +37,7 @@ class RedshiftResumeClusterOperator(BaseOperator): :type aws_conn_id: str """ - template_fields = ("cluster_identifier",) + template_fields: Sequence[str] = ("cluster_identifier",) ui_color = "#eeaa11" ui_fgcolor = "#ffffff" @@ -78,7 +78,7 @@ class RedshiftPauseClusterOperator(BaseOperator): :type aws_conn_id: str """ - template_fields = ("cluster_identifier",) + template_fields: Sequence[str] = ("cluster_identifier",) ui_color = "#eeaa11" ui_fgcolor = "#ffffff" diff --git a/airflow/providers/amazon/aws/operators/redshift_sql.py b/airflow/providers/amazon/aws/operators/redshift_sql.py index 8bc2d8f1427be..7bafa100d42d3 100644 --- a/airflow/providers/amazon/aws/operators/redshift_sql.py +++ b/airflow/providers/amazon/aws/operators/redshift_sql.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Dict, Iterable, Optional, Union +from typing import TYPE_CHECKING, Dict, Iterable, Optional, Sequence, Union from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.redshift_sql import RedshiftSQLHook @@ -45,7 +45,7 @@ class RedshiftSQLOperator(BaseOperator): :type autocommit: bool """ - template_fields = ('sql',) + template_fields: Sequence[str] = ('sql',) template_ext = ('.sql',) def __init__( diff --git a/airflow/providers/amazon/aws/operators/s3.py b/airflow/providers/amazon/aws/operators/s3.py index f19487306dcea..957b496c4a224 100644 --- a/airflow/providers/amazon/aws/operators/s3.py +++ b/airflow/providers/amazon/aws/operators/s3.py @@ -21,7 +21,7 @@ import subprocess import sys from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Sequence, Union +from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, Union from airflow.exceptions import AirflowException from airflow.models import BaseOperator @@ -54,7 +54,7 @@ class S3CreateBucketOperator(BaseOperator): :type region_name: Optional[str] """ - template_fields = ("bucket_name",) + template_fields: Sequence[str] = ("bucket_name",) def __init__( self, @@ -99,7 +99,7 @@ class S3DeleteBucketOperator(BaseOperator): :type aws_conn_id: Optional[str] """ - template_fields = ("bucket_name",) + template_fields: Sequence[str] = ("bucket_name",) def __init__( self, @@ -140,7 +140,7 @@ class S3GetBucketTaggingOperator(BaseOperator): :type aws_conn_id: Optional[str] """ - template_fields = ("bucket_name",) + template_fields: Sequence[str] = ("bucket_name",) def __init__(self, bucket_name: str, aws_conn_id: Optional[str] = "aws_default", **kwargs) -> None: super().__init__(**kwargs) @@ -183,7 +183,7 @@ class S3PutBucketTaggingOperator(BaseOperator): :type aws_conn_id: Optional[str] """ - template_fields = ("bucket_name",) + template_fields: Sequence[str] = ("bucket_name",) template_fields_renderers = {"tag_set": "json"} def __init__( @@ -233,7 +233,7 @@ class S3DeleteBucketTaggingOperator(BaseOperator): :type aws_conn_id: Optional[str] """ - template_fields = ("bucket_name",) + template_fields: Sequence[str] = ("bucket_name",) def __init__(self, bucket_name: str, aws_conn_id: Optional[str] = "aws_default", **kwargs) -> None: super().__init__(**kwargs) @@ -297,7 +297,12 @@ class S3CopyObjectOperator(BaseOperator): :type acl_policy: str """ - template_fields = ('source_bucket_key', 'dest_bucket_key', 'source_bucket_name', 'dest_bucket_name') + template_fields: Sequence[str] = ( + 'source_bucket_key', + 'dest_bucket_key', + 'source_bucket_name', + 'dest_bucket_name', + ) def __init__( self, @@ -373,7 +378,7 @@ class S3DeleteObjectsOperator(BaseOperator): :type verify: bool or str """ - template_fields = ('keys', 'bucket', 'prefix') + template_fields: Sequence[str] = ('keys', 'bucket', 'prefix') def __init__( self, @@ -455,7 +460,7 @@ class S3FileTransformOperator(BaseOperator): :type replace: bool """ - template_fields = ('source_s3_key', 'dest_s3_key', 'script_args') + template_fields: Sequence[str] = ('source_s3_key', 'dest_s3_key', 'script_args') template_ext = () ui_color = '#f9c915' @@ -583,7 +588,7 @@ class S3ListOperator(BaseOperator): ) """ - template_fields: Iterable[str] = ('bucket', 'prefix', 'delimiter') + template_fields: Sequence[str] = ('bucket', 'prefix', 'delimiter') ui_color = '#ffd700' def __init__( @@ -658,7 +663,7 @@ class S3ListPrefixesOperator(BaseOperator): ) """ - template_fields: Iterable[str] = ('bucket', 'prefix', 'delimiter') + template_fields: Sequence[str] = ('bucket', 'prefix', 'delimiter') ui_color = '#ffd700' def __init__( diff --git a/airflow/providers/amazon/aws/operators/sagemaker.py b/airflow/providers/amazon/aws/operators/sagemaker.py index f9f231843c4e0..ce77f216e1e04 100644 --- a/airflow/providers/amazon/aws/operators/sagemaker.py +++ b/airflow/providers/amazon/aws/operators/sagemaker.py @@ -17,7 +17,7 @@ import json import sys -from typing import TYPE_CHECKING, List, Optional +from typing import TYPE_CHECKING, List, Optional, Sequence from botocore.exceptions import ClientError @@ -44,7 +44,7 @@ class SageMakerBaseOperator(BaseOperator): :type aws_conn_id: str """ - template_fields = ['config'] + template_fields: Sequence[str] = ('config',) template_ext = () template_fields_renderers = {'config': 'json'} ui_color = '#ededed' diff --git a/airflow/providers/amazon/aws/operators/sns.py b/airflow/providers/amazon/aws/operators/sns.py index e1a85d2c9f7c3..eb07cb7fb9530 100644 --- a/airflow/providers/amazon/aws/operators/sns.py +++ b/airflow/providers/amazon/aws/operators/sns.py @@ -17,7 +17,7 @@ # under the License. """Publish message to SNS queue""" -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.sns import SnsHook @@ -43,7 +43,7 @@ class SnsPublishOperator(BaseOperator): :type message_attributes: dict """ - template_fields = ['message', 'subject', 'message_attributes'] + template_fields: Sequence[str] = ('message', 'subject', 'message_attributes') template_ext = () template_fields_renderers = {"message_attributes": "json"} diff --git a/airflow/providers/amazon/aws/operators/sqs.py b/airflow/providers/amazon/aws/operators/sqs.py index 0a43096f10d05..c206d89e44ed6 100644 --- a/airflow/providers/amazon/aws/operators/sqs.py +++ b/airflow/providers/amazon/aws/operators/sqs.py @@ -16,7 +16,7 @@ # under the License. """Publish message to SQS queue""" -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.sqs import SQSHook @@ -46,7 +46,7 @@ class SQSPublishOperator(BaseOperator): :type aws_conn_id: str """ - template_fields = ('sqs_queue', 'message_content', 'delay_seconds', 'message_attributes') + template_fields: Sequence[str] = ('sqs_queue', 'message_content', 'delay_seconds', 'message_attributes') template_fields_renderers = {'message_attributes': 'json'} ui_color = '#6ad3fa' diff --git a/airflow/providers/amazon/aws/operators/step_function.py b/airflow/providers/amazon/aws/operators/step_function.py index 52523935e787d..aa2bf595f9785 100644 --- a/airflow/providers/amazon/aws/operators/step_function.py +++ b/airflow/providers/amazon/aws/operators/step_function.py @@ -17,7 +17,7 @@ import json -from typing import TYPE_CHECKING, Optional, Union +from typing import TYPE_CHECKING, Optional, Sequence, Union from airflow.exceptions import AirflowException from airflow.models import BaseOperator @@ -48,7 +48,7 @@ class StepFunctionStartExecutionOperator(BaseOperator): :type do_xcom_push: bool """ - template_fields = ['state_machine_arn', 'name', 'input'] + template_fields: Sequence[str] = ('state_machine_arn', 'name', 'input') template_ext = () ui_color = '#f9c915' @@ -97,7 +97,7 @@ class StepFunctionGetExecutionOutputOperator(BaseOperator): :type aws_conn_id: str """ - template_fields = ['execution_arn'] + template_fields: Sequence[str] = ('execution_arn',) template_ext = () ui_color = '#f9c915' diff --git a/airflow/providers/amazon/aws/sensors/athena.py b/airflow/providers/amazon/aws/sensors/athena.py index 1d620e76b4b81..c585bb31a95f1 100644 --- a/airflow/providers/amazon/aws/sensors/athena.py +++ b/airflow/providers/amazon/aws/sensors/athena.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. import sys -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any, Optional, Sequence if TYPE_CHECKING: from airflow.utils.context import Context @@ -58,7 +58,7 @@ class AthenaSensor(BaseSensorOperator): ) SUCCESS_STATES = ('SUCCEEDED',) - template_fields = ['query_execution_id'] + template_fields: Sequence[str] = ('query_execution_id',) template_ext = () ui_color = '#66c3ff' diff --git a/airflow/providers/amazon/aws/sensors/batch.py b/airflow/providers/amazon/aws/sensors/batch.py index 6e675edb8e7f4..f9db17000a4be 100644 --- a/airflow/providers/amazon/aws/sensors/batch.py +++ b/airflow/providers/amazon/aws/sensors/batch.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.exceptions import AirflowException from airflow.providers.amazon.aws.hooks.batch_client import AwsBatchClientHook @@ -36,7 +36,7 @@ class BatchSensor(BaseSensorOperator): :type aws_conn_id: str """ - template_fields = ['job_id'] + template_fields: Sequence[str] = ('job_id',) template_ext = () ui_color = '#66c3ff' diff --git a/airflow/providers/amazon/aws/sensors/cloud_formation.py b/airflow/providers/amazon/aws/sensors/cloud_formation.py index 4653d07a5c6bc..88f9caff53dc8 100644 --- a/airflow/providers/amazon/aws/sensors/cloud_formation.py +++ b/airflow/providers/amazon/aws/sensors/cloud_formation.py @@ -17,7 +17,7 @@ # under the License. """This module contains sensors for AWS CloudFormation.""" import sys -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence if TYPE_CHECKING: from airflow.utils.context import Context @@ -44,7 +44,7 @@ class CloudFormationCreateStackSensor(BaseSensorOperator): :type poke_interval: int """ - template_fields = ['stack_name'] + template_fields: Sequence[str] = ('stack_name',) ui_color = '#C5CAE9' def __init__(self, *, stack_name, aws_conn_id='aws_default', region_name=None, **kwargs): @@ -80,7 +80,7 @@ class CloudFormationDeleteStackSensor(BaseSensorOperator): :type poke_interval: int """ - template_fields = ['stack_name'] + template_fields: Sequence[str] = ('stack_name',) ui_color = '#C5CAE9' def __init__( diff --git a/airflow/providers/amazon/aws/sensors/dms.py b/airflow/providers/amazon/aws/sensors/dms.py index 72fe227aa7712..81bef67501c2c 100644 --- a/airflow/providers/amazon/aws/sensors/dms.py +++ b/airflow/providers/amazon/aws/sensors/dms.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Iterable, Optional +from typing import TYPE_CHECKING, Iterable, Optional, Sequence from airflow.exceptions import AirflowException from airflow.providers.amazon.aws.hooks.dms import DmsHook @@ -44,7 +44,7 @@ class DmsTaskBaseSensor(BaseSensorOperator): :type termination_statuses: list[str] """ - template_fields = ['replication_task_arn'] + template_fields: Sequence[str] = ('replication_task_arn',) template_ext = () def __init__( @@ -102,7 +102,7 @@ class DmsTaskCompletedSensor(DmsTaskBaseSensor): :type replication_task_arn: str """ - template_fields = ['replication_task_arn'] + template_fields: Sequence[str] = ('replication_task_arn',) template_ext = () def __init__(self, *args, **kwargs): diff --git a/airflow/providers/amazon/aws/sensors/ec2.py b/airflow/providers/amazon/aws/sensors/ec2.py index a46517701f462..5f84677477496 100644 --- a/airflow/providers/amazon/aws/sensors/ec2.py +++ b/airflow/providers/amazon/aws/sensors/ec2.py @@ -17,7 +17,7 @@ # under the License. # -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.providers.amazon.aws.hooks.ec2 import EC2Hook from airflow.sensors.base import BaseSensorOperator @@ -39,7 +39,7 @@ class EC2InstanceStateSensor(BaseSensorOperator): :type region_name: Optional[str] """ - template_fields = ("target_state", "instance_id", "region_name") + template_fields: Sequence[str] = ("target_state", "instance_id", "region_name") ui_color = "#cc8811" ui_fgcolor = "#ffffff" valid_states = ["running", "stopped", "terminated"] diff --git a/airflow/providers/amazon/aws/sensors/eks.py b/airflow/providers/amazon/aws/sensors/eks.py index 2380b7beb594d..ab19db7679a57 100644 --- a/airflow/providers/amazon/aws/sensors/eks.py +++ b/airflow/providers/amazon/aws/sensors/eks.py @@ -17,7 +17,7 @@ # """Tracking the state of Amazon EKS Clusters, Amazon EKS managed node groups, and AWS Fargate profiles.""" import warnings -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.exceptions import AirflowException from airflow.providers.amazon.aws.hooks.eks import ( @@ -75,7 +75,7 @@ class EksClusterStateSensor(BaseSensorOperator): :type aws_conn_id: str """ - template_fields = ("cluster_name", "target_state", "aws_conn_id", "region") + template_fields: Sequence[str] = ("cluster_name", "target_state", "aws_conn_id", "region") ui_color = "#ff9900" ui_fgcolor = "#232F3E" @@ -137,7 +137,13 @@ class EksFargateProfileStateSensor(BaseSensorOperator): :type aws_conn_id: str """ - template_fields = ("cluster_name", "fargate_profile_name", "target_state", "aws_conn_id", "region") + template_fields: Sequence[str] = ( + "cluster_name", + "fargate_profile_name", + "target_state", + "aws_conn_id", + "region", + ) ui_color = "#ff9900" ui_fgcolor = "#232F3E" @@ -203,7 +209,13 @@ class EksNodegroupStateSensor(BaseSensorOperator): :type aws_conn_id: str """ - template_fields = ("cluster_name", "nodegroup_name", "target_state", "aws_conn_id", "region") + template_fields: Sequence[str] = ( + "cluster_name", + "nodegroup_name", + "target_state", + "aws_conn_id", + "region", + ) ui_color = "#ff9900" ui_fgcolor = "#232F3E" diff --git a/airflow/providers/amazon/aws/sensors/emr.py b/airflow/providers/amazon/aws/sensors/emr.py index cffcace554943..7353b890b7ff7 100644 --- a/airflow/providers/amazon/aws/sensors/emr.py +++ b/airflow/providers/amazon/aws/sensors/emr.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. import sys -from typing import TYPE_CHECKING, Any, Dict, Iterable, Optional +from typing import TYPE_CHECKING, Any, Dict, Iterable, Optional, Sequence if TYPE_CHECKING: from airflow.utils.context import Context @@ -149,7 +149,7 @@ class EmrContainerSensor(BaseSensorOperator): ) SUCCESS_STATES = ("COMPLETED",) - template_fields = ['virtual_cluster_id', 'job_id'] + template_fields: Sequence[str] = ('virtual_cluster_id', 'job_id') template_ext = () ui_color = '#66c3ff' @@ -206,7 +206,7 @@ class EmrJobFlowSensor(EmrBaseSensor): :type failed_states: list[str] """ - template_fields = ['job_flow_id', 'target_states', 'failed_states'] + template_fields: Sequence[str] = ('job_flow_id', 'target_states', 'failed_states') template_ext = () def __init__( @@ -287,7 +287,7 @@ class EmrStepSensor(EmrBaseSensor): :type failed_states: list[str] """ - template_fields = ['job_flow_id', 'step_id', 'target_states', 'failed_states'] + template_fields: Sequence[str] = ('job_flow_id', 'step_id', 'target_states', 'failed_states') template_ext = () def __init__( diff --git a/airflow/providers/amazon/aws/sensors/glacier.py b/airflow/providers/amazon/aws/sensors/glacier.py index 3dbb00393a647..956316ca1d9d6 100644 --- a/airflow/providers/amazon/aws/sensors/glacier.py +++ b/airflow/providers/amazon/aws/sensors/glacier.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. from enum import Enum -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, Sequence from airflow.exceptions import AirflowException from airflow.providers.amazon.aws.hooks.glacier import GlacierHook @@ -65,7 +65,7 @@ class GlacierJobOperationSensor(BaseSensorOperator): :type mode: str """ - template_fields = ["vault_name", "job_id"] + template_fields: Sequence[str] = ("vault_name", "job_id") def __init__( self, diff --git a/airflow/providers/amazon/aws/sensors/glue.py b/airflow/providers/amazon/aws/sensors/glue.py index b5a6780327271..9372077861871 100644 --- a/airflow/providers/amazon/aws/sensors/glue.py +++ b/airflow/providers/amazon/aws/sensors/glue.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. import warnings -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.exceptions import AirflowException from airflow.providers.amazon.aws.hooks.glue import GlueJobHook @@ -37,7 +37,7 @@ class GlueJobSensor(BaseSensorOperator): :type run_id: str """ - template_fields = ('job_name', 'run_id') + template_fields: Sequence[str] = ('job_name', 'run_id') def __init__(self, *, job_name: str, run_id: str, aws_conn_id: str = 'aws_default', **kwargs): super().__init__(**kwargs) diff --git a/airflow/providers/amazon/aws/sensors/glue_catalog_partition.py b/airflow/providers/amazon/aws/sensors/glue_catalog_partition.py index e187682aa1738..b39dba5b4eab1 100644 --- a/airflow/providers/amazon/aws/sensors/glue_catalog_partition.py +++ b/airflow/providers/amazon/aws/sensors/glue_catalog_partition.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. import warnings -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.providers.amazon.aws.hooks.glue_catalog import GlueCatalogHook from airflow.sensors.base import BaseSensorOperator @@ -52,7 +52,7 @@ class GlueCatalogPartitionSensor(BaseSensorOperator): :type poke_interval: int """ - template_fields = ( + template_fields: Sequence[str] = ( 'database_name', 'table_name', 'expression', diff --git a/airflow/providers/amazon/aws/sensors/redshift_cluster.py b/airflow/providers/amazon/aws/sensors/redshift_cluster.py index 709324c348906..74c2f5edfb36f 100644 --- a/airflow/providers/amazon/aws/sensors/redshift_cluster.py +++ b/airflow/providers/amazon/aws/sensors/redshift_cluster.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.providers.amazon.aws.hooks.redshift_cluster import RedshiftHook from airflow.sensors.base import BaseSensorOperator @@ -34,7 +34,7 @@ class AwsRedshiftClusterSensor(BaseSensorOperator): :type target_status: str """ - template_fields = ('cluster_identifier', 'target_status') + template_fields: Sequence[str] = ('cluster_identifier', 'target_status') def __init__( self, diff --git a/airflow/providers/amazon/aws/sensors/s3.py b/airflow/providers/amazon/aws/sensors/s3.py index fd6dd61a62c35..884318bfda2fa 100644 --- a/airflow/providers/amazon/aws/sensors/s3.py +++ b/airflow/providers/amazon/aws/sensors/s3.py @@ -21,7 +21,7 @@ import re import sys from datetime import datetime -from typing import TYPE_CHECKING, Callable, List, Optional, Set, Union +from typing import TYPE_CHECKING, Callable, List, Optional, Sequence, Set, Union from urllib.parse import urlparse if TYPE_CHECKING: @@ -69,7 +69,7 @@ class S3KeySensor(BaseSensorOperator): :type verify: bool or str """ - template_fields = ('bucket_key', 'bucket_name') + template_fields: Sequence[str] = ('bucket_key', 'bucket_name') def __init__( self, @@ -256,7 +256,7 @@ class S3KeysUnchangedSensor(BaseSensorOperator): :type allow_delete: bool """ - template_fields = ('bucket_name', 'prefix') + template_fields: Sequence[str] = ('bucket_name', 'prefix') def __init__( self, @@ -392,7 +392,7 @@ class S3PrefixSensor(BaseSensorOperator): :type verify: bool or str """ - template_fields = ('prefix', 'bucket_name') + template_fields: Sequence[str] = ('prefix', 'bucket_name') def __init__( self, diff --git a/airflow/providers/amazon/aws/sensors/sagemaker.py b/airflow/providers/amazon/aws/sensors/sagemaker.py index 370058c34544c..69c79317300bc 100644 --- a/airflow/providers/amazon/aws/sensors/sagemaker.py +++ b/airflow/providers/amazon/aws/sensors/sagemaker.py @@ -16,7 +16,7 @@ # under the License. import time -from typing import TYPE_CHECKING, Optional, Set +from typing import TYPE_CHECKING, Optional, Sequence, Set from airflow.exceptions import AirflowException from airflow.providers.amazon.aws.hooks.sagemaker import LogState, SageMakerHook @@ -94,7 +94,7 @@ class SageMakerEndpointSensor(SageMakerBaseSensor): :type job_name: str """ - template_fields = ['endpoint_name'] + template_fields: Sequence[str] = ('endpoint_name',) template_ext = () def __init__(self, *, endpoint_name, **kwargs): @@ -131,7 +131,7 @@ class SageMakerTransformSensor(SageMakerBaseSensor): :type job_name: str """ - template_fields = ['job_name'] + template_fields: Sequence[str] = ('job_name',) template_ext = () def __init__(self, *, job_name: str, **kwargs): @@ -168,7 +168,7 @@ class SageMakerTuningSensor(SageMakerBaseSensor): job_name: str """ - template_fields = ['job_name'] + template_fields: Sequence[str] = ('job_name',) template_ext = () def __init__(self, *, job_name: str, **kwargs): @@ -205,7 +205,7 @@ class SageMakerTrainingSensor(SageMakerBaseSensor): :type print_log: bool """ - template_fields = ['job_name'] + template_fields: Sequence[str] = ('job_name',) template_ext = () def __init__(self, *, job_name, print_log=True, **kwargs): diff --git a/airflow/providers/amazon/aws/sensors/sqs.py b/airflow/providers/amazon/aws/sensors/sqs.py index 94d04cf22561f..fadde9e37a268 100644 --- a/airflow/providers/amazon/aws/sensors/sqs.py +++ b/airflow/providers/amazon/aws/sensors/sqs.py @@ -17,7 +17,7 @@ # under the License. """Reads and then deletes the message from SQS queue""" import json -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any, Optional, Sequence from jsonpath_ng import parse from typing_extensions import Literal @@ -63,7 +63,7 @@ class SQSSensor(BaseSensorOperator): :type message_filtering_config: Any """ - template_fields = ('sqs_queue', 'max_messages', 'message_filtering_config') + template_fields: Sequence[str] = ('sqs_queue', 'max_messages', 'message_filtering_config') def __init__( self, diff --git a/airflow/providers/amazon/aws/sensors/step_function.py b/airflow/providers/amazon/aws/sensors/step_function.py index 4e167357993fa..0a534c1774ff5 100644 --- a/airflow/providers/amazon/aws/sensors/step_function.py +++ b/airflow/providers/amazon/aws/sensors/step_function.py @@ -16,7 +16,7 @@ # under the License. import json -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.exceptions import AirflowException from airflow.providers.amazon.aws.hooks.step_function import StepFunctionHook @@ -49,7 +49,7 @@ class StepFunctionExecutionSensor(BaseSensorOperator): ) SUCCESS_STATES = ('SUCCEEDED',) - template_fields = ['execution_arn'] + template_fields: Sequence[str] = ('execution_arn',) template_ext = () ui_color = '#66c3ff' diff --git a/airflow/providers/amazon/aws/transfers/exasol_to_s3.py b/airflow/providers/amazon/aws/transfers/exasol_to_s3.py index 2db8ff8c9ca34..d3ccf1b9b7961 100644 --- a/airflow/providers/amazon/aws/transfers/exasol_to_s3.py +++ b/airflow/providers/amazon/aws/transfers/exasol_to_s3.py @@ -18,7 +18,7 @@ """Transfers data from Exasol database into a S3 Bucket.""" from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING, Dict, Optional +from typing import TYPE_CHECKING, Dict, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.s3 import S3Hook @@ -58,7 +58,7 @@ class ExasolToS3Operator(BaseOperator): :type export_params: dict """ - template_fields = ('query_or_table', 'key', 'bucket_name', 'query_params', 'export_params') + template_fields: Sequence[str] = ('query_or_table', 'key', 'bucket_name', 'query_params', 'export_params') template_fields_renderers = {"query_or_table": "sql", "query_params": "json", "export_params": "json"} template_ext = ('.sql',) ui_color = '#ededed' diff --git a/airflow/providers/amazon/aws/transfers/ftp_to_s3.py b/airflow/providers/amazon/aws/transfers/ftp_to_s3.py index 4c11b45d0c71d..8bfea305c8076 100644 --- a/airflow/providers/amazon/aws/transfers/ftp_to_s3.py +++ b/airflow/providers/amazon/aws/transfers/ftp_to_s3.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING, List, Optional, Union +from typing import TYPE_CHECKING, List, Optional, Sequence, Union from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.s3 import S3Hook @@ -67,7 +67,7 @@ class FTPToS3Operator(BaseOperator): :type acl_policy: str """ - template_fields = ('ftp_path', 's3_bucket', 's3_key', 'ftp_filenames', 's3_filenames') + template_fields: Sequence[str] = ('ftp_path', 's3_bucket', 's3_key', 'ftp_filenames', 's3_filenames') def __init__( self, diff --git a/airflow/providers/amazon/aws/transfers/gcs_to_s3.py b/airflow/providers/amazon/aws/transfers/gcs_to_s3.py index 4fc715d356aa1..4205683bd4abf 100644 --- a/airflow/providers/amazon/aws/transfers/gcs_to_s3.py +++ b/airflow/providers/amazon/aws/transfers/gcs_to_s3.py @@ -17,7 +17,7 @@ # under the License. """This module contains Google Cloud Storage to S3 operator.""" import warnings -from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Sequence, Union, cast +from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, Union, cast from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.s3 import S3Hook @@ -87,7 +87,7 @@ class GCSToS3Operator(BaseOperator): :type s3_acl_policy: str """ - template_fields: Iterable[str] = ( + template_fields: Sequence[str] = ( 'bucket', 'prefix', 'delimiter', diff --git a/airflow/providers/amazon/aws/transfers/glacier_to_gcs.py b/airflow/providers/amazon/aws/transfers/glacier_to_gcs.py index 909de52499724..48ab9587332f7 100644 --- a/airflow/providers/amazon/aws/transfers/glacier_to_gcs.py +++ b/airflow/providers/amazon/aws/transfers/glacier_to_gcs.py @@ -68,7 +68,7 @@ class GlacierToGCSOperator(BaseOperator): :type google_impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ("vault_name", "bucket_name", "object_name") + template_fields: Sequence[str] = ("vault_name", "bucket_name", "object_name") def __init__( self, diff --git a/airflow/providers/amazon/aws/transfers/google_api_to_s3.py b/airflow/providers/amazon/aws/transfers/google_api_to_s3.py index 878c0ddcd79b1..bfc45e8ace84d 100644 --- a/airflow/providers/amazon/aws/transfers/google_api_to_s3.py +++ b/airflow/providers/amazon/aws/transfers/google_api_to_s3.py @@ -95,7 +95,7 @@ class GoogleApiToS3Operator(BaseOperator): :type google_impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'google_api_endpoint_params', 's3_destination_key', 'google_impersonation_chain', diff --git a/airflow/providers/amazon/aws/transfers/hive_to_dynamodb.py b/airflow/providers/amazon/aws/transfers/hive_to_dynamodb.py index 19a1cc958f228..fb27e627a7452 100644 --- a/airflow/providers/amazon/aws/transfers/hive_to_dynamodb.py +++ b/airflow/providers/amazon/aws/transfers/hive_to_dynamodb.py @@ -19,7 +19,7 @@ """This module contains operator to move data from Hive to DynamoDB.""" import json -from typing import TYPE_CHECKING, Callable, Optional +from typing import TYPE_CHECKING, Callable, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.dynamodb import AwsDynamoDBHook @@ -58,7 +58,7 @@ class HiveToDynamoDBOperator(BaseOperator): :type aws_conn_id: str """ - template_fields = ('sql',) + template_fields: Sequence[str] = ('sql',) template_ext = ('.sql',) ui_color = '#a0e08c' diff --git a/airflow/providers/amazon/aws/transfers/imap_attachment_to_s3.py b/airflow/providers/amazon/aws/transfers/imap_attachment_to_s3.py index 349a59a48433c..2e0800edc13e8 100644 --- a/airflow/providers/amazon/aws/transfers/imap_attachment_to_s3.py +++ b/airflow/providers/amazon/aws/transfers/imap_attachment_to_s3.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. """This module allows you to transfer mail attachments from a mail server into s3 bucket.""" -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.s3 import S3Hook @@ -53,7 +53,7 @@ class ImapAttachmentToS3Operator(BaseOperator): :type s3_conn_id: str """ - template_fields = ('imap_attachment_name', 's3_key', 'imap_mail_filter') + template_fields: Sequence[str] = ('imap_attachment_name', 's3_key', 'imap_mail_filter') def __init__( self, diff --git a/airflow/providers/amazon/aws/transfers/local_to_s3.py b/airflow/providers/amazon/aws/transfers/local_to_s3.py index ad78323d6214e..dac8decb6e904 100644 --- a/airflow/providers/amazon/aws/transfers/local_to_s3.py +++ b/airflow/providers/amazon/aws/transfers/local_to_s3.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Optional, Union +from typing import TYPE_CHECKING, Optional, Sequence, Union from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.s3 import S3Hook @@ -69,7 +69,7 @@ class LocalFilesystemToS3Operator(BaseOperator): :type acl_policy: str """ - template_fields = ('filename', 'dest_key', 'dest_bucket') + template_fields: Sequence[str] = ('filename', 'dest_key', 'dest_bucket') def __init__( self, diff --git a/airflow/providers/amazon/aws/transfers/mongo_to_s3.py b/airflow/providers/amazon/aws/transfers/mongo_to_s3.py index 1deabad3ecabd..3dd60a9d44012 100644 --- a/airflow/providers/amazon/aws/transfers/mongo_to_s3.py +++ b/airflow/providers/amazon/aws/transfers/mongo_to_s3.py @@ -17,7 +17,7 @@ # under the License. import json import warnings -from typing import TYPE_CHECKING, Any, Iterable, Optional, Union, cast +from typing import TYPE_CHECKING, Any, Iterable, Optional, Sequence, Union, cast from bson import json_util @@ -64,7 +64,7 @@ class MongoToS3Operator(BaseOperator): :type compression: str """ - template_fields = ('s3_bucket', 's3_key', 'mongo_query', 'mongo_collection') + template_fields: Sequence[str] = ('s3_bucket', 's3_key', 'mongo_query', 'mongo_collection') ui_color = '#589636' template_fields_renderers = {"mongo_query": "json"} diff --git a/airflow/providers/amazon/aws/transfers/mysql_to_s3.py b/airflow/providers/amazon/aws/transfers/mysql_to_s3.py index 7f48523df3eb2..905160a65f147 100644 --- a/airflow/providers/amazon/aws/transfers/mysql_to_s3.py +++ b/airflow/providers/amazon/aws/transfers/mysql_to_s3.py @@ -21,7 +21,7 @@ from collections import namedtuple from enum import Enum from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING, Optional, Union +from typing import TYPE_CHECKING, Optional, Sequence, Union import numpy as np import pandas as pd @@ -89,7 +89,7 @@ class MySQLToS3Operator(BaseOperator): :type pd_kwargs: dict """ - template_fields = ( + template_fields: Sequence[str] = ( 's3_bucket', 's3_key', 'query', diff --git a/airflow/providers/amazon/aws/transfers/redshift_to_s3.py b/airflow/providers/amazon/aws/transfers/redshift_to_s3.py index ced923a83c791..24a67a56a2df6 100644 --- a/airflow/providers/amazon/aws/transfers/redshift_to_s3.py +++ b/airflow/providers/amazon/aws/transfers/redshift_to_s3.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. """Transfers data from AWS Redshift into a S3 Bucket.""" -from typing import TYPE_CHECKING, Iterable, List, Mapping, Optional, Union +from typing import TYPE_CHECKING, Iterable, List, Mapping, Optional, Sequence, Union from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.redshift_sql import RedshiftSQLHook @@ -76,7 +76,14 @@ class RedshiftToS3Operator(BaseOperator): :type table_as_file_name: bool """ - template_fields = ('s3_bucket', 's3_key', 'schema', 'table', 'unload_options', 'select_query') + template_fields: Sequence[str] = ( + 's3_bucket', + 's3_key', + 'schema', + 'table', + 'unload_options', + 'select_query', + ) template_ext = ('.sql',) template_fields_renderers = {'select_query': 'sql'} ui_color = '#ededed' diff --git a/airflow/providers/amazon/aws/transfers/s3_to_ftp.py b/airflow/providers/amazon/aws/transfers/s3_to_ftp.py index 81c18bf1ae772..e6c55fadcda8a 100644 --- a/airflow/providers/amazon/aws/transfers/s3_to_ftp.py +++ b/airflow/providers/amazon/aws/transfers/s3_to_ftp.py @@ -17,7 +17,7 @@ # under the License. from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.s3 import S3Hook @@ -47,7 +47,7 @@ class S3ToFTPOperator(BaseOperator): :type ftp_conn_id: str """ - template_fields = ('s3_bucket', 's3_key', 'ftp_path') + template_fields: Sequence[str] = ('s3_bucket', 's3_key', 'ftp_path') def __init__( self, diff --git a/airflow/providers/amazon/aws/transfers/s3_to_redshift.py b/airflow/providers/amazon/aws/transfers/s3_to_redshift.py index aa5c32a368577..cec6cee22b22f 100644 --- a/airflow/providers/amazon/aws/transfers/s3_to_redshift.py +++ b/airflow/providers/amazon/aws/transfers/s3_to_redshift.py @@ -16,7 +16,7 @@ # under the License. import warnings -from typing import TYPE_CHECKING, List, Optional, Union +from typing import TYPE_CHECKING, List, Optional, Sequence, Union from airflow.exceptions import AirflowException from airflow.models import BaseOperator @@ -75,7 +75,7 @@ class S3ToRedshiftOperator(BaseOperator): :type upsert_keys: List[str] """ - template_fields = ('s3_bucket', 's3_key', 'schema', 'table', 'column_list', 'copy_options') + template_fields: Sequence[str] = ('s3_bucket', 's3_key', 'schema', 'table', 'column_list', 'copy_options') template_ext = () ui_color = '#99e699' diff --git a/airflow/providers/amazon/aws/transfers/s3_to_sftp.py b/airflow/providers/amazon/aws/transfers/s3_to_sftp.py index 42d1c3c744689..fbfe586a0f645 100644 --- a/airflow/providers/amazon/aws/transfers/s3_to_sftp.py +++ b/airflow/providers/amazon/aws/transfers/s3_to_sftp.py @@ -17,7 +17,7 @@ # under the License. from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from urllib.parse import urlparse from airflow.models import BaseOperator @@ -53,7 +53,7 @@ class S3ToSFTPOperator(BaseOperator): :type s3_key: str """ - template_fields = ('s3_key', 'sftp_path') + template_fields: Sequence[str] = ('s3_key', 'sftp_path') def __init__( self, diff --git a/airflow/providers/amazon/aws/transfers/salesforce_to_s3.py b/airflow/providers/amazon/aws/transfers/salesforce_to_s3.py index 4f353ba08d86f..19fcfd5d531c0 100644 --- a/airflow/providers/amazon/aws/transfers/salesforce_to_s3.py +++ b/airflow/providers/amazon/aws/transfers/salesforce_to_s3.py @@ -17,7 +17,7 @@ import os import tempfile -from typing import TYPE_CHECKING, Dict, Optional +from typing import TYPE_CHECKING, Dict, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.s3 import S3Hook @@ -72,7 +72,7 @@ class SalesforceToS3Operator(BaseOperator): :type acl_policy: str """ - template_fields = ("salesforce_query", "s3_bucket_name", "s3_key") + template_fields: Sequence[str] = ("salesforce_query", "s3_bucket_name", "s3_key") template_ext = (".sql",) template_fields_renderers = {"salesforce_query": "sql"} diff --git a/airflow/providers/amazon/aws/transfers/sftp_to_s3.py b/airflow/providers/amazon/aws/transfers/sftp_to_s3.py index e0339ed24f6c6..f69e2e487e069 100644 --- a/airflow/providers/amazon/aws/transfers/sftp_to_s3.py +++ b/airflow/providers/amazon/aws/transfers/sftp_to_s3.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from urllib.parse import urlparse from airflow.models import BaseOperator @@ -56,7 +56,7 @@ class SFTPToS3Operator(BaseOperator): :type use_temp_file: bool """ - template_fields = ('s3_key', 'sftp_path') + template_fields: Sequence[str] = ('s3_key', 'sftp_path') def __init__( self, diff --git a/airflow/providers/apache/beam/operators/beam.py b/airflow/providers/apache/beam/operators/beam.py index 3e0e0e9083eba..c31a39e99bae0 100644 --- a/airflow/providers/apache/beam/operators/beam.py +++ b/airflow/providers/apache/beam/operators/beam.py @@ -19,7 +19,7 @@ import copy from abc import ABCMeta from contextlib import ExitStack -from typing import TYPE_CHECKING, Callable, List, Optional, Tuple, Union +from typing import TYPE_CHECKING, Callable, List, Optional, Sequence, Tuple, Union from airflow.models import BaseOperator from airflow.providers.apache.beam.hooks.beam import BeamHook, BeamRunnerType @@ -169,7 +169,13 @@ class BeamRunPythonPipelineOperator(BaseOperator, BeamDataflowMixin): :type dataflow_config: Union[dict, providers.google.cloud.operators.dataflow.DataflowConfiguration] """ - template_fields = ["py_file", "runner", "pipeline_options", "default_pipeline_options", "dataflow_config"] + template_fields: Sequence[str] = ( + "py_file", + "runner", + "pipeline_options", + "default_pipeline_options", + "dataflow_config", + ) template_fields_renderers = {'dataflow_config': 'json', 'pipeline_options': 'json'} def __init__( @@ -343,14 +349,14 @@ class BeamRunJavaPipelineOperator(BaseOperator, BeamDataflowMixin): :type dataflow_config: Union[dict, providers.google.cloud.operators.dataflow.DataflowConfiguration] """ - template_fields = [ + template_fields: Sequence[str] = ( "jar", "runner", "job_class", "pipeline_options", "default_pipeline_options", "dataflow_config", - ] + ) template_fields_renderers = {'dataflow_config': 'json', 'pipeline_options': 'json'} ui_color = "#0273d4" diff --git a/airflow/providers/apache/cassandra/sensors/record.py b/airflow/providers/apache/cassandra/sensors/record.py index e301ea343a8a5..08855eb73383d 100644 --- a/airflow/providers/apache/cassandra/sensors/record.py +++ b/airflow/providers/apache/cassandra/sensors/record.py @@ -20,7 +20,7 @@ of a record in a Cassandra cluster. """ -from typing import TYPE_CHECKING, Any, Dict +from typing import TYPE_CHECKING, Any, Dict, Sequence from airflow.providers.apache.cassandra.hooks.cassandra import CassandraHook from airflow.sensors.base import BaseSensorOperator @@ -56,7 +56,7 @@ class CassandraRecordSensor(BaseSensorOperator): :type cassandra_conn_id: str """ - template_fields = ('table', 'keys') + template_fields: Sequence[str] = ('table', 'keys') def __init__( self, diff --git a/airflow/providers/apache/cassandra/sensors/table.py b/airflow/providers/apache/cassandra/sensors/table.py index 0a510cd7fb01b..638d0521c95bb 100644 --- a/airflow/providers/apache/cassandra/sensors/table.py +++ b/airflow/providers/apache/cassandra/sensors/table.py @@ -21,7 +21,7 @@ of a table in a Cassandra cluster. """ -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, Sequence from airflow.providers.apache.cassandra.hooks.cassandra import CassandraHook from airflow.sensors.base import BaseSensorOperator @@ -54,7 +54,7 @@ class CassandraTableSensor(BaseSensorOperator): :type cassandra_conn_id: str """ - template_fields = ('table',) + template_fields: Sequence[str] = ('table',) def __init__( self, diff --git a/airflow/providers/apache/drill/operators/drill.py b/airflow/providers/apache/drill/operators/drill.py index 97f7f864b1d3b..deea6b91270b2 100644 --- a/airflow/providers/apache/drill/operators/drill.py +++ b/airflow/providers/apache/drill/operators/drill.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Iterable, Mapping, Optional, Union +from typing import TYPE_CHECKING, Iterable, Mapping, Optional, Sequence, Union import sqlparse @@ -45,7 +45,7 @@ class DrillOperator(BaseOperator): :type parameters: dict or iterable """ - template_fields = ('sql',) + template_fields: Sequence[str] = ('sql',) template_fields_renderers = {'sql': 'sql'} template_ext = ('.sql',) ui_color = '#ededed' diff --git a/airflow/providers/apache/druid/operators/druid.py b/airflow/providers/apache/druid/operators/druid.py index 4f6f6c5934149..ab3c989519173 100644 --- a/airflow/providers/apache/druid/operators/druid.py +++ b/airflow/providers/apache/druid/operators/druid.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.apache.druid.hooks.druid import DruidHook @@ -41,7 +41,7 @@ class DruidOperator(BaseOperator): :type max_ingestion_time: int """ - template_fields = ('json_index_file',) + template_fields: Sequence[str] = ('json_index_file',) template_ext = ('.json',) template_fields_renderers = {'json_index_file': 'json'} diff --git a/airflow/providers/apache/druid/transfers/hive_to_druid.py b/airflow/providers/apache/druid/transfers/hive_to_druid.py index 531a589379339..6e8a02d01392d 100644 --- a/airflow/providers/apache/druid/transfers/hive_to_druid.py +++ b/airflow/providers/apache/druid/transfers/hive_to_druid.py @@ -18,7 +18,7 @@ """This module contains operator to move data from Hive to Druid.""" -from typing import TYPE_CHECKING, Any, Dict, List, Optional +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.apache.druid.hooks.druid import DruidHook @@ -79,7 +79,7 @@ class HiveToDruidOperator(BaseOperator): :type job_properties: dict """ - template_fields = ('sql', 'intervals') + template_fields: Sequence[str] = ('sql', 'intervals') template_ext = ('.sql',) def __init__( diff --git a/airflow/providers/apache/hdfs/sensors/hdfs.py b/airflow/providers/apache/hdfs/sensors/hdfs.py index d4cddf79d03f6..a130bb14a7d26 100644 --- a/airflow/providers/apache/hdfs/sensors/hdfs.py +++ b/airflow/providers/apache/hdfs/sensors/hdfs.py @@ -18,7 +18,7 @@ import logging import re import sys -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Pattern, Type +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Pattern, Sequence, Type from airflow import settings from airflow.providers.apache.hdfs.hooks.hdfs import HDFSHook @@ -50,7 +50,7 @@ class HdfsSensor(BaseSensorOperator): :ref:`howto/operator:HdfsSensor` """ - template_fields = ('filepath',) + template_fields: Sequence[str] = ('filepath',) ui_color = settings.WEB_COLORS['LIGHTBLUE'] def __init__( diff --git a/airflow/providers/apache/hdfs/sensors/web_hdfs.py b/airflow/providers/apache/hdfs/sensors/web_hdfs.py index 36ffc7e40c08a..adacdefecad07 100644 --- a/airflow/providers/apache/hdfs/sensors/web_hdfs.py +++ b/airflow/providers/apache/hdfs/sensors/web_hdfs.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, Sequence from airflow.sensors.base import BaseSensorOperator @@ -26,7 +26,7 @@ class WebHdfsSensor(BaseSensorOperator): """Waits for a file or folder to land in HDFS""" - template_fields = ('filepath',) + template_fields: Sequence[str] = ('filepath',) def __init__(self, *, filepath: str, webhdfs_conn_id: str = 'webhdfs_default', **kwargs: Any) -> None: super().__init__(**kwargs) diff --git a/airflow/providers/apache/hive/operators/hive.py b/airflow/providers/apache/hive/operators/hive.py index 1244538b17016..db36c00129226 100644 --- a/airflow/providers/apache/hive/operators/hive.py +++ b/airflow/providers/apache/hive/operators/hive.py @@ -17,7 +17,7 @@ # under the License. import os import re -from typing import TYPE_CHECKING, Any, Dict, Optional +from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence from airflow.configuration import conf from airflow.models import BaseOperator @@ -65,7 +65,7 @@ class HiveOperator(BaseOperator): :type mapred_job_name: str """ - template_fields = ( + template_fields: Sequence[str] = ( 'hql', 'schema', 'hive_cli_conn_id', diff --git a/airflow/providers/apache/hive/operators/hive_stats.py b/airflow/providers/apache/hive/operators/hive_stats.py index 47182d39a1426..601d46b887073 100644 --- a/airflow/providers/apache/hive/operators/hive_stats.py +++ b/airflow/providers/apache/hive/operators/hive_stats.py @@ -18,7 +18,7 @@ import json import warnings from collections import OrderedDict -from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional +from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Sequence from airflow.exceptions import AirflowException from airflow.models import BaseOperator @@ -64,7 +64,7 @@ class HiveStatsCollectionOperator(BaseOperator): :type assignment_func: function """ - template_fields = ('table', 'partition', 'ds', 'dttm') + template_fields: Sequence[str] = ('table', 'partition', 'ds', 'dttm') ui_color = '#aff7a6' def __init__( diff --git a/airflow/providers/apache/hive/sensors/hive_partition.py b/airflow/providers/apache/hive/sensors/hive_partition.py index 023ee94315405..4113f54e3abb6 100644 --- a/airflow/providers/apache/hive/sensors/hive_partition.py +++ b/airflow/providers/apache/hive/sensors/hive_partition.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any, Optional, Sequence from airflow.providers.apache.hive.hooks.hive import HiveMetastoreHook from airflow.sensors.base import BaseSensorOperator @@ -45,7 +45,7 @@ class HivePartitionSensor(BaseSensorOperator): :type metastore_conn_id: str """ - template_fields = ( + template_fields: Sequence[str] = ( 'schema', 'table', 'partition', diff --git a/airflow/providers/apache/hive/sensors/metastore_partition.py b/airflow/providers/apache/hive/sensors/metastore_partition.py index 5cd43d37186c1..779db4bcc95b3 100644 --- a/airflow/providers/apache/hive/sensors/metastore_partition.py +++ b/airflow/providers/apache/hive/sensors/metastore_partition.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, Sequence from airflow.sensors.sql import SqlSensor @@ -44,7 +44,7 @@ class MetastorePartitionSensor(SqlSensor): :type mysql_conn_id: str """ - template_fields = ('partition_name', 'table', 'schema') + template_fields: Sequence[str] = ('partition_name', 'table', 'schema') ui_color = '#8da7be' poke_context_fields = ('partition_name', 'table', 'schema', 'mysql_conn_id') diff --git a/airflow/providers/apache/hive/sensors/named_hive_partition.py b/airflow/providers/apache/hive/sensors/named_hive_partition.py index b564e084b0a65..55755db8dac7c 100644 --- a/airflow/providers/apache/hive/sensors/named_hive_partition.py +++ b/airflow/providers/apache/hive/sensors/named_hive_partition.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Any, List, Tuple +from typing import TYPE_CHECKING, Any, List, Sequence, Tuple from airflow.sensors.base import BaseSensorOperator @@ -40,7 +40,7 @@ class NamedHivePartitionSensor(BaseSensorOperator): :type metastore_conn_id: str """ - template_fields = ('partition_names',) + template_fields: Sequence[str] = ('partition_names',) ui_color = '#8d99ae' poke_context_fields = ('partition_names', 'metastore_conn_id') diff --git a/airflow/providers/apache/hive/transfers/hive_to_mysql.py b/airflow/providers/apache/hive/transfers/hive_to_mysql.py index acab2347cb48f..524b0cb8791fa 100644 --- a/airflow/providers/apache/hive/transfers/hive_to_mysql.py +++ b/airflow/providers/apache/hive/transfers/hive_to_mysql.py @@ -18,7 +18,7 @@ """This module contains an operator to move data from Hive to MySQL.""" from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING, Dict, Optional +from typing import TYPE_CHECKING, Dict, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.apache.hive.hooks.hive import HiveServer2Hook @@ -63,7 +63,7 @@ class HiveToMySqlOperator(BaseOperator): :type hive_conf: dict """ - template_fields = ('sql', 'mysql_table', 'mysql_preoperator', 'mysql_postoperator') + template_fields: Sequence[str] = ('sql', 'mysql_table', 'mysql_preoperator', 'mysql_postoperator') template_ext = ('.sql',) ui_color = '#a0e08c' diff --git a/airflow/providers/apache/hive/transfers/hive_to_samba.py b/airflow/providers/apache/hive/transfers/hive_to_samba.py index 546c1e2346e81..49c45bea5669f 100644 --- a/airflow/providers/apache/hive/transfers/hive_to_samba.py +++ b/airflow/providers/apache/hive/transfers/hive_to_samba.py @@ -19,7 +19,7 @@ """This module contains an operator to move data from Hive to Samba.""" from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.models import BaseOperator from airflow.providers.apache.hive.hooks.hive import HiveServer2Hook @@ -46,7 +46,7 @@ class HiveToSambaOperator(BaseOperator): :type hiveserver2_conn_id: str """ - template_fields = ('hql', 'destination_filepath') + template_fields: Sequence[str] = ('hql', 'destination_filepath') template_ext = ( '.hql', '.sql', diff --git a/airflow/providers/apache/hive/transfers/mssql_to_hive.py b/airflow/providers/apache/hive/transfers/mssql_to_hive.py index b1c7fb6413c5e..823d6849d9ca0 100644 --- a/airflow/providers/apache/hive/transfers/mssql_to_hive.py +++ b/airflow/providers/apache/hive/transfers/mssql_to_hive.py @@ -20,7 +20,7 @@ from collections import OrderedDict from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING, Dict, Optional +from typing import TYPE_CHECKING, Dict, Optional, Sequence import pymssql import unicodecsv as csv @@ -72,7 +72,7 @@ class MsSqlToHiveOperator(BaseOperator): :type tblproperties: dict """ - template_fields = ('sql', 'partition', 'hive_table') + template_fields: Sequence[str] = ('sql', 'partition', 'hive_table') template_ext = ('.sql',) ui_color = '#a0e08c' diff --git a/airflow/providers/apache/hive/transfers/mysql_to_hive.py b/airflow/providers/apache/hive/transfers/mysql_to_hive.py index 52f2ec9d7948f..8b3ac85270b6f 100644 --- a/airflow/providers/apache/hive/transfers/mysql_to_hive.py +++ b/airflow/providers/apache/hive/transfers/mysql_to_hive.py @@ -20,7 +20,7 @@ from collections import OrderedDict from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING, Dict, Optional +from typing import TYPE_CHECKING, Dict, Optional, Sequence import MySQLdb import unicodecsv as csv @@ -80,7 +80,7 @@ class MySqlToHiveOperator(BaseOperator): :type tblproperties: dict """ - template_fields = ('sql', 'partition', 'hive_table') + template_fields: Sequence[str] = ('sql', 'partition', 'hive_table') template_ext = ('.sql',) ui_color = '#a0e08c' diff --git a/airflow/providers/apache/hive/transfers/s3_to_hive.py b/airflow/providers/apache/hive/transfers/s3_to_hive.py index 49cfcf19beff3..280726604cbf9 100644 --- a/airflow/providers/apache/hive/transfers/s3_to_hive.py +++ b/airflow/providers/apache/hive/transfers/s3_to_hive.py @@ -23,7 +23,7 @@ import os import tempfile from tempfile import NamedTemporaryFile, TemporaryDirectory -from typing import TYPE_CHECKING, Dict, Optional, Union +from typing import TYPE_CHECKING, Dict, Optional, Sequence, Union from airflow.exceptions import AirflowException from airflow.models import BaseOperator @@ -102,7 +102,7 @@ class S3ToHiveOperator(BaseOperator): :type select_expression: str """ - template_fields = ('s3_key', 'partition', 'hive_table') + template_fields: Sequence[str] = ('s3_key', 'partition', 'hive_table') template_ext = () ui_color = '#a0e08c' diff --git a/airflow/providers/apache/hive/transfers/vertica_to_hive.py b/airflow/providers/apache/hive/transfers/vertica_to_hive.py index f6c5f709895be..16900bd0c92e3 100644 --- a/airflow/providers/apache/hive/transfers/vertica_to_hive.py +++ b/airflow/providers/apache/hive/transfers/vertica_to_hive.py @@ -20,7 +20,7 @@ from collections import OrderedDict from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING, Any, Dict, Optional +from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence import unicodecsv as csv @@ -68,7 +68,7 @@ class VerticaToHiveOperator(BaseOperator): :type hive_cli_conn_id: str """ - template_fields = ('sql', 'partition', 'hive_table') + template_fields: Sequence[str] = ('sql', 'partition', 'hive_table') template_ext = ('.sql',) ui_color = '#b4e0ff' diff --git a/airflow/providers/apache/kylin/operators/kylin_cube.py b/airflow/providers/apache/kylin/operators/kylin_cube.py index 0675a7b0c8224..794efb85b03e3 100644 --- a/airflow/providers/apache/kylin/operators/kylin_cube.py +++ b/airflow/providers/apache/kylin/operators/kylin_cube.py @@ -18,7 +18,7 @@ import time from datetime import datetime -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from kylinpy import kylinpy @@ -88,7 +88,7 @@ class KylinCubeOperator(BaseOperator): :type eager_error_status: tuple """ - template_fields = ( + template_fields: Sequence[str] = ( 'project', 'cube', 'dsn', diff --git a/airflow/providers/apache/livy/operators/livy.py b/airflow/providers/apache/livy/operators/livy.py index 437afc68a44d4..46c59cd51d0f5 100644 --- a/airflow/providers/apache/livy/operators/livy.py +++ b/airflow/providers/apache/livy/operators/livy.py @@ -75,7 +75,7 @@ class LivyOperator(BaseOperator): :type extra_headers: Dict[str, Any] """ - template_fields = ('spark_params',) + template_fields: Sequence[str] = ('spark_params',) def __init__( self, diff --git a/airflow/providers/apache/livy/sensors/livy.py b/airflow/providers/apache/livy/sensors/livy.py index 6beff976b1c90..e6f53f2c5d798 100644 --- a/airflow/providers/apache/livy/sensors/livy.py +++ b/airflow/providers/apache/livy/sensors/livy.py @@ -16,7 +16,7 @@ # under the License. """This module contains the Apache Livy sensor.""" -from typing import TYPE_CHECKING, Any, Dict, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence, Union from airflow.providers.apache.livy.hooks.livy import LivyHook from airflow.sensors.base import BaseSensorOperator @@ -37,7 +37,7 @@ class LivySensor(BaseSensorOperator): depends on the option that's being modified. """ - template_fields = ('batch_id',) + template_fields: Sequence[str] = ('batch_id',) def __init__( self, diff --git a/airflow/providers/apache/pig/operators/pig.py b/airflow/providers/apache/pig/operators/pig.py index 612a2e4762fed..cce970ca1ab0f 100644 --- a/airflow/providers/apache/pig/operators/pig.py +++ b/airflow/providers/apache/pig/operators/pig.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. import re -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.apache.pig.hooks.pig import PigCliHook @@ -43,7 +43,7 @@ class PigOperator(BaseOperator): :type pig_opts: str """ - template_fields = ('pig',) + template_fields: Sequence[str] = ('pig',) template_ext = ( '.pig', '.piglatin', diff --git a/airflow/providers/apache/spark/operators/spark_sql.py b/airflow/providers/apache/spark/operators/spark_sql.py index a045623304c8d..5dd24961c8f2a 100644 --- a/airflow/providers/apache/spark/operators/spark_sql.py +++ b/airflow/providers/apache/spark/operators/spark_sql.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. # -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.apache.spark.hooks.spark_sql import SparkSqlHook @@ -63,7 +63,7 @@ class SparkSqlOperator(BaseOperator): :type yarn_queue: str """ - template_fields = ["_sql"] + template_fields: Sequence[str] = ('_sql',) template_ext = [".sql", ".hql"] def __init__( diff --git a/airflow/providers/apache/spark/operators/spark_submit.py b/airflow/providers/apache/spark/operators/spark_submit.py index 5899735ce2f5c..c418825d17ab4 100644 --- a/airflow/providers/apache/spark/operators/spark_submit.py +++ b/airflow/providers/apache/spark/operators/spark_submit.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. # -from typing import TYPE_CHECKING, Any, Dict, List, Optional +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.apache.spark.hooks.spark_submit import SparkSubmitHook @@ -97,7 +97,7 @@ class SparkSubmitOperator(BaseOperator): :type spark_binary: str """ - template_fields = ( + template_fields: Sequence[str] = ( '_application', '_conf', '_files', diff --git a/airflow/providers/apache/sqoop/operators/sqoop.py b/airflow/providers/apache/sqoop/operators/sqoop.py index a23057ab886ad..32a4159e31e7b 100644 --- a/airflow/providers/apache/sqoop/operators/sqoop.py +++ b/airflow/providers/apache/sqoop/operators/sqoop.py @@ -19,7 +19,7 @@ """This module contains a sqoop 1 operator""" import os import signal -from typing import TYPE_CHECKING, Any, Dict, Optional +from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence from airflow.exceptions import AirflowException from airflow.models import BaseOperator @@ -83,7 +83,7 @@ class SqoopOperator(BaseOperator): Don't include prefix of -- for sqoop options. """ - template_fields = ( + template_fields: Sequence[str] = ( 'conn_id', 'cmd_type', 'table', diff --git a/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py b/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py index e308724661168..be2d77585597d 100644 --- a/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py +++ b/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py @@ -20,7 +20,7 @@ import re import warnings from contextlib import AbstractContextManager -from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence from kubernetes.client import CoreV1Api, models as k8s @@ -184,7 +184,7 @@ class KubernetesPodOperator(BaseOperator): BASE_CONTAINER_NAME = 'base' POD_CHECKED_KEY = 'already_checked' - template_fields: Iterable[str] = ( + template_fields: Sequence[str] = ( 'image', 'cmds', 'arguments', diff --git a/airflow/providers/cncf/kubernetes/operators/spark_kubernetes.py b/airflow/providers/cncf/kubernetes/operators/spark_kubernetes.py index f654d1a5c3611..567b788693263 100644 --- a/airflow/providers/cncf/kubernetes/operators/spark_kubernetes.py +++ b/airflow/providers/cncf/kubernetes/operators/spark_kubernetes.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.cncf.kubernetes.hooks.kubernetes import KubernetesHook @@ -46,7 +46,7 @@ class SparkKubernetesOperator(BaseOperator): :type api_version: str """ - template_fields = ['application_file', 'namespace'] + template_fields: Sequence[str] = ('application_file', 'namespace') template_ext = ('.yaml', '.yml', '.json') ui_color = '#f4a460' diff --git a/airflow/providers/cncf/kubernetes/sensors/spark_kubernetes.py b/airflow/providers/cncf/kubernetes/sensors/spark_kubernetes.py index 450ca2b4c90a1..8b2423491933a 100644 --- a/airflow/providers/cncf/kubernetes/sensors/spark_kubernetes.py +++ b/airflow/providers/cncf/kubernetes/sensors/spark_kubernetes.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from kubernetes import client @@ -50,7 +50,7 @@ class SparkKubernetesSensor(BaseSensorOperator): :type api_version: str """ - template_fields = ("application_name", "namespace") + template_fields: Sequence[str] = ("application_name", "namespace") FAILURE_STATES = ("FAILED", "UNKNOWN") SUCCESS_STATES = ("COMPLETED",) diff --git a/airflow/providers/databricks/operators/databricks.py b/airflow/providers/databricks/operators/databricks.py index 3d6d4bdb0c6a1..5aa4ec82a392f 100644 --- a/airflow/providers/databricks/operators/databricks.py +++ b/airflow/providers/databricks/operators/databricks.py @@ -19,7 +19,7 @@ """This module contains Databricks operators.""" import time -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Union from airflow.exceptions import AirflowException from airflow.models import BaseOperator @@ -261,7 +261,7 @@ class DatabricksSubmitRunOperator(BaseOperator): """ # Used in airflow.models.BaseOperator - template_fields = ('json',) + template_fields: Sequence[str] = ('json',) # Databricks brand color (blue) under white text ui_color = '#1CB1C2' ui_fgcolor = '#fff' @@ -500,7 +500,7 @@ class DatabricksRunNowOperator(BaseOperator): """ # Used in airflow.models.BaseOperator - template_fields = ('json',) + template_fields: Sequence[str] = ('json',) # Databricks brand color (blue) under white text ui_color = '#1CB1C2' ui_fgcolor = '#fff' diff --git a/airflow/providers/dingding/operators/dingding.py b/airflow/providers/dingding/operators/dingding.py index b6f77bf99d317..c5a6110e44f0e 100644 --- a/airflow/providers/dingding/operators/dingding.py +++ b/airflow/providers/dingding/operators/dingding.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, List, Optional, Union +from typing import TYPE_CHECKING, List, Optional, Sequence, Union from airflow.models import BaseOperator from airflow.providers.dingding.hooks.dingding import DingdingHook @@ -46,7 +46,7 @@ class DingdingOperator(BaseOperator): :type at_all: bool """ - template_fields = ('message',) + template_fields: Sequence[str] = ('message',) ui_color = '#4ea4d4' # Dingding icon color def __init__( diff --git a/airflow/providers/discord/operators/discord_webhook.py b/airflow/providers/discord/operators/discord_webhook.py index f19e85929656e..a4ef6bdcf0036 100644 --- a/airflow/providers/discord/operators/discord_webhook.py +++ b/airflow/providers/discord/operators/discord_webhook.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. # -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.exceptions import AirflowException from airflow.providers.discord.hooks.discord_webhook import DiscordWebhookHook @@ -56,7 +56,7 @@ class DiscordWebhookOperator(SimpleHttpOperator): :type proxy: str """ - template_fields = ['username', 'message'] + template_fields: Sequence[str] = ('username', 'message') def __init__( self, diff --git a/airflow/providers/docker/decorators/docker.py b/airflow/providers/docker/decorators/docker.py index 7a560f537969c..8870b08d6f713 100644 --- a/airflow/providers/docker/decorators/docker.py +++ b/airflow/providers/docker/decorators/docker.py @@ -21,7 +21,7 @@ import pickle from tempfile import TemporaryDirectory from textwrap import dedent -from typing import TYPE_CHECKING, Callable, Dict, Iterable, List, Optional, TypeVar, Union +from typing import TYPE_CHECKING, Callable, Dict, Iterable, List, Optional, Sequence, TypeVar, Union import dill @@ -65,7 +65,7 @@ class _DockerDecoratedOperator(DecoratedOperator, DockerOperator): :type multiple_outputs: bool """ - template_fields = ('op_args', 'op_kwargs') + template_fields: Sequence[str] = ('op_args', 'op_kwargs') # since we won't mutate the arguments, we should just do the shallow copy # there are some cases we can't deepcopy the objects (e.g protobuf). diff --git a/airflow/providers/exasol/operators/exasol.py b/airflow/providers/exasol/operators/exasol.py index 15f874374007a..0fddab13115d8 100644 --- a/airflow/providers/exasol/operators/exasol.py +++ b/airflow/providers/exasol/operators/exasol.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.exasol.hooks.exasol import ExasolHook @@ -43,7 +43,7 @@ class ExasolOperator(BaseOperator): :type schema: string """ - template_fields = ('sql',) + template_fields: Sequence[str] = ('sql',) template_ext = ('.sql',) ui_color = '#ededed' diff --git a/airflow/providers/ftp/sensors/ftp.py b/airflow/providers/ftp/sensors/ftp.py index 35a08c0a8a3fa..7e30fd0663f99 100644 --- a/airflow/providers/ftp/sensors/ftp.py +++ b/airflow/providers/ftp/sensors/ftp.py @@ -17,7 +17,7 @@ # under the License. import ftplib import re -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.providers.ftp.hooks.ftp import FTPHook, FTPSHook from airflow.sensors.base import BaseSensorOperator @@ -40,7 +40,7 @@ class FTPSensor(BaseSensorOperator): :type ftp_conn_id: str """ - template_fields = ('path',) + template_fields: Sequence[str] = ('path',) """Errors that are transient in nature, and where action can be retried""" transient_errors = [421, 425, 426, 434, 450, 451, 452] diff --git a/airflow/providers/google/ads/operators/ads.py b/airflow/providers/google/ads/operators/ads.py index 8fb64203d98d8..7634ce96ae951 100644 --- a/airflow/providers/google/ads/operators/ads.py +++ b/airflow/providers/google/ads/operators/ads.py @@ -68,7 +68,7 @@ class GoogleAdsListAccountsOperator(BaseOperator): :type api_version: Optional[str] """ - template_fields = ( + template_fields: Sequence[str] = ( "bucket", "object_name", "impersonation_chain", diff --git a/airflow/providers/google/ads/transfers/ads_to_gcs.py b/airflow/providers/google/ads/transfers/ads_to_gcs.py index 39cff0a55134a..915a7d5ee02b4 100644 --- a/airflow/providers/google/ads/transfers/ads_to_gcs.py +++ b/airflow/providers/google/ads/transfers/ads_to_gcs.py @@ -73,7 +73,7 @@ class GoogleAdsToGcsOperator(BaseOperator): :type api_version: Optional[str] """ - template_fields = ( + template_fields: Sequence[str] = ( "client_ids", "query", "attributes", diff --git a/airflow/providers/google/cloud/operators/automl.py b/airflow/providers/google/cloud/operators/automl.py index 1b15798e48b18..2a739faec1cd8 100644 --- a/airflow/providers/google/cloud/operators/automl.py +++ b/airflow/providers/google/cloud/operators/automl.py @@ -76,7 +76,7 @@ class AutoMLTrainModelOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "model", "location", "project_id", @@ -169,7 +169,7 @@ class AutoMLPredictOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "model_id", "location", "project_id", @@ -274,7 +274,7 @@ class AutoMLBatchPredictOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "model_id", "input_config", "output_config", @@ -374,7 +374,7 @@ class AutoMLCreateDatasetOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "dataset", "location", "project_id", @@ -468,7 +468,7 @@ class AutoMLImportDataOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "dataset_id", "input_config", "location", @@ -570,7 +570,7 @@ class AutoMLTablesListColumnSpecsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "dataset_id", "table_spec_id", "field_mask", @@ -674,7 +674,7 @@ class AutoMLTablesUpdateDatasetOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "dataset", "update_mask", "location", @@ -760,7 +760,7 @@ class AutoMLGetModelOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "model_id", "location", "project_id", @@ -845,7 +845,7 @@ class AutoMLDeleteModelOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "model_id", "location", "project_id", @@ -939,7 +939,7 @@ class AutoMLDeployModelOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "model_id", "location", "project_id", @@ -1036,7 +1036,7 @@ class AutoMLTablesListTableSpecsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "dataset_id", "filter_", "location", @@ -1127,7 +1127,7 @@ class AutoMLListDatasetOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "project_id", "impersonation_chain", @@ -1215,7 +1215,7 @@ class AutoMLDeleteDatasetOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "dataset_id", "location", "project_id", diff --git a/airflow/providers/google/cloud/operators/bigquery.py b/airflow/providers/google/cloud/operators/bigquery.py index 546ae06c7f9b2..d8aa6b38c857c 100644 --- a/airflow/providers/google/cloud/operators/bigquery.py +++ b/airflow/providers/google/cloud/operators/bigquery.py @@ -164,7 +164,7 @@ class BigQueryCheckOperator(_BigQueryDbHookMixin, SQLCheckOperator): :type labels: dict """ - template_fields = ( + template_fields: Sequence[str] = ( 'sql', 'gcp_conn_id', 'impersonation_chain', @@ -232,7 +232,7 @@ class BigQueryValueCheckOperator(_BigQueryDbHookMixin, SQLValueCheckOperator): :type labels: dict """ - template_fields = ( + template_fields: Sequence[str] = ( 'sql', 'gcp_conn_id', 'pass_value', @@ -316,7 +316,7 @@ class BigQueryIntervalCheckOperator(_BigQueryDbHookMixin, SQLIntervalCheckOperat :type labels: dict """ - template_fields = ( + template_fields: Sequence[str] = ( 'table', 'gcp_conn_id', 'sql1', @@ -424,7 +424,7 @@ class BigQueryGetDataOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'dataset_id', 'table_id', 'max_results', @@ -597,7 +597,7 @@ class BigQueryExecuteQueryOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'sql', 'destination_dataset_table', 'labels', @@ -880,7 +880,7 @@ class BigQueryCreateEmptyTableOperator(BaseOperator): :type exists_ok: bool """ - template_fields = ( + template_fields: Sequence[str] = ( 'dataset_id', 'table_id', 'project_id', @@ -1079,7 +1079,7 @@ class BigQueryCreateExternalTableOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'bucket', 'source_objects', 'schema_object', @@ -1286,7 +1286,7 @@ class BigQueryDeleteDatasetOperator(BaseOperator): dag=dag) """ - template_fields = ( + template_fields: Sequence[str] = ( 'dataset_id', 'project_id', 'impersonation_chain', @@ -1387,7 +1387,7 @@ class BigQueryCreateEmptyDatasetOperator(BaseOperator): dag=dag) """ - template_fields = ( + template_fields: Sequence[str] = ( 'dataset_id', 'project_id', 'dataset_reference', @@ -1486,7 +1486,7 @@ class BigQueryGetDatasetOperator(BaseOperator): https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#resource """ - template_fields = ( + template_fields: Sequence[str] = ( 'dataset_id', 'project_id', 'impersonation_chain', @@ -1555,7 +1555,7 @@ class BigQueryGetDatasetTablesOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'dataset_id', 'project_id', 'impersonation_chain', @@ -1632,7 +1632,7 @@ class BigQueryPatchDatasetOperator(BaseOperator): https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#resource """ - template_fields = ( + template_fields: Sequence[str] = ( 'dataset_id', 'project_id', 'impersonation_chain', @@ -1722,7 +1722,7 @@ class BigQueryUpdateTableOperator(BaseOperator): https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#resource """ - template_fields = ( + template_fields: Sequence[str] = ( 'dataset_id', 'table_id', 'project_id', @@ -1813,7 +1813,7 @@ class BigQueryUpdateDatasetOperator(BaseOperator): https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#resource """ - template_fields = ( + template_fields: Sequence[str] = ( 'dataset_id', 'project_id', 'impersonation_chain', @@ -1896,7 +1896,7 @@ class BigQueryDeleteTableOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'deletion_dataset_table', 'impersonation_chain', ) @@ -1983,7 +1983,7 @@ class BigQueryUpsertTableOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'dataset_id', 'table_resource', 'impersonation_chain', @@ -2100,7 +2100,7 @@ class BigQueryUpdateTableSchemaOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'schema_fields_updates', 'dataset_id', 'table_id', @@ -2209,7 +2209,7 @@ class BigQueryInsertJobOperator(BaseOperator): :type cancel_on_kill: bool """ - template_fields = ( + template_fields: Sequence[str] = ( "configuration", "job_id", "impersonation_chain", diff --git a/airflow/providers/google/cloud/operators/bigquery_dts.py b/airflow/providers/google/cloud/operators/bigquery_dts.py index dc30f661859ec..0637734eb3524 100644 --- a/airflow/providers/google/cloud/operators/bigquery_dts.py +++ b/airflow/providers/google/cloud/operators/bigquery_dts.py @@ -69,7 +69,7 @@ class BigQueryCreateDataTransferOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "transfer_config", "project_id", "authorization_code", @@ -158,7 +158,7 @@ class BigQueryDeleteDataTransferConfigOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "transfer_config_id", "project_id", "gcp_conn_id", @@ -250,7 +250,7 @@ class BigQueryDataTransferServiceStartTransferRunsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "transfer_config_id", "project_id", "requested_time_range", diff --git a/airflow/providers/google/cloud/operators/bigtable.py b/airflow/providers/google/cloud/operators/bigtable.py index 06b9547bbf2fc..2895d0d2a258d 100644 --- a/airflow/providers/google/cloud/operators/bigtable.py +++ b/airflow/providers/google/cloud/operators/bigtable.py @@ -104,13 +104,13 @@ class BigtableCreateInstanceOperator(BaseOperator, BigtableValidationMixin): """ REQUIRED_ATTRIBUTES: Iterable[str] = ('instance_id', 'main_cluster_id', 'main_cluster_zone') - template_fields: Iterable[str] = [ + template_fields: Sequence[str] = ( 'project_id', 'instance_id', 'main_cluster_id', 'main_cluster_zone', 'impersonation_chain', - ] + ) def __init__( self, @@ -225,11 +225,11 @@ class BigtableUpdateInstanceOperator(BaseOperator, BigtableValidationMixin): """ REQUIRED_ATTRIBUTES: Iterable[str] = ['instance_id'] - template_fields: Iterable[str] = [ + template_fields: Sequence[str] = ( 'project_id', 'instance_id', 'impersonation_chain', - ] + ) def __init__( self, @@ -308,11 +308,11 @@ class BigtableDeleteInstanceOperator(BaseOperator, BigtableValidationMixin): """ REQUIRED_ATTRIBUTES = ('instance_id',) # type: Iterable[str] - template_fields = [ + template_fields: Sequence[str] = ( 'project_id', 'instance_id', 'impersonation_chain', - ] # type: Iterable[str] + ) def __init__( self, @@ -388,12 +388,12 @@ class BigtableCreateTableOperator(BaseOperator, BigtableValidationMixin): """ REQUIRED_ATTRIBUTES = ('instance_id', 'table_id') # type: Iterable[str] - template_fields = [ + template_fields: Sequence[str] = ( 'project_id', 'instance_id', 'table_id', 'impersonation_chain', - ] # type: Iterable[str] + ) def __init__( self, @@ -497,12 +497,12 @@ class BigtableDeleteTableOperator(BaseOperator, BigtableValidationMixin): """ REQUIRED_ATTRIBUTES = ('instance_id', 'table_id') # type: Iterable[str] - template_fields = [ + template_fields: Sequence[str] = ( 'project_id', 'instance_id', 'table_id', 'impersonation_chain', - ] # type: Iterable[str] + ) def __init__( self, @@ -581,13 +581,13 @@ class BigtableUpdateClusterOperator(BaseOperator, BigtableValidationMixin): """ REQUIRED_ATTRIBUTES = ('instance_id', 'cluster_id', 'nodes') # type: Iterable[str] - template_fields = [ + template_fields: Sequence[str] = ( 'project_id', 'instance_id', 'cluster_id', 'nodes', 'impersonation_chain', - ] # type: Iterable[str] + ) def __init__( self, diff --git a/airflow/providers/google/cloud/operators/cloud_build.py b/airflow/providers/google/cloud/operators/cloud_build.py index ee52df3096a93..a5f20b1aa35fc 100644 --- a/airflow/providers/google/cloud/operators/cloud_build.py +++ b/airflow/providers/google/cloud/operators/cloud_build.py @@ -76,7 +76,7 @@ class CloudBuildCancelBuildOperator(BaseOperator): :rtype: dict """ - template_fields = ("project_id", "id_", "gcp_conn_id") + template_fields: Sequence[str] = ("project_id", "id_", "gcp_conn_id") def __init__( self, @@ -154,7 +154,7 @@ class CloudBuildCreateBuildOperator(BaseOperator): :rtype: dict """ - template_fields = ("project_id", "build", "body", "gcp_conn_id", "impersonation_chain") + template_fields: Sequence[str] = ("project_id", "build", "body", "gcp_conn_id", "impersonation_chain") def __init__( self, @@ -257,7 +257,7 @@ class CloudBuildCreateBuildTriggerOperator(BaseOperator): :rtype: dict """ - template_fields = ("project_id", "trigger", "gcp_conn_id") + template_fields: Sequence[str] = ("project_id", "trigger", "gcp_conn_id") def __init__( self, @@ -326,7 +326,7 @@ class CloudBuildDeleteBuildTriggerOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ("project_id", "trigger_id", "gcp_conn_id") + template_fields: Sequence[str] = ("project_id", "trigger_id", "gcp_conn_id") def __init__( self, @@ -396,7 +396,7 @@ class CloudBuildGetBuildOperator(BaseOperator): :rtype: dict """ - template_fields = ("project_id", "id_", "gcp_conn_id") + template_fields: Sequence[str] = ("project_id", "id_", "gcp_conn_id") def __init__( self, @@ -467,7 +467,7 @@ class CloudBuildGetBuildTriggerOperator(BaseOperator): :rtype: dict """ - template_fields = ("project_id", "trigger_id", "gcp_conn_id") + template_fields: Sequence[str] = ("project_id", "trigger_id", "gcp_conn_id") def __init__( self, @@ -542,7 +542,7 @@ class CloudBuildListBuildTriggersOperator(BaseOperator): :rtype: List[dict] """ - template_fields = ("location", "project_id", "gcp_conn_id") + template_fields: Sequence[str] = ("location", "project_id", "gcp_conn_id") def __init__( self, @@ -623,7 +623,7 @@ class CloudBuildListBuildsOperator(BaseOperator): :rtype: List[dict] """ - template_fields = ("location", "project_id", "gcp_conn_id") + template_fields: Sequence[str] = ("location", "project_id", "gcp_conn_id") def __init__( self, @@ -703,7 +703,7 @@ class CloudBuildRetryBuildOperator(BaseOperator): :rtype: dict """ - template_fields = ("project_id", "id_", "gcp_conn_id") + template_fields: Sequence[str] = ("project_id", "id_", "gcp_conn_id") def __init__( self, @@ -782,7 +782,7 @@ class CloudBuildRunBuildTriggerOperator(BaseOperator): :rtype: dict """ - template_fields = ("project_id", "trigger_id", "source", "gcp_conn_id") + template_fields: Sequence[str] = ("project_id", "trigger_id", "source", "gcp_conn_id") def __init__( self, @@ -862,7 +862,7 @@ class CloudBuildUpdateBuildTriggerOperator(BaseOperator): :rtype: dict """ - template_fields = ("project_id", "trigger_id", "trigger", "gcp_conn_id") + template_fields: Sequence[str] = ("project_id", "trigger_id", "trigger", "gcp_conn_id") def __init__( self, diff --git a/airflow/providers/google/cloud/operators/cloud_memorystore.py b/airflow/providers/google/cloud/operators/cloud_memorystore.py index c880fb215de9e..bcae7938e6921 100644 --- a/airflow/providers/google/cloud/operators/cloud_memorystore.py +++ b/airflow/providers/google/cloud/operators/cloud_memorystore.py @@ -84,7 +84,7 @@ class CloudMemorystoreCreateInstanceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "instance_id", "instance", @@ -173,7 +173,7 @@ class CloudMemorystoreDeleteInstanceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "instance", "project_id", @@ -263,7 +263,7 @@ class CloudMemorystoreExportInstanceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "instance", "output_config", @@ -355,7 +355,7 @@ class CloudMemorystoreFailoverInstanceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "instance", "data_protection_mode", @@ -442,7 +442,7 @@ class CloudMemorystoreGetInstanceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "instance", "project_id", @@ -534,7 +534,7 @@ class CloudMemorystoreImportOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "instance", "input_config", @@ -625,7 +625,7 @@ class CloudMemorystoreListInstancesOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "page_size", "project_id", @@ -728,7 +728,7 @@ class CloudMemorystoreUpdateInstanceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "update_mask", "instance", "location", @@ -822,7 +822,7 @@ class CloudMemorystoreScaleInstanceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "memory_size_gb", "location", "instance_id", @@ -933,7 +933,7 @@ class CloudMemorystoreCreateInstanceAndImportOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "instance_id", "instance", @@ -1042,7 +1042,7 @@ class CloudMemorystoreExportAndDeleteInstanceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "instance", "output_config", @@ -1135,7 +1135,7 @@ class CloudMemorystoreMemcachedApplyParametersOperator(BaseOperator): :type metadata: Sequence[Tuple[str, str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "node_ids", "apply_all", "location", @@ -1233,7 +1233,7 @@ class CloudMemorystoreMemcachedCreateInstanceOperator(BaseOperator): :type gcp_conn_id: str """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "instance_id", "instance", @@ -1308,7 +1308,15 @@ class CloudMemorystoreMemcachedDeleteInstanceOperator(BaseOperator): :type gcp_conn_id: str """ - template_fields = ("location", "instance", "project_id", "retry", "timeout", "metadata", "gcp_conn_id") + template_fields: Sequence[str] = ( + "location", + "instance", + "project_id", + "retry", + "timeout", + "metadata", + "gcp_conn_id", + ) def __init__( self, @@ -1378,7 +1386,7 @@ class CloudMemorystoreMemcachedGetInstanceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "instance", "project_id", @@ -1463,7 +1471,7 @@ class CloudMemorystoreMemcachedListInstancesOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "project_id", "retry", @@ -1559,7 +1567,7 @@ class CloudMemorystoreMemcachedUpdateInstanceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "update_mask", "instance", "location", @@ -1651,7 +1659,7 @@ class CloudMemorystoreMemcachedUpdateParametersOperator(BaseOperator): :type metadata: Sequence[Tuple[str, str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "update_mask", "parameters", "location", diff --git a/airflow/providers/google/cloud/operators/cloud_sql.py b/airflow/providers/google/cloud/operators/cloud_sql.py index 524cfc06add55..9478975bb0552 100644 --- a/airflow/providers/google/cloud/operators/cloud_sql.py +++ b/airflow/providers/google/cloud/operators/cloud_sql.py @@ -301,7 +301,7 @@ class CloudSQLCreateInstanceOperator(CloudSQLBaseOperator): """ # [START gcp_sql_create_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'instance', 'body', @@ -402,7 +402,7 @@ class CloudSQLInstancePatchOperator(CloudSQLBaseOperator): """ # [START gcp_sql_patch_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'instance', 'body', @@ -482,7 +482,7 @@ class CloudSQLDeleteInstanceOperator(CloudSQLBaseOperator): """ # [START gcp_sql_delete_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'instance', 'gcp_conn_id', @@ -538,7 +538,7 @@ class CloudSQLCreateInstanceDatabaseOperator(CloudSQLBaseOperator): """ # [START gcp_sql_db_create_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'instance', 'body', @@ -645,7 +645,7 @@ class CloudSQLPatchInstanceDatabaseOperator(CloudSQLBaseOperator): """ # [START gcp_sql_db_patch_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'instance', 'body', @@ -743,7 +743,7 @@ class CloudSQLDeleteInstanceDatabaseOperator(CloudSQLBaseOperator): """ # [START gcp_sql_db_delete_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'instance', 'database', @@ -835,7 +835,7 @@ class CloudSQLExportInstanceOperator(CloudSQLBaseOperator): """ # [START gcp_sql_export_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'instance', 'body', @@ -939,7 +939,7 @@ class CloudSQLImportInstanceOperator(CloudSQLBaseOperator): """ # [START gcp_sql_import_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'instance', 'body', @@ -1024,7 +1024,7 @@ class CloudSQLExecuteQueryOperator(BaseOperator): """ # [START gcp_sql_query_template_fields] - template_fields = ('sql', 'gcp_cloudsql_conn_id', 'gcp_conn_id') + template_fields: Sequence[str] = ('sql', 'gcp_cloudsql_conn_id', 'gcp_conn_id') template_ext = ('.sql',) # [END gcp_sql_query_template_fields] diff --git a/airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py b/airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py index 709077b6f7dd9..29bcd1bf65b96 100644 --- a/airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +++ b/airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py @@ -215,7 +215,7 @@ class CloudDataTransferServiceCreateJobOperator(BaseOperator): """ # [START gcp_transfer_job_create_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'body', 'gcp_conn_id', 'aws_conn_id', @@ -293,7 +293,7 @@ class CloudDataTransferServiceUpdateJobOperator(BaseOperator): """ # [START gcp_transfer_job_update_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'job_name', 'body', 'gcp_conn_id', @@ -370,7 +370,7 @@ class CloudDataTransferServiceDeleteJobOperator(BaseOperator): """ # [START gcp_transfer_job_delete_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'job_name', 'project_id', 'gcp_conn_id', @@ -439,7 +439,7 @@ class CloudDataTransferServiceGetOperationOperator(BaseOperator): """ # [START gcp_transfer_operation_get_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'operation_name', 'gcp_conn_id', 'google_impersonation_chain', @@ -505,7 +505,7 @@ class CloudDataTransferServiceListOperationsOperator(BaseOperator): """ # [START gcp_transfer_operations_list_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'filter', 'gcp_conn_id', 'google_impersonation_chain', @@ -577,7 +577,7 @@ class CloudDataTransferServicePauseOperationOperator(BaseOperator): """ # [START gcp_transfer_operation_pause_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'operation_name', 'gcp_conn_id', 'api_version', @@ -640,7 +640,7 @@ class CloudDataTransferServiceResumeOperationOperator(BaseOperator): """ # [START gcp_transfer_operation_resume_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'operation_name', 'gcp_conn_id', 'api_version', @@ -704,7 +704,7 @@ class CloudDataTransferServiceCancelOperationOperator(BaseOperator): """ # [START gcp_transfer_operation_cancel_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'operation_name', 'gcp_conn_id', 'api_version', @@ -820,7 +820,7 @@ class CloudDataTransferServiceS3ToGCSOperator(BaseOperator): :type delete_job_after_completion: bool """ - template_fields = ( + template_fields: Sequence[str] = ( 'gcp_conn_id', 's3_bucket', 'gcs_bucket', @@ -1006,7 +1006,7 @@ class CloudDataTransferServiceGCSToGCSOperator(BaseOperator): :type delete_job_after_completion: bool """ - template_fields = ( + template_fields: Sequence[str] = ( 'gcp_conn_id', 'source_bucket', 'destination_bucket', diff --git a/airflow/providers/google/cloud/operators/compute.py b/airflow/providers/google/cloud/operators/compute.py index 604bab632f533..090d131844f5d 100644 --- a/airflow/providers/google/cloud/operators/compute.py +++ b/airflow/providers/google/cloud/operators/compute.py @@ -102,7 +102,7 @@ class ComputeEngineStartInstanceOperator(ComputeEngineBaseOperator): """ # [START gce_instance_start_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'zone', 'resource_id', @@ -155,7 +155,7 @@ class ComputeEngineStopInstanceOperator(ComputeEngineBaseOperator): """ # [START gce_instance_stop_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'zone', 'resource_id', @@ -220,7 +220,7 @@ class ComputeEngineSetMachineTypeOperator(ComputeEngineBaseOperator): """ # [START gce_instance_set_machine_type_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'zone', 'resource_id', @@ -383,7 +383,7 @@ class ComputeEngineCopyInstanceTemplateOperator(ComputeEngineBaseOperator): """ # [START gce_instance_template_copy_operator_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'resource_id', 'request_id', @@ -516,7 +516,7 @@ class ComputeEngineInstanceGroupUpdateManagerTemplateOperator(ComputeEngineBaseO """ # [START gce_igm_update_template_operator_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'resource_id', 'zone', diff --git a/airflow/providers/google/cloud/operators/datacatalog.py b/airflow/providers/google/cloud/operators/datacatalog.py index bb0715bd98731..53a8d77770204 100644 --- a/airflow/providers/google/cloud/operators/datacatalog.py +++ b/airflow/providers/google/cloud/operators/datacatalog.py @@ -84,7 +84,7 @@ class CloudDataCatalogCreateEntryOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "entry_group", "entry_id", @@ -202,7 +202,7 @@ class CloudDataCatalogCreateEntryGroupOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "entry_group_id", "entry_group", @@ -317,7 +317,7 @@ class CloudDataCatalogCreateTagOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "entry_group", "entry", @@ -452,7 +452,7 @@ class CloudDataCatalogCreateTagTemplateOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "tag_template_id", "tag_template", @@ -568,7 +568,7 @@ class CloudDataCatalogCreateTagTemplateFieldOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "tag_template", "tag_template_field_id", @@ -679,7 +679,7 @@ class CloudDataCatalogDeleteEntryOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "entry_group", "entry", @@ -773,7 +773,7 @@ class CloudDataCatalogDeleteEntryGroupOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "entry_group", "project_id", @@ -865,7 +865,7 @@ class CloudDataCatalogDeleteTagOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "entry_group", "entry", @@ -965,7 +965,7 @@ class CloudDataCatalogDeleteTagTemplateOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "tag_template", "force", @@ -1061,7 +1061,7 @@ class CloudDataCatalogDeleteTagTemplateFieldOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "tag_template", "field", @@ -1159,7 +1159,7 @@ class CloudDataCatalogGetEntryOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "entry_group", "entry", @@ -1254,7 +1254,7 @@ class CloudDataCatalogGetEntryGroupOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "entry_group", "read_mask", @@ -1344,7 +1344,7 @@ class CloudDataCatalogGetTagTemplateOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "tag_template", "project_id", @@ -1437,7 +1437,7 @@ class CloudDataCatalogListTagsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "entry_group", "entry", @@ -1533,7 +1533,7 @@ class CloudDataCatalogLookupEntryOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "linked_resource", "sql_resource", "project_id", @@ -1624,7 +1624,7 @@ class CloudDataCatalogRenameTagTemplateFieldOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "tag_template", "field", @@ -1746,7 +1746,7 @@ class CloudDataCatalogSearchCatalogOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "scope", "query", "page_size", @@ -1849,7 +1849,7 @@ class CloudDataCatalogUpdateEntryOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "entry", "update_mask", "location", @@ -1959,7 +1959,7 @@ class CloudDataCatalogUpdateTagOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "tag", "update_mask", "location", @@ -2076,7 +2076,7 @@ class CloudDataCatalogUpdateTagTemplateOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "tag_template", "update_mask", "location", @@ -2191,7 +2191,7 @@ class CloudDataCatalogUpdateTagTemplateFieldOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "tag_template_field", "update_mask", "tag_template_field_name", diff --git a/airflow/providers/google/cloud/operators/dataflow.py b/airflow/providers/google/cloud/operators/dataflow.py index b76fec61b8052..285c090786b38 100644 --- a/airflow/providers/google/cloud/operators/dataflow.py +++ b/airflow/providers/google/cloud/operators/dataflow.py @@ -138,7 +138,7 @@ class DataflowConfiguration: :type check_if_running: CheckJobRunning """ - template_fields = ["job_name", "location"] + template_fields: Sequence[str] = ("job_name", "location") def __init__( self, @@ -347,7 +347,7 @@ class DataflowCreateJavaJobOperator(BaseOperator): """ - template_fields = ["options", "jar", "job_name"] + template_fields: Sequence[str] = ("options", "jar", "job_name") ui_color = "#0273d4" def __init__( @@ -617,7 +617,7 @@ class DataflowTemplatedJobStartOperator(BaseOperator): https://cloud.google.com/dataflow/docs/templates/executing-templates """ - template_fields = [ + template_fields: Sequence[str] = ( "template", "job_name", "options", @@ -627,7 +627,7 @@ class DataflowTemplatedJobStartOperator(BaseOperator): "gcp_conn_id", "impersonation_chain", "environment", - ] + ) ui_color = "#0273d4" def __init__( @@ -770,7 +770,7 @@ class DataflowStartFlexTemplateOperator(BaseOperator): :type wait_until_finished: Optional[bool] """ - template_fields = ["body", "location", "project_id", "gcp_conn_id"] + template_fields: Sequence[str] = ("body", "location", "project_id", "gcp_conn_id") def __init__( self, @@ -870,14 +870,14 @@ class DataflowStartSqlJobOperator(BaseOperator): :type drain_pipeline: bool """ - template_fields = [ + template_fields: Sequence[str] = ( "job_name", "query", "options", "location", "project_id", "gcp_conn_id", - ] + ) def __init__( self, @@ -1052,7 +1052,7 @@ class DataflowCreatePythonJobOperator(BaseOperator): :type wait_until_finished: Optional[bool] """ - template_fields = ["options", "dataflow_default_options", "job_name", "py_file"] + template_fields: Sequence[str] = ("options", "dataflow_default_options", "job_name", "py_file") def __init__( self, diff --git a/airflow/providers/google/cloud/operators/datafusion.py b/airflow/providers/google/cloud/operators/datafusion.py index 263f5476c8b69..fa6baa44f745d 100644 --- a/airflow/providers/google/cloud/operators/datafusion.py +++ b/airflow/providers/google/cloud/operators/datafusion.py @@ -63,7 +63,7 @@ class CloudDataFusionRestartInstanceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "instance_name", "impersonation_chain", ) @@ -139,7 +139,7 @@ class CloudDataFusionDeleteInstanceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "instance_name", "impersonation_chain", ) @@ -218,7 +218,7 @@ class CloudDataFusionCreateInstanceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "instance_name", "instance", "impersonation_chain", @@ -325,7 +325,7 @@ class CloudDataFusionUpdateInstanceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "instance_name", "instance", "impersonation_chain", @@ -408,7 +408,7 @@ class CloudDataFusionGetInstanceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "instance_name", "impersonation_chain", ) @@ -490,7 +490,7 @@ class CloudDataFusionCreatePipelineOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "instance_name", "pipeline_name", "impersonation_chain", @@ -585,7 +585,7 @@ class CloudDataFusionDeletePipelineOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "instance_name", "version_id", "pipeline_name", @@ -682,7 +682,7 @@ class CloudDataFusionListPipelinesOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "instance_name", "artifact_name", "artifact_version", @@ -789,7 +789,7 @@ class CloudDataFusionStartPipelineOperator(BaseOperator): :type asynchronous: bool """ - template_fields = ( + template_fields: Sequence[str] = ( "instance_name", "pipeline_name", "runtime_args", @@ -906,7 +906,7 @@ class CloudDataFusionStopPipelineOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "instance_name", "pipeline_name", "impersonation_chain", diff --git a/airflow/providers/google/cloud/operators/dataprep.py b/airflow/providers/google/cloud/operators/dataprep.py index 7d96c2236f2a8..6db0c07e619ae 100644 --- a/airflow/providers/google/cloud/operators/dataprep.py +++ b/airflow/providers/google/cloud/operators/dataprep.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. """This module contains a Google Dataprep operator.""" -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.models import BaseOperator from airflow.providers.google.cloud.hooks.dataprep import GoogleDataprepHook @@ -38,7 +38,7 @@ class DataprepGetJobsForJobGroupOperator(BaseOperator): :type job_id: int """ - template_fields = ("job_id",) + template_fields: Sequence[str] = ("job_id",) def __init__(self, *, dataprep_conn_id: str = "dataprep_default", job_id: int, **kwargs) -> None: super().__init__(**kwargs) @@ -72,7 +72,7 @@ class DataprepGetJobGroupOperator(BaseOperator): :type include_deleted: bool """ - template_fields = ("job_group_id", "embed") + template_fields: Sequence[str] = ("job_group_id", "embed") def __init__( self, @@ -118,7 +118,7 @@ class DataprepRunJobGroupOperator(BaseOperator): :type body_request: dict """ - template_fields = ("body_request",) + template_fields: Sequence[str] = ("body_request",) def __init__(self, *, dataprep_conn_id: str = "dataprep_default", body_request: dict, **kwargs) -> None: super().__init__(**kwargs) diff --git a/airflow/providers/google/cloud/operators/dataproc.py b/airflow/providers/google/cloud/operators/dataproc.py index fdfabb7c6844e..dc04fdddbbc13 100644 --- a/airflow/providers/google/cloud/operators/dataproc.py +++ b/airflow/providers/google/cloud/operators/dataproc.py @@ -512,7 +512,7 @@ class DataprocCreateClusterOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'region', 'cluster_config', @@ -747,7 +747,7 @@ class DataprocScaleClusterOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ['cluster_name', 'project_id', 'region', 'impersonation_chain'] + template_fields: Sequence[str] = ('cluster_name', 'project_id', 'region', 'impersonation_chain') operator_extra_links = (DataprocClusterLink(),) @@ -888,7 +888,7 @@ class DataprocDeleteClusterOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ('project_id', 'region', 'cluster_name', 'impersonation_chain') + template_fields: Sequence[str] = ('project_id', 'region', 'cluster_name', 'impersonation_chain') def __init__( self, @@ -1144,7 +1144,7 @@ class DataprocSubmitPigJobOperator(DataprocJobBaseOperator): :type variables: dict """ - template_fields = [ + template_fields: Sequence[str] = ( 'query', 'variables', 'job_name', @@ -1153,7 +1153,7 @@ class DataprocSubmitPigJobOperator(DataprocJobBaseOperator): 'dataproc_jars', 'dataproc_properties', 'impersonation_chain', - ] + ) template_ext = ('.pg', '.pig') ui_color = '#0273d4' job_type = 'pig_job' @@ -1223,7 +1223,7 @@ class DataprocSubmitHiveJobOperator(DataprocJobBaseOperator): :type variables: dict """ - template_fields = [ + template_fields: Sequence[str] = ( 'query', 'variables', 'job_name', @@ -1232,7 +1232,7 @@ class DataprocSubmitHiveJobOperator(DataprocJobBaseOperator): 'dataproc_jars', 'dataproc_properties', 'impersonation_chain', - ] + ) template_ext = ('.q', '.hql') ui_color = '#0273d4' job_type = 'hive_job' @@ -1300,7 +1300,7 @@ class DataprocSubmitSparkSqlJobOperator(DataprocJobBaseOperator): :type variables: dict """ - template_fields = [ + template_fields: Sequence[str] = ( 'query', 'variables', 'job_name', @@ -1309,7 +1309,7 @@ class DataprocSubmitSparkSqlJobOperator(DataprocJobBaseOperator): 'dataproc_jars', 'dataproc_properties', 'impersonation_chain', - ] + ) template_ext = ('.q',) ui_color = '#0273d4' job_type = 'spark_sql_job' @@ -1382,7 +1382,7 @@ class DataprocSubmitSparkJobOperator(DataprocJobBaseOperator): :type files: list """ - template_fields = [ + template_fields: Sequence[str] = ( 'arguments', 'job_name', 'cluster_name', @@ -1390,7 +1390,7 @@ class DataprocSubmitSparkJobOperator(DataprocJobBaseOperator): 'dataproc_jars', 'dataproc_properties', 'impersonation_chain', - ] + ) ui_color = '#0273d4' job_type = 'spark_job' @@ -1460,7 +1460,7 @@ class DataprocSubmitHadoopJobOperator(DataprocJobBaseOperator): :type files: list """ - template_fields = [ + template_fields: Sequence[str] = ( 'arguments', 'job_name', 'cluster_name', @@ -1468,7 +1468,7 @@ class DataprocSubmitHadoopJobOperator(DataprocJobBaseOperator): 'dataproc_jars', 'dataproc_properties', 'impersonation_chain', - ] + ) ui_color = '#0273d4' job_type = 'hadoop_job' @@ -1538,7 +1538,7 @@ class DataprocSubmitPySparkJobOperator(DataprocJobBaseOperator): :type pyfiles: list """ - template_fields = [ + template_fields: Sequence[str] = ( 'main', 'arguments', 'job_name', @@ -1547,7 +1547,7 @@ class DataprocSubmitPySparkJobOperator(DataprocJobBaseOperator): 'dataproc_jars', 'dataproc_properties', 'impersonation_chain', - ] + ) ui_color = '#0273d4' job_type = 'pyspark_job' @@ -1663,7 +1663,7 @@ class DataprocCreateWorkflowTemplateOperator(BaseOperator): :type metadata: Sequence[Tuple[str, str]] """ - template_fields = ("region", "template") + template_fields: Sequence[str] = ("region", "template") template_fields_renderers = {"template": "json"} def __init__( @@ -1766,7 +1766,7 @@ class DataprocInstantiateWorkflowTemplateOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ['template_id', 'impersonation_chain', 'request_id', 'parameters'] + template_fields: Sequence[str] = ('template_id', 'impersonation_chain', 'request_id', 'parameters') template_fields_renderers = {"parameters": "json"} def __init__( @@ -1865,7 +1865,7 @@ class DataprocInstantiateInlineWorkflowTemplateOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ['template', 'impersonation_chain'] + template_fields: Sequence[str] = ('template', 'impersonation_chain') template_fields_renderers = {"template": "json"} def __init__( @@ -1958,7 +1958,7 @@ class DataprocSubmitJobOperator(BaseOperator): :type wait_timeout: int """ - template_fields = ('project_id', 'region', 'job', 'impersonation_chain', 'request_id') + template_fields: Sequence[str] = ('project_id', 'region', 'job', 'impersonation_chain', 'request_id') template_fields_renderers = {"job": "json"} operator_extra_links = (DataprocJobLink(),) @@ -2102,7 +2102,7 @@ class DataprocUpdateClusterOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ('impersonation_chain', 'cluster_name') + template_fields: Sequence[str] = ('impersonation_chain', 'cluster_name') operator_extra_links = (DataprocClusterLink(),) def __init__( @@ -2216,7 +2216,7 @@ class DataprocCreateBatchOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'batch_id', 'region', @@ -2323,7 +2323,7 @@ class DataprocDeleteBatchOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ("batch_id", "region", "project_id", "impersonation_chain") + template_fields: Sequence[str] = ("batch_id", "region", "project_id", "impersonation_chain") def __init__( self, @@ -2395,7 +2395,7 @@ class DataprocGetBatchOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ("batch_id", "region", "project_id", "impersonation_chain") + template_fields: Sequence[str] = ("batch_id", "region", "project_id", "impersonation_chain") def __init__( self, @@ -2471,7 +2471,7 @@ class DataprocListBatchesOperator(BaseOperator): :rtype: List[dict] """ - template_fields = ("region", "project_id", "impersonation_chain") + template_fields: Sequence[str] = ("region", "project_id", "impersonation_chain") def __init__( self, diff --git a/airflow/providers/google/cloud/operators/dataproc_metastore.py b/airflow/providers/google/cloud/operators/dataproc_metastore.py index 41e6c21303946..ae9a921adbb5b 100644 --- a/airflow/providers/google/cloud/operators/dataproc_metastore.py +++ b/airflow/providers/google/cloud/operators/dataproc_metastore.py @@ -86,7 +86,7 @@ class DataprocMetastoreCreateBackupOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'backup', 'impersonation_chain', @@ -208,7 +208,7 @@ class DataprocMetastoreCreateMetadataImportOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'metadata_import', 'impersonation_chain', @@ -308,7 +308,7 @@ class DataprocMetastoreCreateServiceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'service', 'impersonation_chain', @@ -419,7 +419,7 @@ class DataprocMetastoreDeleteBackupOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'impersonation_chain', ) @@ -489,7 +489,7 @@ class DataprocMetastoreDeleteServiceOperator(BaseOperator): :type gcp_conn_id: str """ - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'impersonation_chain', ) @@ -575,7 +575,7 @@ class DataprocMetastoreExportMetadataOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'impersonation_chain', ) @@ -689,7 +689,7 @@ class DataprocMetastoreGetServiceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'impersonation_chain', ) @@ -768,7 +768,7 @@ class DataprocMetastoreListBackupsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'impersonation_chain', ) @@ -877,7 +877,7 @@ class DataprocMetastoreRestoreServiceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'impersonation_chain', ) @@ -1016,7 +1016,7 @@ class DataprocMetastoreUpdateServiceOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'impersonation_chain', ) diff --git a/airflow/providers/google/cloud/operators/datastore.py b/airflow/providers/google/cloud/operators/datastore.py index 142a62ad8ece4..acd8c2080a8e1 100644 --- a/airflow/providers/google/cloud/operators/datastore.py +++ b/airflow/providers/google/cloud/operators/datastore.py @@ -76,13 +76,13 @@ class CloudDatastoreExportEntitiesOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( 'bucket', 'namespace', 'entity_filter', 'labels', 'impersonation_chain', - ] + ) def __init__( self, @@ -190,14 +190,14 @@ class CloudDatastoreImportEntitiesOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( 'bucket', 'file', 'namespace', 'entity_filter', 'labels', 'impersonation_chain', - ] + ) def __init__( self, @@ -285,7 +285,7 @@ class CloudDatastoreAllocateIdsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "partial_keys", "impersonation_chain", ) @@ -352,7 +352,7 @@ class CloudDatastoreBeginTransactionOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "transaction_options", "impersonation_chain", ) @@ -419,7 +419,7 @@ class CloudDatastoreCommitOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "body", "impersonation_chain", ) @@ -486,7 +486,7 @@ class CloudDatastoreRollbackOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "transaction", "impersonation_chain", ) @@ -552,7 +552,7 @@ class CloudDatastoreRunQueryOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "body", "impersonation_chain", ) @@ -617,7 +617,7 @@ class CloudDatastoreGetOperationOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "name", "impersonation_chain", ) @@ -677,7 +677,7 @@ class CloudDatastoreDeleteOperationOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "name", "impersonation_chain", ) diff --git a/airflow/providers/google/cloud/operators/dlp.py b/airflow/providers/google/cloud/operators/dlp.py index 07cf08a984b77..4fb6d59c96ef1 100644 --- a/airflow/providers/google/cloud/operators/dlp.py +++ b/airflow/providers/google/cloud/operators/dlp.py @@ -85,7 +85,7 @@ class CloudDLPCancelDLPJobOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "dlp_job_id", "project_id", "gcp_conn_id", @@ -171,7 +171,7 @@ class CloudDLPCreateDeidentifyTemplateOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.DeidentifyTemplate """ - template_fields = ( + template_fields: Sequence[str] = ( "organization_id", "project_id", "deidentify_template", @@ -278,7 +278,7 @@ class CloudDLPCreateDLPJobOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.DlpJob """ - template_fields = ( + template_fields: Sequence[str] = ( "project_id", "inspect_job", "risk_job", @@ -385,7 +385,7 @@ class CloudDLPCreateInspectTemplateOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.InspectTemplate """ - template_fields = ( + template_fields: Sequence[str] = ( "organization_id", "project_id", "inspect_template", @@ -487,7 +487,7 @@ class CloudDLPCreateJobTriggerOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.JobTrigger """ - template_fields = ( + template_fields: Sequence[str] = ( "project_id", "job_trigger", "trigger_id", @@ -588,7 +588,7 @@ class CloudDLPCreateStoredInfoTypeOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.StoredInfoType """ - template_fields = ( + template_fields: Sequence[str] = ( "organization_id", "project_id", "config", @@ -704,7 +704,7 @@ class CloudDLPDeidentifyContentOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.DeidentifyContentResponse """ - template_fields = ( + template_fields: Sequence[str] = ( "project_id", "deidentify_config", "inspect_config", @@ -802,7 +802,7 @@ class CloudDLPDeleteDeidentifyTemplateOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "template_id", "organization_id", "project_id", @@ -888,7 +888,7 @@ class CloudDLPDeleteDLPJobOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "dlp_job_id", "project_id", "gcp_conn_id", @@ -972,7 +972,7 @@ class CloudDLPDeleteInspectTemplateOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "template_id", "organization_id", "project_id", @@ -1057,7 +1057,7 @@ class CloudDLPDeleteJobTriggerOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "job_trigger_id", "project_id", "gcp_conn_id", @@ -1141,7 +1141,7 @@ class CloudDLPDeleteStoredInfoTypeOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "stored_info_type_id", "organization_id", "project_id", @@ -1231,7 +1231,7 @@ class CloudDLPGetDeidentifyTemplateOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.DeidentifyTemplate """ - template_fields = ( + template_fields: Sequence[str] = ( "template_id", "organization_id", "project_id", @@ -1316,7 +1316,7 @@ class CloudDLPGetDLPJobOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.DlpJob """ - template_fields = ( + template_fields: Sequence[str] = ( "dlp_job_id", "project_id", "gcp_conn_id", @@ -1400,7 +1400,7 @@ class CloudDLPGetInspectTemplateOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.InspectTemplate """ - template_fields = ( + template_fields: Sequence[str] = ( "template_id", "organization_id", "project_id", @@ -1485,7 +1485,7 @@ class CloudDLPGetDLPJobTriggerOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.JobTrigger """ - template_fields = ( + template_fields: Sequence[str] = ( "job_trigger_id", "project_id", "gcp_conn_id", @@ -1569,7 +1569,7 @@ class CloudDLPGetStoredInfoTypeOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.StoredInfoType """ - template_fields = ( + template_fields: Sequence[str] = ( "stored_info_type_id", "organization_id", "project_id", @@ -1661,7 +1661,7 @@ class CloudDLPInspectContentOperator(BaseOperator): :rtype: google.cloud.tasks_v2.types.InspectContentResponse """ - template_fields = ( + template_fields: Sequence[str] = ( "project_id", "inspect_config", "item", @@ -1757,7 +1757,7 @@ class CloudDLPListDeidentifyTemplatesOperator(BaseOperator): :rtype: list[google.cloud.dlp_v2.types.DeidentifyTemplate] """ - template_fields = ( + template_fields: Sequence[str] = ( "organization_id", "project_id", "gcp_conn_id", @@ -1852,7 +1852,7 @@ class CloudDLPListDLPJobsOperator(BaseOperator): :rtype: list[google.cloud.dlp_v2.types.DlpJob] """ - template_fields = ( + template_fields: Sequence[str] = ( "project_id", "gcp_conn_id", "impersonation_chain", @@ -1941,7 +1941,7 @@ class CloudDLPListInfoTypesOperator(BaseOperator): :rtype: ListInfoTypesResponse """ - template_fields = ( + template_fields: Sequence[str] = ( "language_code", "gcp_conn_id", "impersonation_chain", @@ -2028,7 +2028,7 @@ class CloudDLPListInspectTemplatesOperator(BaseOperator): :rtype: list[google.cloud.dlp_v2.types.InspectTemplate] """ - template_fields = ( + template_fields: Sequence[str] = ( "organization_id", "project_id", "gcp_conn_id", @@ -2121,7 +2121,7 @@ class CloudDLPListJobTriggersOperator(BaseOperator): :rtype: list[google.cloud.dlp_v2.types.JobTrigger] """ - template_fields = ( + template_fields: Sequence[str] = ( "project_id", "gcp_conn_id", "impersonation_chain", @@ -2214,7 +2214,7 @@ class CloudDLPListStoredInfoTypesOperator(BaseOperator): :rtype: list[google.cloud.dlp_v2.types.StoredInfoType] """ - template_fields = ( + template_fields: Sequence[str] = ( "organization_id", "project_id", "gcp_conn_id", @@ -2312,7 +2312,7 @@ class CloudDLPRedactImageOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.RedactImageResponse """ - template_fields = ( + template_fields: Sequence[str] = ( "project_id", "inspect_config", "image_redaction_configs", @@ -2417,7 +2417,7 @@ class CloudDLPReidentifyContentOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.ReidentifyContentResponse """ - template_fields = ( + template_fields: Sequence[str] = ( "project_id", "reidentify_config", "inspect_config", @@ -2521,7 +2521,7 @@ class CloudDLPUpdateDeidentifyTemplateOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.DeidentifyTemplate """ - template_fields = ( + template_fields: Sequence[str] = ( "template_id", "organization_id", "project_id", @@ -2621,7 +2621,7 @@ class CloudDLPUpdateInspectTemplateOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.InspectTemplate """ - template_fields = ( + template_fields: Sequence[str] = ( "template_id", "organization_id", "project_id", @@ -2718,7 +2718,7 @@ class CloudDLPUpdateJobTriggerOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.InspectTemplate """ - template_fields = ( + template_fields: Sequence[str] = ( "job_trigger_id", "project_id", "job_trigger", @@ -2815,7 +2815,7 @@ class CloudDLPUpdateStoredInfoTypeOperator(BaseOperator): :rtype: google.cloud.dlp_v2.types.StoredInfoType """ - template_fields = ( + template_fields: Sequence[str] = ( "stored_info_type_id", "organization_id", "project_id", diff --git a/airflow/providers/google/cloud/operators/functions.py b/airflow/providers/google/cloud/operators/functions.py index 78d2847f18183..a204e4a24522b 100644 --- a/airflow/providers/google/cloud/operators/functions.py +++ b/airflow/providers/google/cloud/operators/functions.py @@ -142,7 +142,7 @@ class CloudFunctionDeployFunctionOperator(BaseOperator): """ # [START gcf_function_deploy_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'body', 'project_id', 'location', @@ -353,7 +353,7 @@ class CloudFunctionDeleteFunctionOperator(BaseOperator): """ # [START gcf_function_delete_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'name', 'gcp_conn_id', 'api_version', @@ -434,7 +434,7 @@ class CloudFunctionInvokeFunctionOperator(BaseOperator): :return: None """ - template_fields = ( + template_fields: Sequence[str] = ( 'function_id', 'input_data', 'location', diff --git a/airflow/providers/google/cloud/operators/gcs.py b/airflow/providers/google/cloud/operators/gcs.py index f33d1251113f7..c9fd6d885e790 100644 --- a/airflow/providers/google/cloud/operators/gcs.py +++ b/airflow/providers/google/cloud/operators/gcs.py @@ -22,7 +22,7 @@ import warnings from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory -from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Sequence, Union +from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, Union if TYPE_CHECKING: from airflow.utils.context import Context @@ -110,7 +110,7 @@ class GCSCreateBucketOperator(BaseOperator): """ - template_fields = ( + template_fields: Sequence[str] = ( 'bucket_name', 'storage_class', 'location', @@ -222,7 +222,7 @@ class GCSListObjectsOperator(BaseOperator): ) """ - template_fields: Iterable[str] = ( + template_fields: Sequence[str] = ( 'bucket', 'prefix', 'delimiter', @@ -312,7 +312,7 @@ class GCSDeleteObjectsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'bucket_name', 'prefix', 'objects', @@ -407,7 +407,7 @@ class GCSBucketCreateAclEntryOperator(BaseOperator): """ # [START gcs_bucket_create_acl_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'bucket', 'entity', 'role', @@ -499,7 +499,7 @@ class GCSObjectCreateAclEntryOperator(BaseOperator): """ # [START gcs_object_create_acl_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'bucket', 'object_name', 'entity', @@ -593,7 +593,7 @@ class GCSFileTransformOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'source_bucket', 'destination_bucket', 'transform_script', @@ -734,7 +734,7 @@ class GCSTimeSpanFileTransformOperator(BaseOperator): :type upload_num_attempts: int """ - template_fields = ( + template_fields: Sequence[str] = ( 'source_bucket', 'source_prefix', 'destination_bucket', @@ -940,7 +940,7 @@ class GCSDeleteBucketOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'bucket_name', "gcp_conn_id", "impersonation_chain", @@ -1019,7 +1019,7 @@ class GCSSynchronizeBucketsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'source_bucket', 'destination_bucket', 'source_object', diff --git a/airflow/providers/google/cloud/operators/kubernetes_engine.py b/airflow/providers/google/cloud/operators/kubernetes_engine.py index 1164e4456a491..2f07c4343939e 100644 --- a/airflow/providers/google/cloud/operators/kubernetes_engine.py +++ b/airflow/providers/google/cloud/operators/kubernetes_engine.py @@ -80,14 +80,14 @@ class GKEDeleteClusterOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( 'project_id', 'gcp_conn_id', 'name', 'location', 'api_version', 'impersonation_chain', - ] + ) def __init__( self, @@ -182,14 +182,14 @@ class GKECreateClusterOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( 'project_id', 'gcp_conn_id', 'location', 'api_version', 'body', 'impersonation_chain', - ] + ) def __init__( self, diff --git a/airflow/providers/google/cloud/operators/life_sciences.py b/airflow/providers/google/cloud/operators/life_sciences.py index 370c8371a462d..103e506b7fbd4 100644 --- a/airflow/providers/google/cloud/operators/life_sciences.py +++ b/airflow/providers/google/cloud/operators/life_sciences.py @@ -57,7 +57,7 @@ class LifeSciencesRunPipelineOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "body", "gcp_conn_id", "api_version", diff --git a/airflow/providers/google/cloud/operators/mlengine.py b/airflow/providers/google/cloud/operators/mlengine.py index b006b44852b22..777ac10d02a54 100644 --- a/airflow/providers/google/cloud/operators/mlengine.py +++ b/airflow/providers/google/cloud/operators/mlengine.py @@ -167,7 +167,7 @@ class MLEngineStartBatchPredictionJobOperator(BaseOperator): determined. """ - template_fields = [ + template_fields: Sequence[str] = ( '_project_id', '_job_id', '_region', @@ -177,7 +177,7 @@ class MLEngineStartBatchPredictionJobOperator(BaseOperator): '_version_name', '_uri', '_impersonation_chain', - ] + ) def __init__( self, @@ -336,11 +336,11 @@ class MLEngineManageModelOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( '_project_id', '_model', '_impersonation_chain', - ] + ) def __init__( self, @@ -416,11 +416,11 @@ class MLEngineCreateModelOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( '_project_id', '_model', '_impersonation_chain', - ] + ) def __init__( self, @@ -481,11 +481,11 @@ class MLEngineGetModelOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( '_project_id', '_model_name', '_impersonation_chain', - ] + ) def __init__( self, @@ -550,11 +550,11 @@ class MLEngineDeleteModelOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( '_project_id', '_model_name', '_impersonation_chain', - ] + ) def __init__( self, @@ -651,13 +651,13 @@ class MLEngineManageVersionOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( '_project_id', '_model_name', '_version_name', '_version', '_impersonation_chain', - ] + ) def __init__( self, @@ -755,12 +755,12 @@ class MLEngineCreateVersionOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( '_project_id', '_model_name', '_version', '_impersonation_chain', - ] + ) def __init__( self, @@ -838,12 +838,12 @@ class MLEngineSetDefaultVersionOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( '_project_id', '_model_name', '_version_name', '_impersonation_chain', - ] + ) def __init__( self, @@ -919,11 +919,11 @@ class MLEngineListVersionsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( '_project_id', '_model_name', '_impersonation_chain', - ] + ) def __init__( self, @@ -997,12 +997,12 @@ class MLEngineDeleteVersionOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( '_project_id', '_model_name', '_version_name', '_impersonation_chain', - ] + ) def __init__( self, @@ -1143,7 +1143,7 @@ class MLEngineStartTrainingJobOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( '_project_id', '_job_id', '_region', @@ -1159,7 +1159,7 @@ class MLEngineStartTrainingJobOperator(BaseOperator): '_service_account', '_hyperparameters', '_impersonation_chain', - ] + ) operator_extra_links = (AIPlatformConsoleLink(),) @@ -1346,11 +1346,11 @@ class MLEngineTrainingCancelJobOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( '_project_id', '_job_id', '_impersonation_chain', - ] + ) def __init__( self, diff --git a/airflow/providers/google/cloud/operators/natural_language.py b/airflow/providers/google/cloud/operators/natural_language.py index d792559c27584..25cba93ee5321 100644 --- a/airflow/providers/google/cloud/operators/natural_language.py +++ b/airflow/providers/google/cloud/operators/natural_language.py @@ -68,7 +68,7 @@ class CloudNaturalLanguageAnalyzeEntitiesOperator(BaseOperator): """ # [START natural_language_analyze_entities_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "document", "gcp_conn_id", "impersonation_chain", @@ -148,7 +148,7 @@ class CloudNaturalLanguageAnalyzeEntitySentimentOperator(BaseOperator): """ # [START natural_language_analyze_entity_sentiment_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "document", "gcp_conn_id", "impersonation_chain", @@ -231,7 +231,7 @@ class CloudNaturalLanguageAnalyzeSentimentOperator(BaseOperator): """ # [START natural_language_analyze_sentiment_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "document", "gcp_conn_id", "impersonation_chain", @@ -306,7 +306,7 @@ class CloudNaturalLanguageClassifyTextOperator(BaseOperator): """ # [START natural_language_classify_text_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "document", "gcp_conn_id", "impersonation_chain", diff --git a/airflow/providers/google/cloud/operators/pubsub.py b/airflow/providers/google/cloud/operators/pubsub.py index 542340f41ddd3..ba09e450de5b8 100644 --- a/airflow/providers/google/cloud/operators/pubsub.py +++ b/airflow/providers/google/cloud/operators/pubsub.py @@ -120,11 +120,11 @@ class PubSubCreateTopicOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( 'project_id', 'topic', 'impersonation_chain', - ] + ) ui_color = '#0273d4' def __init__( @@ -335,13 +335,13 @@ class PubSubCreateSubscriptionOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( 'project_id', 'topic', 'subscription', 'subscription_project_id', 'impersonation_chain', - ] + ) ui_color = '#0273d4' def __init__( @@ -516,11 +516,11 @@ class PubSubDeleteTopicOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( 'project_id', 'topic', 'impersonation_chain', - ] + ) ui_color = '#cb4335' def __init__( @@ -648,11 +648,11 @@ class PubSubDeleteSubscriptionOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( 'project_id', 'subscription', 'impersonation_chain', - ] + ) ui_color = '#cb4335' def __init__( @@ -773,12 +773,12 @@ class PubSubPublishMessageOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( 'project_id', 'topic', 'messages', 'impersonation_chain', - ] + ) ui_color = '#0273d4' def __init__( @@ -880,11 +880,11 @@ class PubSubPullOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( 'project_id', 'subscription', 'impersonation_chain', - ] + ) def __init__( self, diff --git a/airflow/providers/google/cloud/operators/spanner.py b/airflow/providers/google/cloud/operators/spanner.py index 6345c74e065bc..3cb2efc9287cd 100644 --- a/airflow/providers/google/cloud/operators/spanner.py +++ b/airflow/providers/google/cloud/operators/spanner.py @@ -65,7 +65,7 @@ class SpannerDeployInstanceOperator(BaseOperator): """ # [START gcp_spanner_deploy_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'instance_id', 'configuration_name', @@ -151,7 +151,7 @@ class SpannerDeleteInstanceOperator(BaseOperator): """ # [START gcp_spanner_delete_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'instance_id', 'gcp_conn_id', @@ -229,7 +229,7 @@ class SpannerQueryDatabaseInstanceOperator(BaseOperator): """ # [START gcp_spanner_query_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'instance_id', 'database_id', @@ -338,7 +338,7 @@ class SpannerDeployDatabaseInstanceOperator(BaseOperator): """ # [START gcp_spanner_database_deploy_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'instance_id', 'database_id', @@ -442,7 +442,7 @@ class SpannerUpdateDatabaseInstanceOperator(BaseOperator): """ # [START gcp_spanner_database_update_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'instance_id', 'database_id', @@ -537,7 +537,7 @@ class SpannerDeleteDatabaseInstanceOperator(BaseOperator): """ # [START gcp_spanner_database_delete_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'instance_id', 'database_id', diff --git a/airflow/providers/google/cloud/operators/speech_to_text.py b/airflow/providers/google/cloud/operators/speech_to_text.py index 336c2e7a93ed7..0c0616f0309e5 100644 --- a/airflow/providers/google/cloud/operators/speech_to_text.py +++ b/airflow/providers/google/cloud/operators/speech_to_text.py @@ -69,7 +69,7 @@ class CloudSpeechToTextRecognizeSpeechOperator(BaseOperator): """ # [START gcp_speech_to_text_synthesize_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "audio", "config", "project_id", diff --git a/airflow/providers/google/cloud/operators/stackdriver.py b/airflow/providers/google/cloud/operators/stackdriver.py index 267d5055356f0..c203cb798872a 100644 --- a/airflow/providers/google/cloud/operators/stackdriver.py +++ b/airflow/providers/google/cloud/operators/stackdriver.py @@ -88,7 +88,7 @@ class StackdriverListAlertPoliciesOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'filter_', 'impersonation_chain', ) @@ -196,7 +196,7 @@ class StackdriverEnableAlertPoliciesOperator(BaseOperator): """ ui_color = "#e5ffcc" - template_fields = ( + template_fields: Sequence[str] = ( 'filter_', 'impersonation_chain', ) @@ -286,7 +286,7 @@ class StackdriverDisableAlertPoliciesOperator(BaseOperator): """ ui_color = "#e5ffcc" - template_fields = ( + template_fields: Sequence[str] = ( 'filter_', 'impersonation_chain', ) @@ -375,7 +375,7 @@ class StackdriverUpsertAlertOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'alerts', 'impersonation_chain', ) @@ -464,7 +464,7 @@ class StackdriverDeleteAlertOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'name', 'impersonation_chain', ) @@ -571,7 +571,7 @@ class StackdriverListNotificationChannelsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'filter_', 'impersonation_chain', ) @@ -679,7 +679,7 @@ class StackdriverEnableNotificationChannelsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'filter_', 'impersonation_chain', ) @@ -771,7 +771,7 @@ class StackdriverDisableNotificationChannelsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'filter_', 'impersonation_chain', ) @@ -864,7 +864,7 @@ class StackdriverUpsertNotificationChannelOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'channels', 'impersonation_chain', ) @@ -955,7 +955,7 @@ class StackdriverDeleteNotificationChannelOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'name', 'impersonation_chain', ) diff --git a/airflow/providers/google/cloud/operators/tasks.py b/airflow/providers/google/cloud/operators/tasks.py index 2cbc5bca10521..130626b4bd283 100644 --- a/airflow/providers/google/cloud/operators/tasks.py +++ b/airflow/providers/google/cloud/operators/tasks.py @@ -82,7 +82,7 @@ class CloudTasksQueueCreateOperator(BaseOperator): :rtype: google.cloud.tasks_v2.types.Queue """ - template_fields = ( + template_fields: Sequence[str] = ( "task_queue", "project_id", "location", @@ -193,7 +193,7 @@ class CloudTasksQueueUpdateOperator(BaseOperator): :rtype: google.cloud.tasks_v2.types.Queue """ - template_fields = ( + template_fields: Sequence[str] = ( "task_queue", "project_id", "location", @@ -287,7 +287,7 @@ class CloudTasksQueueGetOperator(BaseOperator): :rtype: google.cloud.tasks_v2.types.Queue """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "queue_name", "project_id", @@ -376,7 +376,7 @@ class CloudTasksQueuesListOperator(BaseOperator): :rtype: list[google.cloud.tasks_v2.types.Queue] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "project_id", "gcp_conn_id", @@ -462,7 +462,7 @@ class CloudTasksQueueDeleteOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "queue_name", "project_id", @@ -547,7 +547,7 @@ class CloudTasksQueuePurgeOperator(BaseOperator): :rtype: list[google.cloud.tasks_v2.types.Queue] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "queue_name", "project_id", @@ -633,7 +633,7 @@ class CloudTasksQueuePauseOperator(BaseOperator): :rtype: list[google.cloud.tasks_v2.types.Queue] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "queue_name", "project_id", @@ -719,7 +719,7 @@ class CloudTasksQueueResumeOperator(BaseOperator): :rtype: list[google.cloud.tasks_v2.types.Queue] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "queue_name", "project_id", @@ -814,7 +814,7 @@ class CloudTasksTaskCreateOperator(BaseOperator): :rtype: google.cloud.tasks_v2.types.Task """ - template_fields = ( + template_fields: Sequence[str] = ( "task", "project_id", "location", @@ -916,7 +916,7 @@ class CloudTasksTaskGetOperator(BaseOperator): :rtype: google.cloud.tasks_v2.types.Task """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "queue_name", "task_name", @@ -1015,7 +1015,7 @@ class CloudTasksTasksListOperator(BaseOperator): :rtype: list[google.cloud.tasks_v2.types.Task] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "queue_name", "project_id", @@ -1107,7 +1107,7 @@ class CloudTasksTaskDeleteOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "queue_name", "task_name", @@ -1201,7 +1201,7 @@ class CloudTasksTaskRunOperator(BaseOperator): :rtype: google.cloud.tasks_v2.types.Task """ - template_fields = ( + template_fields: Sequence[str] = ( "location", "queue_name", "task_name", diff --git a/airflow/providers/google/cloud/operators/text_to_speech.py b/airflow/providers/google/cloud/operators/text_to_speech.py index 5774dab291a49..df2196ffc09e0 100644 --- a/airflow/providers/google/cloud/operators/text_to_speech.py +++ b/airflow/providers/google/cloud/operators/text_to_speech.py @@ -78,7 +78,7 @@ class CloudTextToSpeechSynthesizeOperator(BaseOperator): """ # [START gcp_text_to_speech_synthesize_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "input_data", "voice", "audio_config", diff --git a/airflow/providers/google/cloud/operators/translate.py b/airflow/providers/google/cloud/operators/translate.py index 7a3a2c8cc7252..1aa344324ea40 100644 --- a/airflow/providers/google/cloud/operators/translate.py +++ b/airflow/providers/google/cloud/operators/translate.py @@ -85,7 +85,7 @@ class CloudTranslateTextOperator(BaseOperator): """ # [START translate_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'values', 'target_language', 'format_', diff --git a/airflow/providers/google/cloud/operators/translate_speech.py b/airflow/providers/google/cloud/operators/translate_speech.py index 8a93e87b901c0..0001be2289854 100644 --- a/airflow/providers/google/cloud/operators/translate_speech.py +++ b/airflow/providers/google/cloud/operators/translate_speech.py @@ -109,7 +109,7 @@ class CloudTranslateSpeechOperator(BaseOperator): """ # [START translate_speech_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'target_language', 'format_', 'source_language', diff --git a/airflow/providers/google/cloud/operators/video_intelligence.py b/airflow/providers/google/cloud/operators/video_intelligence.py index c80d6a4acd8a4..ffff87d63cb07 100644 --- a/airflow/providers/google/cloud/operators/video_intelligence.py +++ b/airflow/providers/google/cloud/operators/video_intelligence.py @@ -76,7 +76,7 @@ class CloudVideoIntelligenceDetectVideoLabelsOperator(BaseOperator): """ # [START gcp_video_intelligence_detect_labels_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "input_uri", "output_uri", "gcp_conn_id", @@ -175,7 +175,7 @@ class CloudVideoIntelligenceDetectVideoExplicitContentOperator(BaseOperator): """ # [START gcp_video_intelligence_detect_explicit_content_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "input_uri", "output_uri", "gcp_conn_id", @@ -274,7 +274,7 @@ class CloudVideoIntelligenceDetectVideoShotsOperator(BaseOperator): """ # [START gcp_video_intelligence_detect_video_shots_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "input_uri", "output_uri", "gcp_conn_id", diff --git a/airflow/providers/google/cloud/operators/vision.py b/airflow/providers/google/cloud/operators/vision.py index c1c060191bbd4..caaed367624a2 100644 --- a/airflow/providers/google/cloud/operators/vision.py +++ b/airflow/providers/google/cloud/operators/vision.py @@ -86,7 +86,7 @@ class CloudVisionCreateProductSetOperator(BaseOperator): """ # [START vision_productset_create_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "location", "project_id", "product_set_id", @@ -182,7 +182,7 @@ class CloudVisionGetProductSetOperator(BaseOperator): """ # [START vision_productset_get_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'location', 'project_id', 'product_set_id', @@ -287,7 +287,7 @@ class CloudVisionUpdateProductSetOperator(BaseOperator): """ # [START vision_productset_update_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'location', 'project_id', 'product_set_id', @@ -381,7 +381,7 @@ class CloudVisionDeleteProductSetOperator(BaseOperator): """ # [START vision_productset_delete_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'location', 'project_id', 'product_set_id', @@ -479,7 +479,7 @@ class CloudVisionCreateProductOperator(BaseOperator): """ # [START vision_product_create_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'location', 'project_id', 'product_id', @@ -578,7 +578,7 @@ class CloudVisionGetProductOperator(BaseOperator): """ # [START vision_product_get_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'location', 'project_id', 'product_id', @@ -694,7 +694,7 @@ class CloudVisionUpdateProductOperator(BaseOperator): """ # [START vision_product_update_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'location', 'project_id', 'product_id', @@ -793,7 +793,7 @@ class CloudVisionDeleteProductOperator(BaseOperator): """ # [START vision_product_delete_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'location', 'project_id', 'product_id', @@ -874,7 +874,7 @@ class CloudVisionImageAnnotateOperator(BaseOperator): """ # [START vision_annotate_image_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'request', 'gcp_conn_id', 'impersonation_chain', @@ -963,7 +963,7 @@ class CloudVisionCreateReferenceImageOperator(BaseOperator): """ # [START vision_reference_image_create_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "location", "reference_image", "product_id", @@ -1069,7 +1069,7 @@ class CloudVisionDeleteReferenceImageOperator(BaseOperator): """ # [START vision_reference_image_create_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "location", "product_id", "reference_image_id", @@ -1167,7 +1167,7 @@ class CloudVisionAddProductToProductSetOperator(BaseOperator): """ # [START vision_add_product_to_product_set_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "location", "product_set_id", "product_id", @@ -1259,7 +1259,7 @@ class CloudVisionRemoveProductFromProductSetOperator(BaseOperator): """ # [START vision_remove_product_from_product_set_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "location", "product_set_id", "product_id", @@ -1351,7 +1351,7 @@ class CloudVisionDetectTextOperator(BaseOperator): """ # [START vision_detect_text_set_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "image", "max_results", "timeout", @@ -1442,7 +1442,7 @@ class CloudVisionTextDetectOperator(BaseOperator): """ # [START vision_document_detect_text_set_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "image", "max_results", "timeout", @@ -1526,7 +1526,7 @@ class CloudVisionDetectImageLabelsOperator(BaseOperator): """ # [START vision_detect_labels_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "image", "max_results", "timeout", @@ -1604,7 +1604,7 @@ class CloudVisionDetectImageSafeSearchOperator(BaseOperator): """ # [START vision_detect_safe_search_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( "image", "max_results", "timeout", diff --git a/airflow/providers/google/cloud/operators/workflows.py b/airflow/providers/google/cloud/operators/workflows.py index ae0080f862430..2b3e2b020ee1a 100644 --- a/airflow/providers/google/cloud/operators/workflows.py +++ b/airflow/providers/google/cloud/operators/workflows.py @@ -64,7 +64,7 @@ class WorkflowsCreateWorkflowOperator(BaseOperator): :type metadata: Sequence[Tuple[str, str]] """ - template_fields = ("location", "workflow", "workflow_id") + template_fields: Sequence[str] = ("location", "workflow", "workflow_id") template_fields_renderers = {"workflow": "json"} def __init__( @@ -173,7 +173,7 @@ class WorkflowsUpdateWorkflowOperator(BaseOperator): :type metadata: Sequence[Tuple[str, str]] """ - template_fields = ("workflow_id", "update_mask") + template_fields: Sequence[str] = ("workflow_id", "update_mask") template_fields_renderers = {"update_mask": "json"} def __init__( @@ -251,7 +251,7 @@ class WorkflowsDeleteWorkflowOperator(BaseOperator): :type metadata: Sequence[Tuple[str, str]] """ - template_fields = ("location", "workflow_id") + template_fields: Sequence[str] = ("location", "workflow_id") def __init__( self, @@ -321,7 +321,7 @@ class WorkflowsListWorkflowsOperator(BaseOperator): :type metadata: Sequence[Tuple[str, str]] """ - template_fields = ("location", "order_by", "filter_") + template_fields: Sequence[str] = ("location", "order_by", "filter_") def __init__( self, @@ -388,7 +388,7 @@ class WorkflowsGetWorkflowOperator(BaseOperator): :type metadata: Sequence[Tuple[str, str]] """ - template_fields = ("location", "workflow_id") + template_fields: Sequence[str] = ("location", "workflow_id") def __init__( self, @@ -455,7 +455,7 @@ class WorkflowsCreateExecutionOperator(BaseOperator): :type metadata: Sequence[Tuple[str, str]] """ - template_fields = ("location", "workflow_id", "execution") + template_fields: Sequence[str] = ("location", "workflow_id", "execution") template_fields_renderers = {"execution": "json"} def __init__( @@ -527,7 +527,7 @@ class WorkflowsCancelExecutionOperator(BaseOperator): :type metadata: Sequence[Tuple[str, str]] """ - template_fields = ("location", "workflow_id", "execution_id") + template_fields: Sequence[str] = ("location", "workflow_id", "execution_id") def __init__( self, @@ -601,7 +601,7 @@ class WorkflowsListExecutionsOperator(BaseOperator): :type metadata: Sequence[Tuple[str, str]] """ - template_fields = ("location", "workflow_id") + template_fields: Sequence[str] = ("location", "workflow_id") def __init__( self, @@ -670,7 +670,7 @@ class WorkflowsGetExecutionOperator(BaseOperator): :type metadata: Sequence[Tuple[str, str]] """ - template_fields = ("location", "workflow_id", "execution_id") + template_fields: Sequence[str] = ("location", "workflow_id", "execution_id") def __init__( self, diff --git a/airflow/providers/google/cloud/sensors/bigquery.py b/airflow/providers/google/cloud/sensors/bigquery.py index cd430b332cd0b..17f67e2896aa0 100644 --- a/airflow/providers/google/cloud/sensors/bigquery.py +++ b/airflow/providers/google/cloud/sensors/bigquery.py @@ -56,7 +56,7 @@ class BigQueryTableExistenceSensor(BaseSensorOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'dataset_id', 'table_id', @@ -130,7 +130,7 @@ class BigQueryTablePartitionExistenceSensor(BaseSensorOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'project_id', 'dataset_id', 'table_id', diff --git a/airflow/providers/google/cloud/sensors/bigquery_dts.py b/airflow/providers/google/cloud/sensors/bigquery_dts.py index 833d0b45f5258..d45ce72d2f671 100644 --- a/airflow/providers/google/cloud/sensors/bigquery_dts.py +++ b/airflow/providers/google/cloud/sensors/bigquery_dts.py @@ -69,7 +69,7 @@ class BigQueryDataTransferServiceTransferRunSensor(BaseSensorOperator): :return: An ``google.cloud.bigquery_datatransfer_v1.types.TransferRun`` instance. """ - template_fields = ( + template_fields: Sequence[str] = ( "run_id", "transfer_config_id", "expected_statuses", diff --git a/airflow/providers/google/cloud/sensors/bigtable.py b/airflow/providers/google/cloud/sensors/bigtable.py index 6a9921818b713..f0a22e9882935 100644 --- a/airflow/providers/google/cloud/sensors/bigtable.py +++ b/airflow/providers/google/cloud/sensors/bigtable.py @@ -60,12 +60,12 @@ class BigtableTableReplicationCompletedSensor(BaseSensorOperator, BigtableValida """ REQUIRED_ATTRIBUTES = ('instance_id', 'table_id') - template_fields = [ + template_fields: Sequence[str] = ( 'project_id', 'instance_id', 'table_id', 'impersonation_chain', - ] + ) def __init__( self, diff --git a/airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py b/airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py index 33c418891a768..c99d7ebdedd53 100644 --- a/airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +++ b/airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py @@ -63,7 +63,7 @@ class CloudDataTransferServiceJobStatusSensor(BaseSensorOperator): """ # [START gcp_transfer_job_sensor_template_fields] - template_fields = ( + template_fields: Sequence[str] = ( 'job_name', 'impersonation_chain', ) diff --git a/airflow/providers/google/cloud/sensors/dataflow.py b/airflow/providers/google/cloud/sensors/dataflow.py index 2b850098ccec8..bea45aa139e05 100644 --- a/airflow/providers/google/cloud/sensors/dataflow.py +++ b/airflow/providers/google/cloud/sensors/dataflow.py @@ -68,7 +68,7 @@ class DataflowJobStatusSensor(BaseSensorOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ['job_id'] + template_fields: Sequence[str] = ('job_id',) def __init__( self, @@ -162,7 +162,7 @@ class DataflowJobMetricsSensor(BaseSensorOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ['job_id'] + template_fields: Sequence[str] = ('job_id',) def __init__( self, @@ -255,7 +255,7 @@ class DataflowJobMessagesSensor(BaseSensorOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ['job_id'] + template_fields: Sequence[str] = ('job_id',) def __init__( self, @@ -348,7 +348,7 @@ class DataflowJobAutoScalingEventsSensor(BaseSensorOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ['job_id'] + template_fields: Sequence[str] = ('job_id',) def __init__( self, diff --git a/airflow/providers/google/cloud/sensors/datafusion.py b/airflow/providers/google/cloud/sensors/datafusion.py index 11d51d7c47286..b57ff15bd18d4 100644 --- a/airflow/providers/google/cloud/sensors/datafusion.py +++ b/airflow/providers/google/cloud/sensors/datafusion.py @@ -66,7 +66,7 @@ class CloudDataFusionPipelineStateSensor(BaseSensorOperator): """ - template_fields = ['pipeline_id'] + template_fields: Sequence[str] = ('pipeline_id',) def __init__( self, diff --git a/airflow/providers/google/cloud/sensors/dataproc.py b/airflow/providers/google/cloud/sensors/dataproc.py index eb9d0ce4ad1d0..e222c4c04fdd3 100644 --- a/airflow/providers/google/cloud/sensors/dataproc.py +++ b/airflow/providers/google/cloud/sensors/dataproc.py @@ -19,7 +19,7 @@ # pylint: disable=C0302 import time import warnings -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from google.api_core.exceptions import ServerError from google.cloud.dataproc_v1.types import JobStatus @@ -51,7 +51,7 @@ class DataprocJobSensor(BaseSensorOperator): :type wait_timeout: int """ - template_fields = ('project_id', 'region', 'dataproc_job_id') + template_fields: Sequence[str] = ('project_id', 'region', 'dataproc_job_id') ui_color = '#f0eee4' def __init__( diff --git a/airflow/providers/google/cloud/sensors/gcs.py b/airflow/providers/google/cloud/sensors/gcs.py index eee01a763c571..a71041423fea5 100644 --- a/airflow/providers/google/cloud/sensors/gcs.py +++ b/airflow/providers/google/cloud/sensors/gcs.py @@ -58,7 +58,7 @@ class GCSObjectExistenceSensor(BaseSensorOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'bucket', 'object', 'impersonation_chain', @@ -137,7 +137,7 @@ class GCSObjectUpdateSensor(BaseSensorOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'bucket', 'object', 'impersonation_chain', @@ -204,7 +204,7 @@ class GCSObjectsWithPrefixExistenceSensor(BaseSensorOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'bucket', 'prefix', 'impersonation_chain', @@ -314,7 +314,7 @@ class GCSUploadSessionCompleteSensor(BaseSensorOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'bucket', 'prefix', 'impersonation_chain', diff --git a/airflow/providers/google/cloud/sensors/pubsub.py b/airflow/providers/google/cloud/sensors/pubsub.py index 036aa09448a39..4e4d7c2599fc8 100644 --- a/airflow/providers/google/cloud/sensors/pubsub.py +++ b/airflow/providers/google/cloud/sensors/pubsub.py @@ -97,11 +97,11 @@ class PubSubPullSensor(BaseSensorOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( 'project_id', 'subscription', 'impersonation_chain', - ] + ) ui_color = '#ff7f50' def __init__( diff --git a/airflow/providers/google/cloud/sensors/workflows.py b/airflow/providers/google/cloud/sensors/workflows.py index 0d1c9c82ec22f..dcd5869e871a5 100644 --- a/airflow/providers/google/cloud/sensors/workflows.py +++ b/airflow/providers/google/cloud/sensors/workflows.py @@ -56,7 +56,7 @@ class WorkflowExecutionSensor(BaseSensorOperator): :type metadata: Sequence[Tuple[str, str]] """ - template_fields = ("location", "workflow_id", "execution_id") + template_fields: Sequence[str] = ("location", "workflow_id", "execution_id") def __init__( self, diff --git a/airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py b/airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py index d6a56efce39eb..ed85981c3cc3e 100644 --- a/airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +++ b/airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py @@ -17,7 +17,7 @@ # under the License. from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING, Iterable, Optional, Sequence, Union +from typing import TYPE_CHECKING, Optional, Sequence, Union from airflow import AirflowException from airflow.models import BaseOperator @@ -71,7 +71,7 @@ class AzureFileShareToGCSOperator(BaseOperator): templated, so you can use variables in them if you wish. """ - template_fields: Iterable[str] = ( + template_fields: Sequence[str] = ( 'share_name', 'directory_name', 'prefix', diff --git a/airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py b/airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py index 42e5ded1ba7f7..45fd5384b0174 100644 --- a/airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +++ b/airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py @@ -79,7 +79,7 @@ class BigQueryToBigQueryOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'source_project_dataset_tables', 'destination_project_dataset_table', 'labels', diff --git a/airflow/providers/google/cloud/transfers/bigquery_to_gcs.py b/airflow/providers/google/cloud/transfers/bigquery_to_gcs.py index ef8207d311794..af4596b1fe7be 100644 --- a/airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +++ b/airflow/providers/google/cloud/transfers/bigquery_to_gcs.py @@ -79,7 +79,7 @@ class BigQueryToGCSOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'source_project_dataset_table', 'destination_cloud_storage_uris', 'labels', diff --git a/airflow/providers/google/cloud/transfers/bigquery_to_mssql.py b/airflow/providers/google/cloud/transfers/bigquery_to_mssql.py index d64f7e3e01e28..8a16ed38e913f 100644 --- a/airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +++ b/airflow/providers/google/cloud/transfers/bigquery_to_mssql.py @@ -84,7 +84,7 @@ class BigQueryToMsSqlOperator(BaseOperator): :type impersonation_chain: str | Sequence[str] """ - template_fields = ('source_project_dataset_table', 'mssql_table', 'impersonation_chain') + template_fields: Sequence[str] = ('source_project_dataset_table', 'mssql_table', 'impersonation_chain') def __init__( self, diff --git a/airflow/providers/google/cloud/transfers/bigquery_to_mysql.py b/airflow/providers/google/cloud/transfers/bigquery_to_mysql.py index 3834ba69903af..438863ca313fd 100644 --- a/airflow/providers/google/cloud/transfers/bigquery_to_mysql.py +++ b/airflow/providers/google/cloud/transfers/bigquery_to_mysql.py @@ -83,7 +83,7 @@ class BigQueryToMySqlOperator(BaseOperator): :type impersonation_chain: str | Sequence[str] """ - template_fields = ( + template_fields: Sequence[str] = ( 'dataset_id', 'table_id', 'mysql_table', diff --git a/airflow/providers/google/cloud/transfers/cassandra_to_gcs.py b/airflow/providers/google/cloud/transfers/cassandra_to_gcs.py index 17b52d86f99c7..fbb4f71fb6695 100644 --- a/airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +++ b/airflow/providers/google/cloud/transfers/cassandra_to_gcs.py @@ -96,7 +96,7 @@ class CassandraToGCSOperator(BaseOperator): :type query_timeout: float | None """ - template_fields = ( + template_fields: Sequence[str] = ( 'cql', 'bucket', 'filename', diff --git a/airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py b/airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py index cb38691f5c650..0f9ef4409f9e6 100644 --- a/airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +++ b/airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py @@ -97,7 +97,7 @@ class FacebookAdsReportToGcsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "facebook_conn_id", "bucket_name", "object_name", diff --git a/airflow/providers/google/cloud/transfers/gcs_to_bigquery.py b/airflow/providers/google/cloud/transfers/gcs_to_bigquery.py index 2d5c7fd076687..365faf7ab714c 100644 --- a/airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +++ b/airflow/providers/google/cloud/transfers/gcs_to_bigquery.py @@ -163,7 +163,7 @@ class GCSToBigQueryOperator(BaseOperator): :type description: str """ - template_fields = ( + template_fields: Sequence[str] = ( 'bucket', 'source_objects', 'schema_object', diff --git a/airflow/providers/google/cloud/transfers/gcs_to_gcs.py b/airflow/providers/google/cloud/transfers/gcs_to_gcs.py index f3c1d1d84d377..63066cb16e587 100644 --- a/airflow/providers/google/cloud/transfers/gcs_to_gcs.py +++ b/airflow/providers/google/cloud/transfers/gcs_to_gcs.py @@ -176,7 +176,7 @@ class GCSToGCSOperator(BaseOperator): """ - template_fields = ( + template_fields: Sequence[str] = ( 'source_bucket', 'source_object', 'source_objects', diff --git a/airflow/providers/google/cloud/transfers/gcs_to_local.py b/airflow/providers/google/cloud/transfers/gcs_to_local.py index ed0968d28030d..0e5aca516d640 100644 --- a/airflow/providers/google/cloud/transfers/gcs_to_local.py +++ b/airflow/providers/google/cloud/transfers/gcs_to_local.py @@ -74,7 +74,7 @@ class GCSToLocalFilesystemOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'bucket', 'object_name', 'filename', diff --git a/airflow/providers/google/cloud/transfers/gcs_to_sftp.py b/airflow/providers/google/cloud/transfers/gcs_to_sftp.py index 6d10d63963093..cce5b3380e9ca 100644 --- a/airflow/providers/google/cloud/transfers/gcs_to_sftp.py +++ b/airflow/providers/google/cloud/transfers/gcs_to_sftp.py @@ -104,7 +104,7 @@ class GCSToSFTPOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "source_bucket", "source_object", "destination_path", diff --git a/airflow/providers/google/cloud/transfers/gdrive_to_gcs.py b/airflow/providers/google/cloud/transfers/gdrive_to_gcs.py index d5adb75b91c65..3efcbb8514885 100644 --- a/airflow/providers/google/cloud/transfers/gdrive_to_gcs.py +++ b/airflow/providers/google/cloud/transfers/gdrive_to_gcs.py @@ -67,14 +67,14 @@ class GoogleDriveToGCSOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( "bucket_name", "object_name", "folder_id", "file_name", "drive_id", "impersonation_chain", - ] + ) def __init__( self, diff --git a/airflow/providers/google/cloud/transfers/gdrive_to_local.py b/airflow/providers/google/cloud/transfers/gdrive_to_local.py index 8f5b066130fe2..06f64385a2fe0 100644 --- a/airflow/providers/google/cloud/transfers/gdrive_to_local.py +++ b/airflow/providers/google/cloud/transfers/gdrive_to_local.py @@ -55,13 +55,13 @@ class GoogleDriveToLocalOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( "output_file", "folder_id", "file_name", "drive_id", "impersonation_chain", - ] + ) def __init__( self, diff --git a/airflow/providers/google/cloud/transfers/local_to_gcs.py b/airflow/providers/google/cloud/transfers/local_to_gcs.py index d9926aedd5bd4..45ebb44bb7031 100644 --- a/airflow/providers/google/cloud/transfers/local_to_gcs.py +++ b/airflow/providers/google/cloud/transfers/local_to_gcs.py @@ -68,7 +68,7 @@ class LocalFilesystemToGCSOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'src', 'dst', 'bucket', diff --git a/airflow/providers/google/cloud/transfers/s3_to_gcs.py b/airflow/providers/google/cloud/transfers/s3_to_gcs.py index 81dfe32b65b8e..fa8c8656dae05 100644 --- a/airflow/providers/google/cloud/transfers/s3_to_gcs.py +++ b/airflow/providers/google/cloud/transfers/s3_to_gcs.py @@ -17,7 +17,7 @@ # under the License. import warnings from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING, Iterable, Optional, Sequence, Union +from typing import TYPE_CHECKING, Optional, Sequence, Union from airflow.exceptions import AirflowException from airflow.providers.amazon.aws.hooks.s3 import S3Hook @@ -104,7 +104,7 @@ class S3ToGCSOperator(S3ListOperator): templated, so you can use variables in them if you wish. """ - template_fields: Iterable[str] = ( + template_fields: Sequence[str] = ( 'bucket', 'prefix', 'delimiter', diff --git a/airflow/providers/google/cloud/transfers/salesforce_to_gcs.py b/airflow/providers/google/cloud/transfers/salesforce_to_gcs.py index dadb95bdbc425..3414ef62d761d 100644 --- a/airflow/providers/google/cloud/transfers/salesforce_to_gcs.py +++ b/airflow/providers/google/cloud/transfers/salesforce_to_gcs.py @@ -17,7 +17,7 @@ import os import tempfile -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.google.cloud.hooks.gcs import GCSHook @@ -63,7 +63,7 @@ class SalesforceToGcsOperator(BaseOperator): :type gcp_conn_id: str """ - template_fields = ( + template_fields: Sequence[str] = ( 'query', 'bucket_name', 'object_name', diff --git a/airflow/providers/google/cloud/transfers/sftp_to_gcs.py b/airflow/providers/google/cloud/transfers/sftp_to_gcs.py index 013a93c6f8a7b..55ead28c08c90 100644 --- a/airflow/providers/google/cloud/transfers/sftp_to_gcs.py +++ b/airflow/providers/google/cloud/transfers/sftp_to_gcs.py @@ -82,7 +82,7 @@ class SFTPToGCSOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "source_path", "destination_path", "destination_bucket", diff --git a/airflow/providers/google/cloud/transfers/sheets_to_gcs.py b/airflow/providers/google/cloud/transfers/sheets_to_gcs.py index 1713dbbbdc030..f75986e670a70 100644 --- a/airflow/providers/google/cloud/transfers/sheets_to_gcs.py +++ b/airflow/providers/google/cloud/transfers/sheets_to_gcs.py @@ -63,13 +63,13 @@ class GoogleSheetsToGCSOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( "spreadsheet_id", "destination_bucket", "destination_path", "sheet_filter", "impersonation_chain", - ] + ) def __init__( self, diff --git a/airflow/providers/google/cloud/transfers/sql_to_gcs.py b/airflow/providers/google/cloud/transfers/sql_to_gcs.py index 1d85939a95788..e345f5e8916fa 100644 --- a/airflow/providers/google/cloud/transfers/sql_to_gcs.py +++ b/airflow/providers/google/cloud/transfers/sql_to_gcs.py @@ -91,7 +91,7 @@ class BaseSQLToGCSOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'sql', 'bucket', 'filename', diff --git a/airflow/providers/google/firebase/operators/firestore.py b/airflow/providers/google/firebase/operators/firestore.py index b9c260633ebb0..eb622f7fdd4b3 100644 --- a/airflow/providers/google/firebase/operators/firestore.py +++ b/airflow/providers/google/firebase/operators/firestore.py @@ -58,7 +58,7 @@ class CloudFirestoreExportDatabaseOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "body", "gcp_conn_id", "api_version", diff --git a/airflow/providers/google/marketing_platform/operators/analytics.py b/airflow/providers/google/marketing_platform/operators/analytics.py index a9ed1feb1b122..de7fcfc62da48 100644 --- a/airflow/providers/google/marketing_platform/operators/analytics.py +++ b/airflow/providers/google/marketing_platform/operators/analytics.py @@ -57,7 +57,7 @@ class GoogleAnalyticsListAccountsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "api_version", "gcp_conn_id", "impersonation_chain", @@ -116,7 +116,7 @@ class GoogleAnalyticsGetAdsLinkOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "api_version", "gcp_conn_id", "account_id", @@ -186,7 +186,7 @@ class GoogleAnalyticsRetrieveAdsLinksListOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "api_version", "gcp_conn_id", "account_id", @@ -263,7 +263,7 @@ class GoogleAnalyticsDataImportUploadOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "storage_bucket", "storage_name_object", "impersonation_chain", @@ -360,7 +360,7 @@ class GoogleAnalyticsDeletePreviousDataUploadsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ("impersonation_chain",) + template_fields: Sequence[str] = ("impersonation_chain",) def __init__( self, @@ -442,7 +442,7 @@ class GoogleAnalyticsModifyFileHeadersDataImportOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "storage_bucket", "storage_name_object", "impersonation_chain", diff --git a/airflow/providers/google/marketing_platform/operators/campaign_manager.py b/airflow/providers/google/marketing_platform/operators/campaign_manager.py index 7c5dca4ec30ea..87276e610147f 100644 --- a/airflow/providers/google/marketing_platform/operators/campaign_manager.py +++ b/airflow/providers/google/marketing_platform/operators/campaign_manager.py @@ -69,7 +69,7 @@ class GoogleCampaignManagerDeleteReportOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "profile_id", "report_id", "report_name", @@ -171,7 +171,7 @@ class GoogleCampaignManagerDownloadReportOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "profile_id", "report_id", "file_id", @@ -304,7 +304,7 @@ class GoogleCampaignManagerInsertReportOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "profile_id", "report", "api_version", @@ -392,7 +392,7 @@ class GoogleCampaignManagerRunReportOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "profile_id", "report_id", "synchronous", @@ -489,7 +489,7 @@ class GoogleCampaignManagerBatchInsertConversionsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "profile_id", "conversions", "encryption_entity_type", @@ -590,7 +590,7 @@ class GoogleCampaignManagerBatchUpdateConversionsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "profile_id", "conversions", "encryption_entity_type", diff --git a/airflow/providers/google/marketing_platform/operators/display_video.py b/airflow/providers/google/marketing_platform/operators/display_video.py index c6503b1113dac..ce03a27cf906a 100644 --- a/airflow/providers/google/marketing_platform/operators/display_video.py +++ b/airflow/providers/google/marketing_platform/operators/display_video.py @@ -68,7 +68,7 @@ class GoogleDisplayVideo360CreateReportOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "body", "impersonation_chain", ) @@ -147,7 +147,7 @@ class GoogleDisplayVideo360DeleteReportOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "report_id", "impersonation_chain", ) @@ -239,7 +239,7 @@ class GoogleDisplayVideo360DownloadReportOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "report_id", "bucket_name", "report_name", @@ -369,7 +369,7 @@ class GoogleDisplayVideo360RunReportOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "report_id", "parameters", "impersonation_chain", @@ -439,7 +439,7 @@ class GoogleDisplayVideo360DownloadLineItemsOperator(BaseOperator): :type request_body: Dict[str, Any], """ - template_fields = ( + template_fields: Sequence[str] = ( "request_body", "bucket_name", "object_name", @@ -523,7 +523,7 @@ class GoogleDisplayVideo360UploadLineItemsOperator(BaseOperator): :type dry_run: str, """ - template_fields = ( + template_fields: Sequence[str] = ( "bucket_name", "object_name", "impersonation_chain", @@ -615,7 +615,7 @@ class GoogleDisplayVideo360CreateSDFDownloadTaskOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "body_request", "impersonation_chain", ) @@ -696,7 +696,7 @@ class GoogleDisplayVideo360SDFtoGCSOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "operation_name", "bucket_name", "object_name", diff --git a/airflow/providers/google/marketing_platform/operators/search_ads.py b/airflow/providers/google/marketing_platform/operators/search_ads.py index b365e52ebaeea..88662f07eee81 100644 --- a/airflow/providers/google/marketing_platform/operators/search_ads.py +++ b/airflow/providers/google/marketing_platform/operators/search_ads.py @@ -62,7 +62,7 @@ class GoogleSearchAdsInsertReportOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "report", "impersonation_chain", ) @@ -146,7 +146,7 @@ class GoogleSearchAdsDownloadReportOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "report_name", "report_id", "bucket_name", diff --git a/airflow/providers/google/marketing_platform/sensors/campaign_manager.py b/airflow/providers/google/marketing_platform/sensors/campaign_manager.py index 8e4f4e0910ec6..652c4fac46d4b 100644 --- a/airflow/providers/google/marketing_platform/sensors/campaign_manager.py +++ b/airflow/providers/google/marketing_platform/sensors/campaign_manager.py @@ -62,7 +62,7 @@ class GoogleCampaignManagerReportSensor(BaseSensorOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "profile_id", "report_id", "file_id", diff --git a/airflow/providers/google/marketing_platform/sensors/display_video.py b/airflow/providers/google/marketing_platform/sensors/display_video.py index 38db972c0f8a1..82a7c66309bd7 100644 --- a/airflow/providers/google/marketing_platform/sensors/display_video.py +++ b/airflow/providers/google/marketing_platform/sensors/display_video.py @@ -55,7 +55,7 @@ class GoogleDisplayVideo360ReportSensor(BaseSensorOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "report_id", "impersonation_chain", ) @@ -122,7 +122,7 @@ class GoogleDisplayVideo360GetSDFDownloadOperationSensor(BaseSensorOperator): """ - template_fields = ( + template_fields: Sequence[str] = ( "operation_name", "impersonation_chain", ) diff --git a/airflow/providers/google/marketing_platform/sensors/search_ads.py b/airflow/providers/google/marketing_platform/sensors/search_ads.py index c39b0e914eca9..53002be970985 100644 --- a/airflow/providers/google/marketing_platform/sensors/search_ads.py +++ b/airflow/providers/google/marketing_platform/sensors/search_ads.py @@ -58,7 +58,7 @@ class GoogleSearchAdsReportSensor(BaseSensorOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "report_id", "impersonation_chain", ) diff --git a/airflow/providers/google/suite/operators/sheets.py b/airflow/providers/google/suite/operators/sheets.py index 642f4f943d1cb..f3548ca17eac0 100644 --- a/airflow/providers/google/suite/operators/sheets.py +++ b/airflow/providers/google/suite/operators/sheets.py @@ -49,10 +49,10 @@ class GoogleSheetsCreateSpreadsheetOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( "spreadsheet", "impersonation_chain", - ] + ) def __init__( self, diff --git a/airflow/providers/google/suite/sensors/drive.py b/airflow/providers/google/suite/sensors/drive.py index 63c4cc9287b6c..7fbc6c19ba3f5 100644 --- a/airflow/providers/google/suite/sensors/drive.py +++ b/airflow/providers/google/suite/sensors/drive.py @@ -54,7 +54,7 @@ class GoogleDriveFileExistenceSensor(BaseSensorOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( 'folder_id', 'file_name', 'drive_id', diff --git a/airflow/providers/google/suite/transfers/gcs_to_gdrive.py b/airflow/providers/google/suite/transfers/gcs_to_gdrive.py index e85d803c6ed89..72c5fc89b54a5 100644 --- a/airflow/providers/google/suite/transfers/gcs_to_gdrive.py +++ b/airflow/providers/google/suite/transfers/gcs_to_gdrive.py @@ -84,7 +84,7 @@ class GCSToGoogleDriveOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "source_bucket", "source_object", "destination_object", diff --git a/airflow/providers/google/suite/transfers/gcs_to_sheets.py b/airflow/providers/google/suite/transfers/gcs_to_sheets.py index 92c3cfa29b29a..733c729f291f5 100644 --- a/airflow/providers/google/suite/transfers/gcs_to_sheets.py +++ b/airflow/providers/google/suite/transfers/gcs_to_sheets.py @@ -57,13 +57,13 @@ class GCSToGoogleSheetsOperator(BaseOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = [ + template_fields: Sequence[str] = ( "spreadsheet_id", "bucket_name", "object_name", "spreadsheet_range", "impersonation_chain", - ] + ) def __init__( self, diff --git a/airflow/providers/google/suite/transfers/sql_to_sheets.py b/airflow/providers/google/suite/transfers/sql_to_sheets.py index fa2f4cfdf634a..cf9206a1f73b6 100644 --- a/airflow/providers/google/suite/transfers/sql_to_sheets.py +++ b/airflow/providers/google/suite/transfers/sql_to_sheets.py @@ -58,7 +58,7 @@ class SQLToGoogleSheetsOperator(BaseSQLOperator): :type impersonation_chain: Union[str, Sequence[str]] """ - template_fields = ( + template_fields: Sequence[str] = ( "sql", "spreadsheet_id", "spreadsheet_range", diff --git a/airflow/providers/grpc/operators/grpc.py b/airflow/providers/grpc/operators/grpc.py index feab25cbecda8..98a959520dfa8 100644 --- a/airflow/providers/grpc/operators/grpc.py +++ b/airflow/providers/grpc/operators/grpc.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional +from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.grpc.hooks.grpc import GrpcHook @@ -52,7 +52,7 @@ class GrpcOperator(BaseOperator): :type log_response: boolean """ - template_fields = ('stub_class', 'call_func', 'data') + template_fields: Sequence[str] = ('stub_class', 'call_func', 'data') template_fields_renderers = {"data": "py"} def __init__( diff --git a/airflow/providers/http/operators/http.py b/airflow/providers/http/operators/http.py index 77b5652c25ff6..abafb974af6c6 100644 --- a/airflow/providers/http/operators/http.py +++ b/airflow/providers/http/operators/http.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Type +from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Sequence, Type from requests.auth import AuthBase, HTTPBasicAuth @@ -68,11 +68,11 @@ class SimpleHttpOperator(BaseOperator): :type auth_type: AuthBase of python requests lib """ - template_fields = [ + template_fields: Sequence[str] = ( 'endpoint', 'data', 'headers', - ] + ) template_fields_renderers = {'headers': 'json', 'data': 'py'} template_ext = () ui_color = '#f4a460' diff --git a/airflow/providers/http/sensors/http.py b/airflow/providers/http/sensors/http.py index cd21ff34d3560..41f7d8dd61427 100644 --- a/airflow/providers/http/sensors/http.py +++ b/airflow/providers/http/sensors/http.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Any, Callable, Dict, Optional +from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Sequence from airflow.exceptions import AirflowException from airflow.providers.http.hooks.http import HttpHook @@ -74,7 +74,7 @@ def response_check(response, task_instance): depends on the option that's being modified. """ - template_fields = ('endpoint', 'request_params', 'headers') + template_fields: Sequence[str] = ('endpoint', 'request_params', 'headers') def __init__( self, diff --git a/airflow/providers/imap/sensors/imap_attachment.py b/airflow/providers/imap/sensors/imap_attachment.py index 30d42948c04ba..5e048bfb1e79f 100644 --- a/airflow/providers/imap/sensors/imap_attachment.py +++ b/airflow/providers/imap/sensors/imap_attachment.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. """This module allows you to poke for attachments on a mail server.""" -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.providers.imap.hooks.imap import ImapHook from airflow.sensors.base import BaseSensorOperator @@ -44,7 +44,7 @@ class ImapAttachmentSensor(BaseSensorOperator): :type imap_conn_id: str """ - template_fields = ('attachment_name', 'mail_filter') + template_fields: Sequence[str] = ('attachment_name', 'mail_filter') def __init__( self, diff --git a/airflow/providers/influxdb/operators/influxdb.py b/airflow/providers/influxdb/operators/influxdb.py index e4c5a24e936fc..b5dc0205eff8c 100644 --- a/airflow/providers/influxdb/operators/influxdb.py +++ b/airflow/providers/influxdb/operators/influxdb.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.models import BaseOperator from airflow.providers.influxdb.hooks.influxdb import InfluxDBHook @@ -39,7 +39,7 @@ class InfluxDBOperator(BaseOperator): :type influxdb_conn_id: str """ - template_fields = ['sql'] + template_fields: Sequence[str] = ('sql',) def __init__( self, diff --git a/airflow/providers/jdbc/operators/jdbc.py b/airflow/providers/jdbc/operators/jdbc.py index 4493ab1489834..be90228dedd1f 100644 --- a/airflow/providers/jdbc/operators/jdbc.py +++ b/airflow/providers/jdbc/operators/jdbc.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Iterable, List, Mapping, Optional, Union +from typing import TYPE_CHECKING, Iterable, List, Mapping, Optional, Sequence, Union from airflow.models import BaseOperator from airflow.providers.jdbc.hooks.jdbc import JdbcHook @@ -47,7 +47,7 @@ class JdbcOperator(BaseOperator): :type parameters: dict or iterable """ - template_fields = ('sql',) + template_fields: Sequence[str] = ('sql',) template_ext = ('.sql',) ui_color = '#ededed' diff --git a/airflow/providers/jenkins/operators/jenkins_job_trigger.py b/airflow/providers/jenkins/operators/jenkins_job_trigger.py index 4d5c27c3e8746..f28bd5695948c 100644 --- a/airflow/providers/jenkins/operators/jenkins_job_trigger.py +++ b/airflow/providers/jenkins/operators/jenkins_job_trigger.py @@ -20,7 +20,7 @@ import json import socket import time -from typing import Any, Dict, Iterable, List, Mapping, Optional, Union +from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence, Union from urllib.error import HTTPError, URLError import jenkins @@ -95,7 +95,7 @@ class JenkinsJobTriggerOperator(BaseOperator): :type allowed_jenkins_states: Optional[Iterable[str]] """ - template_fields = ('parameters',) + template_fields: Sequence[str] = ('parameters',) template_ext = ('.json',) ui_color = '#f9ec86' diff --git a/airflow/providers/jira/operators/jira.py b/airflow/providers/jira/operators/jira.py index d970962e96c32..9e610ce254b6e 100644 --- a/airflow/providers/jira/operators/jira.py +++ b/airflow/providers/jira/operators/jira.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Any, Callable, Optional +from typing import TYPE_CHECKING, Any, Callable, Optional, Sequence from airflow.exceptions import AirflowException from airflow.models import BaseOperator @@ -44,7 +44,7 @@ class JiraOperator(BaseOperator): :type get_jira_resource_method: function """ - template_fields = ("jira_method_args",) + template_fields: Sequence[str] = ("jira_method_args",) def __init__( self, diff --git a/airflow/providers/jira/sensors/jira.py b/airflow/providers/jira/sensors/jira.py index bed5b5fe4b6f1..c7cfc3f21a131 100644 --- a/airflow/providers/jira/sensors/jira.py +++ b/airflow/providers/jira/sensors/jira.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Any, Callable, Optional +from typing import TYPE_CHECKING, Any, Callable, Optional, Sequence from jira.resources import Issue, Resource @@ -84,7 +84,7 @@ class JiraTicketSensor(JiraSensor): :type result_processor: function """ - template_fields = ("ticket_id",) + template_fields: Sequence[str] = ("ticket_id",) def __init__( self, diff --git a/airflow/providers/microsoft/azure/operators/adx.py b/airflow/providers/microsoft/azure/operators/adx.py index 6d50347b17926..8dec65120e231 100644 --- a/airflow/providers/microsoft/azure/operators/adx.py +++ b/airflow/providers/microsoft/azure/operators/adx.py @@ -18,7 +18,7 @@ # """This module contains Azure Data Explorer operators""" -from typing import TYPE_CHECKING, Optional, Union +from typing import TYPE_CHECKING, Optional, Sequence, Union from azure.kusto.data._models import KustoResultTable @@ -47,7 +47,7 @@ class AzureDataExplorerQueryOperator(BaseOperator): """ ui_color = '#00a1f2' - template_fields = ('query', 'database') + template_fields: Sequence[str] = ('query', 'database') template_ext = ('.kql',) def __init__( diff --git a/airflow/providers/microsoft/azure/operators/batch.py b/airflow/providers/microsoft/azure/operators/batch.py index 7d66de89332f0..1eecbd21a720c 100644 --- a/airflow/providers/microsoft/azure/operators/batch.py +++ b/airflow/providers/microsoft/azure/operators/batch.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. # -from typing import TYPE_CHECKING, Any, List, Optional +from typing import TYPE_CHECKING, Any, List, Optional, Sequence from azure.batch import models as batch_models @@ -124,7 +124,7 @@ class AzureBatchOperator(BaseOperator): :type should_delete_pool: bool """ - template_fields = ( + template_fields: Sequence[str] = ( 'batch_pool_id', 'batch_pool_vm_size', 'batch_job_id', diff --git a/airflow/providers/microsoft/azure/operators/container_instances.py b/airflow/providers/microsoft/azure/operators/container_instances.py index d6a935678201e..c9524f4cc045f 100644 --- a/airflow/providers/microsoft/azure/operators/container_instances.py +++ b/airflow/providers/microsoft/azure/operators/container_instances.py @@ -135,7 +135,7 @@ class AzureContainerInstancesOperator(BaseOperator): ) """ - template_fields = ('name', 'image', 'command', 'environment_variables') + template_fields: Sequence[str] = ('name', 'image', 'command', 'environment_variables') template_fields_renderers = {"command": "bash", "environment_variables": "json"} def __init__( diff --git a/airflow/providers/microsoft/azure/operators/cosmos.py b/airflow/providers/microsoft/azure/operators/cosmos.py index 9759349221f8d..e42891674938b 100644 --- a/airflow/providers/microsoft/azure/operators/cosmos.py +++ b/airflow/providers/microsoft/azure/operators/cosmos.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.models import BaseOperator from airflow.providers.microsoft.azure.hooks.cosmos import AzureCosmosDBHook @@ -40,7 +40,7 @@ class AzureCosmosInsertDocumentOperator(BaseOperator): :type azure_cosmos_conn_id: str """ - template_fields = ('database_name', 'collection_name') + template_fields: Sequence[str] = ('database_name', 'collection_name') ui_color = '#e4f0e8' def __init__( diff --git a/airflow/providers/microsoft/azure/operators/data_factory.py b/airflow/providers/microsoft/azure/operators/data_factory.py index 0a10ca9786312..61ba697e0b445 100644 --- a/airflow/providers/microsoft/azure/operators/data_factory.py +++ b/airflow/providers/microsoft/azure/operators/data_factory.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Any, Dict, Optional +from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence from airflow.hooks.base import BaseHook from airflow.models import BaseOperator, BaseOperatorLink, TaskInstance @@ -106,7 +106,7 @@ class AzureDataFactoryRunPipelineOperator(BaseOperator): :type check_interval: int """ - template_fields = ( + template_fields: Sequence[str] = ( "azure_data_factory_conn_id", "resource_group_name", "factory_name", diff --git a/airflow/providers/microsoft/azure/operators/wasb_delete_blob.py b/airflow/providers/microsoft/azure/operators/wasb_delete_blob.py index f6c12cff7fbb2..9a818352a2ded 100644 --- a/airflow/providers/microsoft/azure/operators/wasb_delete_blob.py +++ b/airflow/providers/microsoft/azure/operators/wasb_delete_blob.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. # -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, Sequence from airflow.models import BaseOperator from airflow.providers.microsoft.azure.hooks.wasb import WasbHook @@ -44,7 +44,7 @@ class WasbDeleteBlobOperator(BaseOperator): :type ignore_if_missing: bool """ - template_fields = ('container_name', 'blob_name') + template_fields: Sequence[str] = ('container_name', 'blob_name') def __init__( self, diff --git a/airflow/providers/microsoft/azure/sensors/cosmos.py b/airflow/providers/microsoft/azure/sensors/cosmos.py index 0ca19478ba5cd..3a1ae59b6caf8 100644 --- a/airflow/providers/microsoft/azure/sensors/cosmos.py +++ b/airflow/providers/microsoft/azure/sensors/cosmos.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.providers.microsoft.azure.hooks.cosmos import AzureCosmosDBHook from airflow.sensors.base import BaseSensorOperator @@ -49,7 +49,7 @@ class AzureCosmosDocumentSensor(BaseSensorOperator): :type azure_cosmos_conn_id: str """ - template_fields = ('database_name', 'collection_name', 'document_id') + template_fields: Sequence[str] = ('database_name', 'collection_name', 'document_id') def __init__( self, diff --git a/airflow/providers/microsoft/azure/sensors/data_factory.py b/airflow/providers/microsoft/azure/sensors/data_factory.py index 4b59d4bd93378..31ce16ce960cc 100644 --- a/airflow/providers/microsoft/azure/sensors/data_factory.py +++ b/airflow/providers/microsoft/azure/sensors/data_factory.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.providers.microsoft.azure.hooks.data_factory import ( AzureDataFactoryHook, @@ -42,7 +42,12 @@ class AzureDataFactoryPipelineRunStatusSensor(BaseSensorOperator): :type factory_name: str """ - template_fields = ("azure_data_factory_conn_id", "resource_group_name", "factory_name", "run_id") + template_fields: Sequence[str] = ( + "azure_data_factory_conn_id", + "resource_group_name", + "factory_name", + "run_id", + ) ui_color = "#50e6ff" diff --git a/airflow/providers/microsoft/azure/sensors/wasb.py b/airflow/providers/microsoft/azure/sensors/wasb.py index dae7178344cd0..2480c053ed9da 100644 --- a/airflow/providers/microsoft/azure/sensors/wasb.py +++ b/airflow/providers/microsoft/azure/sensors/wasb.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. # -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.providers.microsoft.azure.hooks.wasb import WasbHook from airflow.sensors.base import BaseSensorOperator @@ -40,7 +40,7 @@ class WasbBlobSensor(BaseSensorOperator): :type check_options: dict """ - template_fields = ('container_name', 'blob_name') + template_fields: Sequence[str] = ('container_name', 'blob_name') def __init__( self, @@ -80,7 +80,7 @@ class WasbPrefixSensor(BaseSensorOperator): :type check_options: dict """ - template_fields = ('container_name', 'prefix') + template_fields: Sequence[str] = ('container_name', 'prefix') def __init__( self, diff --git a/airflow/providers/microsoft/azure/transfers/azure_blob_to_gcs.py b/airflow/providers/microsoft/azure/transfers/azure_blob_to_gcs.py index 9b73cceed667f..8dd5e79355ae9 100644 --- a/airflow/providers/microsoft/azure/transfers/azure_blob_to_gcs.py +++ b/airflow/providers/microsoft/azure/transfers/azure_blob_to_gcs.py @@ -97,7 +97,7 @@ def __init__( self.delegate_to = delegate_to self.impersonation_chain = impersonation_chain - template_fields = ( + template_fields: Sequence[str] = ( "blob_name", "file_path", "container_name", diff --git a/airflow/providers/microsoft/azure/transfers/local_to_adls.py b/airflow/providers/microsoft/azure/transfers/local_to_adls.py index ec06db59ad44d..29184b731d9db 100644 --- a/airflow/providers/microsoft/azure/transfers/local_to_adls.py +++ b/airflow/providers/microsoft/azure/transfers/local_to_adls.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. import warnings -from typing import TYPE_CHECKING, Any, Dict, Optional +from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence from airflow.exceptions import AirflowException from airflow.models import BaseOperator @@ -61,7 +61,7 @@ class LocalFilesystemToADLSOperator(BaseOperator): :type azure_data_lake_conn_id: str """ - template_fields = ("local_path", "remote_path") + template_fields: Sequence[str] = ("local_path", "remote_path") ui_color = '#e4f0e8' def __init__( diff --git a/airflow/providers/microsoft/azure/transfers/local_to_wasb.py b/airflow/providers/microsoft/azure/transfers/local_to_wasb.py index 8b6967eeed6a6..d795b98e028d7 100644 --- a/airflow/providers/microsoft/azure/transfers/local_to_wasb.py +++ b/airflow/providers/microsoft/azure/transfers/local_to_wasb.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. # -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.microsoft.azure.hooks.wasb import WasbHook @@ -42,7 +42,7 @@ class LocalFilesystemToWasbOperator(BaseOperator): :type load_options: Optional[dict] """ - template_fields = ('file_path', 'container_name', 'blob_name') + template_fields: Sequence[str] = ('file_path', 'container_name', 'blob_name') def __init__( self, diff --git a/airflow/providers/microsoft/azure/transfers/oracle_to_azure_data_lake.py b/airflow/providers/microsoft/azure/transfers/oracle_to_azure_data_lake.py index 03d037d6c90e9..37db7472c1a85 100644 --- a/airflow/providers/microsoft/azure/transfers/oracle_to_azure_data_lake.py +++ b/airflow/providers/microsoft/azure/transfers/oracle_to_azure_data_lake.py @@ -18,7 +18,7 @@ import os from tempfile import TemporaryDirectory -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any, Optional, Sequence, Union import unicodecsv as csv @@ -58,7 +58,7 @@ class OracleToAzureDataLakeOperator(BaseOperator): :type quoting: str """ - template_fields = ('filename', 'sql', 'sql_params') + template_fields: Sequence[str] = ('filename', 'sql', 'sql_params') template_fields_renderers = {"sql_params": "py"} ui_color = '#e08c8c' diff --git a/airflow/providers/microsoft/azure/transfers/sftp_to_wasb.py b/airflow/providers/microsoft/azure/transfers/sftp_to_wasb.py index 2d46745cbbd08..530145de2fce4 100644 --- a/airflow/providers/microsoft/azure/transfers/sftp_to_wasb.py +++ b/airflow/providers/microsoft/azure/transfers/sftp_to_wasb.py @@ -20,7 +20,7 @@ import sys from collections import namedtuple from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING, Dict, List, Optional, Tuple +from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, Tuple if TYPE_CHECKING: from airflow.utils.context import Context @@ -76,7 +76,7 @@ class SFTPToWasbOperator(BaseOperator): :type move_object: bool """ - template_fields = ("sftp_source_path", "container_name", "blob_prefix") + template_fields: Sequence[str] = ("sftp_source_path", "container_name", "blob_prefix") def __init__( self, diff --git a/airflow/providers/microsoft/mssql/operators/mssql.py b/airflow/providers/microsoft/mssql/operators/mssql.py index ec6ce22453f5e..4ecb7a53d14dd 100644 --- a/airflow/providers/microsoft/mssql/operators/mssql.py +++ b/airflow/providers/microsoft/mssql/operators/mssql.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Iterable, Mapping, Optional, Union +from typing import TYPE_CHECKING, Iterable, Mapping, Optional, Sequence, Union from airflow.exceptions import AirflowException from airflow.models import BaseOperator @@ -53,7 +53,7 @@ class MsSqlOperator(BaseOperator): :type database: str """ - template_fields = ('sql',) + template_fields: Sequence[str] = ('sql',) template_ext = ('.sql',) ui_color = '#ededed' diff --git a/airflow/providers/microsoft/psrp/operators/psrp.py b/airflow/providers/microsoft/psrp/operators/psrp.py index 38221e2fda0d2..6a2f97206c5b9 100644 --- a/airflow/providers/microsoft/psrp/operators/psrp.py +++ b/airflow/providers/microsoft/psrp/operators/psrp.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, List, Optional +from typing import TYPE_CHECKING, List, Optional, Sequence from airflow.exceptions import AirflowException from airflow.models import BaseOperator @@ -37,7 +37,7 @@ class PSRPOperator(BaseOperator): :type powershell: str """ - template_fields = ( + template_fields: Sequence[str] = ( "command", "powershell", ) diff --git a/airflow/providers/microsoft/winrm/operators/winrm.py b/airflow/providers/microsoft/winrm/operators/winrm.py index a061206b5d05a..609ba5da9e801 100644 --- a/airflow/providers/microsoft/winrm/operators/winrm.py +++ b/airflow/providers/microsoft/winrm/operators/winrm.py @@ -18,7 +18,7 @@ import logging from base64 import b64encode -from typing import TYPE_CHECKING, Optional, Union +from typing import TYPE_CHECKING, Optional, Sequence, Union from winrm.exceptions import WinRMOperationTimeoutError @@ -58,7 +58,7 @@ class WinRMOperator(BaseOperator): :type timeout: int """ - template_fields = ('command',) + template_fields: Sequence[str] = ('command',) template_fields_renderers = {"command": "powershell"} def __init__( diff --git a/airflow/providers/mongo/sensors/mongo.py b/airflow/providers/mongo/sensors/mongo.py index 44058d628be14..059431ebb78ae 100644 --- a/airflow/providers/mongo/sensors/mongo.py +++ b/airflow/providers/mongo/sensors/mongo.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.providers.mongo.hooks.mongo import MongoHook from airflow.sensors.base import BaseSensorOperator @@ -46,7 +46,7 @@ class MongoSensor(BaseSensorOperator): :type mongo_db: str """ - template_fields = ('collection', 'query') + template_fields: Sequence[str] = ('collection', 'query') def __init__( self, *, collection: str, query: dict, mongo_conn_id: str = "mongo_default", mongo_db=None, **kwargs diff --git a/airflow/providers/mysql/operators/mysql.py b/airflow/providers/mysql/operators/mysql.py index 67e76b22b35ca..e7a2658c6300c 100644 --- a/airflow/providers/mysql/operators/mysql.py +++ b/airflow/providers/mysql/operators/mysql.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. import ast -from typing import TYPE_CHECKING, Iterable, List, Mapping, Optional, Union +from typing import TYPE_CHECKING, Iterable, List, Mapping, Optional, Sequence, Union from airflow.models import BaseOperator from airflow.providers.mysql.hooks.mysql import MySqlHook @@ -51,7 +51,7 @@ class MySqlOperator(BaseOperator): :type database: str """ - template_fields = ('sql', 'parameters') + template_fields: Sequence[str] = ('sql', 'parameters') template_fields_renderers = {'sql': 'sql', 'parameters': 'json'} template_ext = ('.sql', '.json') ui_color = '#ededed' diff --git a/airflow/providers/mysql/transfers/presto_to_mysql.py b/airflow/providers/mysql/transfers/presto_to_mysql.py index 07d4bed6be26f..b1bb5cfd99357 100644 --- a/airflow/providers/mysql/transfers/presto_to_mysql.py +++ b/airflow/providers/mysql/transfers/presto_to_mysql.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.mysql.hooks.mysql import MySqlHook @@ -47,7 +47,7 @@ class PrestoToMySqlOperator(BaseOperator): :type mysql_preoperator: str """ - template_fields = ('sql', 'mysql_table', 'mysql_preoperator') + template_fields: Sequence[str] = ('sql', 'mysql_table', 'mysql_preoperator') template_ext = ('.sql',) template_fields_renderers = {"sql": "sql", "mysql_preoperator": "sql"} ui_color = '#a0e08c' diff --git a/airflow/providers/mysql/transfers/s3_to_mysql.py b/airflow/providers/mysql/transfers/s3_to_mysql.py index a2d20ce39d99f..f6971a83bad93 100644 --- a/airflow/providers/mysql/transfers/s3_to_mysql.py +++ b/airflow/providers/mysql/transfers/s3_to_mysql.py @@ -16,7 +16,7 @@ # under the License. import os -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.s3 import S3Hook @@ -48,7 +48,7 @@ class S3ToMySqlOperator(BaseOperator): :type mysql_conn_id: str """ - template_fields = ( + template_fields: Sequence[str] = ( 's3_source_key', 'mysql_table', ) diff --git a/airflow/providers/mysql/transfers/trino_to_mysql.py b/airflow/providers/mysql/transfers/trino_to_mysql.py index bdae7abe2fd2a..7d1738297b26f 100644 --- a/airflow/providers/mysql/transfers/trino_to_mysql.py +++ b/airflow/providers/mysql/transfers/trino_to_mysql.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.mysql.hooks.mysql import MySqlHook @@ -47,7 +47,7 @@ class TrinoToMySqlOperator(BaseOperator): :type mysql_preoperator: str """ - template_fields = ('sql', 'mysql_table', 'mysql_preoperator') + template_fields: Sequence[str] = ('sql', 'mysql_table', 'mysql_preoperator') template_ext = ('.sql',) template_fields_renderers = {"sql": "sql", "mysql_preoperator": "sql"} ui_color = '#a0e08c' diff --git a/airflow/providers/mysql/transfers/vertica_to_mysql.py b/airflow/providers/mysql/transfers/vertica_to_mysql.py index 880738983d1d9..4e323f5c9232e 100644 --- a/airflow/providers/mysql/transfers/vertica_to_mysql.py +++ b/airflow/providers/mysql/transfers/vertica_to_mysql.py @@ -18,7 +18,7 @@ from contextlib import closing from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence import MySQLdb import unicodecsv as csv @@ -60,7 +60,7 @@ class VerticaToMySqlOperator(BaseOperator): :type bulk_load: bool """ - template_fields = ('sql', 'mysql_table', 'mysql_preoperator', 'mysql_postoperator') + template_fields: Sequence[str] = ('sql', 'mysql_table', 'mysql_preoperator', 'mysql_postoperator') template_ext = ('.sql',) template_fields_renderers = { "sql": "sql", diff --git a/airflow/providers/neo4j/operators/neo4j.py b/airflow/providers/neo4j/operators/neo4j.py index a7210451be10d..e519bac8d0f53 100644 --- a/airflow/providers/neo4j/operators/neo4j.py +++ b/airflow/providers/neo4j/operators/neo4j.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Iterable, Mapping, Optional, Union +from typing import TYPE_CHECKING, Iterable, Mapping, Optional, Sequence, Union from airflow.models import BaseOperator from airflow.providers.neo4j.hooks.neo4j import Neo4jHook @@ -39,7 +39,7 @@ class Neo4jOperator(BaseOperator): :type neo4j_conn_id: str """ - template_fields = ['sql'] + template_fields: Sequence[str] = ('sql',) def __init__( self, diff --git a/airflow/providers/opsgenie/operators/opsgenie.py b/airflow/providers/opsgenie/operators/opsgenie.py index 592f7f1d3b423..c1ffbf01a356f 100644 --- a/airflow/providers/opsgenie/operators/opsgenie.py +++ b/airflow/providers/opsgenie/operators/opsgenie.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. # -from typing import TYPE_CHECKING, Any, Dict, List, Optional +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.opsgenie.hooks.opsgenie import OpsgenieAlertHook @@ -73,7 +73,7 @@ class OpsgenieCreateAlertOperator(BaseOperator): :type note: str """ - template_fields = ('message', 'alias', 'description', 'entity', 'priority', 'note') + template_fields: Sequence[str] = ('message', 'alias', 'description', 'entity', 'priority', 'note') def __init__( self, diff --git a/airflow/providers/oracle/operators/oracle.py b/airflow/providers/oracle/operators/oracle.py index dac7d6b2c485a..d97cf4883206c 100644 --- a/airflow/providers/oracle/operators/oracle.py +++ b/airflow/providers/oracle/operators/oracle.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Dict, Iterable, List, Mapping, Optional, Union +from typing import TYPE_CHECKING, Dict, Iterable, List, Mapping, Optional, Sequence, Union from airflow.models import BaseOperator from airflow.providers.oracle.hooks.oracle import OracleHook @@ -43,7 +43,7 @@ class OracleOperator(BaseOperator): :type autocommit: bool """ - template_fields = ('sql',) + template_fields: Sequence[str] = ('sql',) template_ext = ('.sql',) ui_color = '#ededed' @@ -82,7 +82,7 @@ class OracleStoredProcedureOperator(BaseOperator): :type parameters: dict or iterable """ - template_fields = ('procedure',) + template_fields: Sequence[str] = ('procedure',) ui_color = '#ededed' def __init__( diff --git a/airflow/providers/oracle/transfers/oracle_to_oracle.py b/airflow/providers/oracle/transfers/oracle_to_oracle.py index e29791af7420d..91e37f81f5881 100644 --- a/airflow/providers/oracle/transfers/oracle_to_oracle.py +++ b/airflow/providers/oracle/transfers/oracle_to_oracle.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.oracle.hooks.oracle import OracleHook @@ -44,7 +44,7 @@ class OracleToOracleOperator(BaseOperator): :type rows_chunk: int """ - template_fields = ('source_sql', 'source_sql_params') + template_fields: Sequence[str] = ('source_sql', 'source_sql_params') template_fields_renderers = {"source_sql": "sql", "source_sql_params": "py"} ui_color = '#e08c8c' diff --git a/airflow/providers/papermill/operators/papermill.py b/airflow/providers/papermill/operators/papermill.py index df66a4c7fd908..4650599d6198a 100644 --- a/airflow/providers/papermill/operators/papermill.py +++ b/airflow/providers/papermill/operators/papermill.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Dict, Optional +from typing import TYPE_CHECKING, Dict, Optional, Sequence import attr import papermill as pm @@ -54,7 +54,7 @@ class PapermillOperator(BaseOperator): supports_lineage = True - template_fields = ('input_nb', 'output_nb', 'parameters', 'kernel_name') + template_fields: Sequence[str] = ('input_nb', 'output_nb', 'parameters', 'kernel_name') def __init__( self, diff --git a/airflow/providers/postgres/operators/postgres.py b/airflow/providers/postgres/operators/postgres.py index ff1293bc20cf6..74d0195e0f48c 100644 --- a/airflow/providers/postgres/operators/postgres.py +++ b/airflow/providers/postgres/operators/postgres.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Iterable, List, Mapping, Optional, Union +from typing import TYPE_CHECKING, Iterable, List, Mapping, Optional, Sequence, Union from airflow.models import BaseOperator from airflow.providers.postgres.hooks.postgres import PostgresHook @@ -44,7 +44,7 @@ class PostgresOperator(BaseOperator): :type database: str """ - template_fields = ('sql',) + template_fields: Sequence[str] = ('sql',) template_fields_renderers = {'sql': 'sql'} template_ext = ('.sql',) ui_color = '#ededed' diff --git a/airflow/providers/qubole/operators/qubole.py b/airflow/providers/qubole/operators/qubole.py index f45fb4211e62e..1b2d02f4008e0 100644 --- a/airflow/providers/qubole/operators/qubole.py +++ b/airflow/providers/qubole/operators/qubole.py @@ -18,7 +18,7 @@ """Qubole operator""" import re from datetime import datetime -from typing import TYPE_CHECKING, Iterable, Optional +from typing import TYPE_CHECKING, Iterable, Optional, Sequence from airflow.hooks.base import BaseHook from airflow.models import BaseOperator, BaseOperatorLink @@ -186,7 +186,7 @@ class QuboleOperator(BaseOperator): handler in task definition. """ - template_fields: Iterable[str] = ( + template_fields: Sequence[str] = ( 'query', 'script_location', 'sub_command', diff --git a/airflow/providers/qubole/operators/qubole_check.py b/airflow/providers/qubole/operators/qubole_check.py index bd5d42406226f..e0c2de3285330 100644 --- a/airflow/providers/qubole/operators/qubole_check.py +++ b/airflow/providers/qubole/operators/qubole_check.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. # -from typing import Callable, Iterable, Optional, Union +from typing import Callable, Optional, Sequence, Union from airflow.exceptions import AirflowException from airflow.operators.sql import SQLCheckOperator, SQLValueCheckOperator @@ -105,8 +105,8 @@ class QuboleCheckOperator(_QuboleCheckOperatorMixin, SQLCheckOperator, QuboleOpe """ - template_fields: Iterable[str] = set(QuboleOperator.template_fields) | set( - SQLCheckOperator.template_fields + template_fields: Sequence[str] = tuple( + set(QuboleOperator.template_fields) | set(SQLCheckOperator.template_fields) ) template_ext = QuboleOperator.template_ext ui_fgcolor = '#000' diff --git a/airflow/providers/qubole/sensors/qubole.py b/airflow/providers/qubole/sensors/qubole.py index 59a15f1611003..0ea1c43f13791 100644 --- a/airflow/providers/qubole/sensors/qubole.py +++ b/airflow/providers/qubole/sensors/qubole.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from qds_sdk.qubole import Qubole from qds_sdk.sensors import FileSensor, PartitionSensor @@ -31,7 +31,7 @@ class QuboleSensor(BaseSensorOperator): """Base class for all Qubole Sensors""" - template_fields = ('data', 'qubole_conn_id') + template_fields: Sequence[str] = ('data', 'qubole_conn_id') template_ext = ('.txt',) diff --git a/airflow/providers/redis/operators/redis_publish.py b/airflow/providers/redis/operators/redis_publish.py index a013dd3188904..576ceeffdae4d 100644 --- a/airflow/providers/redis/operators/redis_publish.py +++ b/airflow/providers/redis/operators/redis_publish.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.models import BaseOperator from airflow.providers.redis.hooks.redis import RedisHook @@ -36,7 +36,7 @@ class RedisPublishOperator(BaseOperator): :type redis_conn_id: str """ - template_fields = ('channel', 'message') + template_fields: Sequence[str] = ('channel', 'message') def __init__(self, *, channel: str, message: str, redis_conn_id: str = 'redis_default', **kwargs) -> None: diff --git a/airflow/providers/redis/sensors/redis_key.py b/airflow/providers/redis/sensors/redis_key.py index 8c9304a3fca16..064459ab0ffb3 100644 --- a/airflow/providers/redis/sensors/redis_key.py +++ b/airflow/providers/redis/sensors/redis_key.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Sequence from airflow.providers.redis.hooks.redis import RedisHook from airflow.sensors.base import BaseSensorOperator @@ -27,7 +27,7 @@ class RedisKeySensor(BaseSensorOperator): """Checks for the existence of a key in a Redis""" - template_fields = ('key',) + template_fields: Sequence[str] = ('key',) ui_color = '#f0eee4' def __init__(self, *, key: str, redis_conn_id: str, **kwargs) -> None: diff --git a/airflow/providers/redis/sensors/redis_pub_sub.py b/airflow/providers/redis/sensors/redis_pub_sub.py index 0f77a0c4b8183..f193737f27606 100644 --- a/airflow/providers/redis/sensors/redis_pub_sub.py +++ b/airflow/providers/redis/sensors/redis_pub_sub.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, List, Union +from typing import TYPE_CHECKING, List, Sequence, Union from airflow.providers.redis.hooks.redis import RedisHook from airflow.sensors.base import BaseSensorOperator @@ -35,7 +35,7 @@ class RedisPubSubSensor(BaseSensorOperator): :type redis_conn_id: str """ - template_fields = ('channels',) + template_fields: Sequence[str] = ('channels',) ui_color = '#f0eee4' def __init__(self, *, channels: Union[List[str], str], redis_conn_id: str, **kwargs) -> None: diff --git a/airflow/providers/segment/operators/segment_track_event.py b/airflow/providers/segment/operators/segment_track_event.py index b65a392291a25..8810ef4559e5e 100644 --- a/airflow/providers/segment/operators/segment_track_event.py +++ b/airflow/providers/segment/operators/segment_track_event.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.segment.hooks.segment import SegmentHook @@ -41,7 +41,7 @@ class SegmentTrackEventOperator(BaseOperator): :type segment_debug_mode: bool """ - template_fields = ('user_id', 'event', 'properties') + template_fields: Sequence[str] = ('user_id', 'event', 'properties') ui_color = '#ffd700' def __init__( diff --git a/airflow/providers/sftp/operators/sftp.py b/airflow/providers/sftp/operators/sftp.py index 3a1d023a9a414..076c0b8d7c227 100644 --- a/airflow/providers/sftp/operators/sftp.py +++ b/airflow/providers/sftp/operators/sftp.py @@ -18,7 +18,7 @@ """This module contains SFTP operator.""" import os from pathlib import Path -from typing import Any +from typing import Any, Sequence from airflow.exceptions import AirflowException from airflow.models import BaseOperator @@ -78,7 +78,7 @@ class SFTPOperator(BaseOperator): :type create_intermediate_dirs: bool """ - template_fields = ('local_filepath', 'remote_filepath', 'remote_host') + template_fields: Sequence[str] = ('local_filepath', 'remote_filepath', 'remote_host') def __init__( self, diff --git a/airflow/providers/sftp/sensors/sftp.py b/airflow/providers/sftp/sensors/sftp.py index e56f00f39c8ae..14d196aa41973 100644 --- a/airflow/providers/sftp/sensors/sftp.py +++ b/airflow/providers/sftp/sensors/sftp.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. """This module contains SFTP sensor.""" -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from paramiko.sftp import SFTP_NO_SUCH_FILE @@ -37,7 +37,7 @@ class SFTPSensor(BaseSensorOperator): :type sftp_conn_id: str """ - template_fields = ('path',) + template_fields: Sequence[str] = ('path',) def __init__(self, *, path: str, sftp_conn_id: str = 'sftp_default', **kwargs) -> None: super().__init__(**kwargs) diff --git a/airflow/providers/singularity/operators/singularity.py b/airflow/providers/singularity/operators/singularity.py index 015f3c81137a1..e5c834c8f271f 100644 --- a/airflow/providers/singularity/operators/singularity.py +++ b/airflow/providers/singularity/operators/singularity.py @@ -19,7 +19,7 @@ import ast import os import shutil -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Union from spython.main import Client @@ -64,7 +64,7 @@ class SingularityOperator(BaseOperator): :type working_dir: str """ - template_fields = ( + template_fields: Sequence[str] = ( 'command', 'environment', ) diff --git a/airflow/providers/slack/operators/slack.py b/airflow/providers/slack/operators/slack.py index 07438451fed3c..fa5c20c1fb3b8 100644 --- a/airflow/providers/slack/operators/slack.py +++ b/airflow/providers/slack/operators/slack.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. import json -from typing import Any, Dict, List, Optional +from typing import Any, Dict, List, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.slack.hooks.slack import SlackHook @@ -117,7 +117,7 @@ class SlackAPIPostOperator(SlackAPIOperator): :type blocks: list of hashes """ - template_fields = ('username', 'text', 'attachments', 'blocks', 'channel') + template_fields: Sequence[str] = ('username', 'text', 'attachments', 'blocks', 'channel') ui_color = '#FFBA40' def __init__( @@ -194,7 +194,7 @@ class SlackAPIFileOperator(SlackAPIOperator): :type content: str """ - template_fields = ('channel', 'initial_comment', 'filename', 'filetype', 'content') + template_fields: Sequence[str] = ('channel', 'initial_comment', 'filename', 'filetype', 'content') ui_color = '#44BEDF' def __init__( diff --git a/airflow/providers/slack/operators/slack_webhook.py b/airflow/providers/slack/operators/slack_webhook.py index fc2bd05a23686..94c25da0791ac 100644 --- a/airflow/providers/slack/operators/slack_webhook.py +++ b/airflow/providers/slack/operators/slack_webhook.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. # -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.providers.http.operators.http import SimpleHttpOperator from airflow.providers.slack.hooks.slack_webhook import SlackWebhookHook @@ -62,7 +62,7 @@ class SlackWebhookOperator(SimpleHttpOperator): :type proxy: str """ - template_fields = [ + template_fields: Sequence[str] = ( 'webhook_token', 'message', 'attachments', @@ -70,7 +70,7 @@ class SlackWebhookOperator(SimpleHttpOperator): 'channel', 'username', 'proxy', - ] + ) def __init__( self, diff --git a/airflow/providers/snowflake/operators/snowflake.py b/airflow/providers/snowflake/operators/snowflake.py index d3bb790faa5d2..fbfa4da6b611a 100644 --- a/airflow/providers/snowflake/operators/snowflake.py +++ b/airflow/providers/snowflake/operators/snowflake.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import Any, List, Optional, SupportsAbs +from typing import Any, List, Optional, Sequence, SupportsAbs from airflow.models import BaseOperator from airflow.operators.sql import SQLCheckOperator, SQLIntervalCheckOperator, SQLValueCheckOperator @@ -85,7 +85,7 @@ class SnowflakeOperator(BaseOperator): :type session_parameters: dict """ - template_fields = ('sql',) + template_fields: Sequence[str] = ('sql',) template_ext = ('.sql',) ui_color = '#ededed' @@ -198,7 +198,7 @@ class SnowflakeCheckOperator(SQLCheckOperator): :type session_parameters: dict """ - template_fields = ('sql',) + template_fields: Sequence[str] = ('sql',) template_ext = ('.sql',) ui_color = '#ededed' diff --git a/airflow/providers/snowflake/transfers/s3_to_snowflake.py b/airflow/providers/snowflake/transfers/s3_to_snowflake.py index 413b9e1dbf6ec..b33d6d4e73e6c 100644 --- a/airflow/providers/snowflake/transfers/s3_to_snowflake.py +++ b/airflow/providers/snowflake/transfers/s3_to_snowflake.py @@ -17,7 +17,7 @@ # under the License. """This module contains AWS S3 to Snowflake operator.""" -from typing import Any, Optional +from typing import Any, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.snowflake.hooks.snowflake import SnowflakeHook @@ -71,7 +71,7 @@ class S3ToSnowflakeOperator(BaseOperator): :type session_parameters: dict """ - template_fields = ("s3_keys",) + template_fields: Sequence[str] = ("s3_keys",) template_fields_renderers = {"s3_keys": "json"} def __init__( diff --git a/airflow/providers/snowflake/transfers/snowflake_to_slack.py b/airflow/providers/snowflake/transfers/snowflake_to_slack.py index 89d09eef5a759..bb4042c80d223 100644 --- a/airflow/providers/snowflake/transfers/snowflake_to_slack.py +++ b/airflow/providers/snowflake/transfers/snowflake_to_slack.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Iterable, Mapping, Optional, Union +from typing import TYPE_CHECKING, Iterable, Mapping, Optional, Sequence, Union from pandas import DataFrame from tabulate import tabulate @@ -70,7 +70,7 @@ class SnowflakeToSlackOperator(BaseOperator): :type slack_token: Optional[str] """ - template_fields = ['sql', 'slack_message'] + template_fields: Sequence[str] = ('sql', 'slack_message') template_ext = ['.sql', '.jinja', '.j2'] template_fields_renderers = {"slack_message": "jinja"} times_rendered = 0 diff --git a/airflow/providers/sqlite/operators/sqlite.py b/airflow/providers/sqlite/operators/sqlite.py index b1b11b0e07388..55a7f6ab1ecce 100644 --- a/airflow/providers/sqlite/operators/sqlite.py +++ b/airflow/providers/sqlite/operators/sqlite.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import Any, Iterable, List, Mapping, Optional, Union +from typing import Any, Iterable, List, Mapping, Optional, Sequence, Union from airflow.models import BaseOperator from airflow.providers.sqlite.hooks.sqlite import SqliteHook @@ -40,7 +40,7 @@ class SqliteOperator(BaseOperator): :type parameters: dict or iterable """ - template_fields = ('sql',) + template_fields: Sequence[str] = ('sql',) template_ext = ('.sql',) ui_color = '#cdaaed' diff --git a/airflow/providers/ssh/operators/ssh.py b/airflow/providers/ssh/operators/ssh.py index 8efa7672c19ee..2c9aaf6f82f54 100644 --- a/airflow/providers/ssh/operators/ssh.py +++ b/airflow/providers/ssh/operators/ssh.py @@ -19,7 +19,7 @@ import warnings from base64 import b64encode from select import select -from typing import Optional, Tuple, Union +from typing import Optional, Sequence, Tuple, Union from paramiko.client import SSHClient @@ -67,7 +67,7 @@ class SSHOperator(BaseOperator): :type get_pty: bool """ - template_fields = ('command', 'remote_host') + template_fields: Sequence[str] = ('command', 'remote_host') template_ext = ('.sh',) template_fields_renderers = {"command": "bash"} diff --git a/airflow/providers/tableau/sensors/tableau_job_status.py b/airflow/providers/tableau/sensors/tableau_job_status.py index d9576eba2bd90..145caa35fe32e 100644 --- a/airflow/providers/tableau/sensors/tableau_job_status.py +++ b/airflow/providers/tableau/sensors/tableau_job_status.py @@ -14,7 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.providers.tableau.hooks.tableau import ( TableauHook, @@ -42,7 +42,7 @@ class TableauJobStatusSensor(BaseSensorOperator): :type tableau_conn_id: str """ - template_fields = ('job_id',) + template_fields: Sequence[str] = ('job_id',) def __init__( self, diff --git a/airflow/providers/telegram/operators/telegram.py b/airflow/providers/telegram/operators/telegram.py index 3c276c2dea0e1..006ab4ad47a48 100644 --- a/airflow/providers/telegram/operators/telegram.py +++ b/airflow/providers/telegram/operators/telegram.py @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. """Operator for Telegram""" -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, Sequence from airflow.exceptions import AirflowException from airflow.models import BaseOperator @@ -48,7 +48,7 @@ class TelegramOperator(BaseOperator): :type telegram_kwargs: dict """ - template_fields = ('text', 'chat_id') + template_fields: Sequence[str] = ('text', 'chat_id') ui_color = '#FFBA40' def __init__( diff --git a/airflow/providers/vertica/operators/vertica.py b/airflow/providers/vertica/operators/vertica.py index 6719bdea7a1ad..7fa4c53494228 100644 --- a/airflow/providers/vertica/operators/vertica.py +++ b/airflow/providers/vertica/operators/vertica.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Any, List, Union +from typing import TYPE_CHECKING, Any, List, Sequence, Union from airflow.models import BaseOperator from airflow.providers.vertica.hooks.vertica import VerticaHook @@ -36,7 +36,7 @@ class VerticaOperator(BaseOperator): Template reference are recognized by str ending in '.sql' """ - template_fields = ('sql',) + template_fields: Sequence[str] = ('sql',) template_ext = ('.sql',) ui_color = '#b4e0ff' diff --git a/airflow/providers/yandex/operators/yandexcloud_dataproc.py b/airflow/providers/yandex/operators/yandexcloud_dataproc.py index ed753ef27147c..a4ec67c861cb2 100644 --- a/airflow/providers/yandex/operators/yandexcloud_dataproc.py +++ b/airflow/providers/yandex/operators/yandexcloud_dataproc.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -from typing import TYPE_CHECKING, Dict, Iterable, Optional, Union +from typing import TYPE_CHECKING, Dict, Iterable, Optional, Sequence, Union from airflow.models import BaseOperator from airflow.providers.yandex.hooks.yandexcloud_dataproc import DataprocHook @@ -218,7 +218,7 @@ class DataprocDeleteClusterOperator(BaseOperator): :type cluster_id: Optional[str] """ - template_fields = ['cluster_id'] + template_fields: Sequence[str] = ('cluster_id',) def __init__( self, *, connection_id: Optional[str] = None, cluster_id: Optional[str] = None, **kwargs @@ -261,7 +261,7 @@ class DataprocCreateHiveJobOperator(BaseOperator): :type connection_id: Optional[str] """ - template_fields = ['cluster_id'] + template_fields: Sequence[str] = ('cluster_id',) def __init__( self, @@ -333,7 +333,7 @@ class DataprocCreateMapReduceJobOperator(BaseOperator): :type connection_id: Optional[str] """ - template_fields = ['cluster_id'] + template_fields: Sequence[str] = ('cluster_id',) def __init__( self, @@ -418,7 +418,7 @@ class DataprocCreateSparkJobOperator(BaseOperator): :type exclude_packages: Optional[Iterable[str]] """ - template_fields = ['cluster_id'] + template_fields: Sequence[str] = ('cluster_id',) def __init__( self, @@ -512,7 +512,7 @@ class DataprocCreatePysparkJobOperator(BaseOperator): :type exclude_packages: Optional[Iterable[str]] """ - template_fields = ['cluster_id'] + template_fields: Sequence[str] = ('cluster_id',) def __init__( self, diff --git a/tests/providers/slack/operators/test_slack_webhook.py b/tests/providers/slack/operators/test_slack_webhook.py index 7b261f4ef4556..f9cc83509da1c 100644 --- a/tests/providers/slack/operators/test_slack_webhook.py +++ b/tests/providers/slack/operators/test_slack_webhook.py @@ -64,7 +64,7 @@ def test_execute(self): def test_assert_templated_fields(self): operator = SlackWebhookOperator(task_id='slack_webhook_job', dag=self.dag, **self._config) - template_fields = [ + template_fields = ( 'webhook_token', 'message', 'attachments', @@ -72,6 +72,6 @@ def test_assert_templated_fields(self): 'channel', 'username', 'proxy', - ] + ) assert operator.template_fields == template_fields