Skip to content

Commit

Permalink
Changes to all the constructors to remove the args argument (#10163)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonY1 authored Aug 6, 2020
1 parent 73ad5a4 commit 24c8e4c
Show file tree
Hide file tree
Showing 70 changed files with 117 additions and 165 deletions.
4 changes: 2 additions & 2 deletions airflow/operators/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def __init__(
bcc: Optional[Union[List[str], str]] = None,
mime_subtype: str = 'mixed',
mime_charset: str = 'utf-8',
*args, **kwargs) -> None:
super().__init__(*args, **kwargs)
**kwargs) -> None:
super().__init__(**kwargs)
self.to = to # pylint: disable=invalid-name
self.subject = subject
self.html_content = html_content
Expand Down
4 changes: 0 additions & 4 deletions airflow/operators/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ def __init__(
pass_value: Any,
tolerance: Any = None,
conn_id: Optional[str] = None,
*args,
**kwargs,
):
super().__init__(**kwargs)
Expand Down Expand Up @@ -280,7 +279,6 @@ def __init__(
ratio_formula: Optional[str] = "max_over_min",
ignore_zero: Optional[bool] = True,
conn_id: Optional[str] = None,
*args,
**kwargs,
):
super().__init__(**kwargs)
Expand Down Expand Up @@ -422,7 +420,6 @@ def __init__(
min_threshold: Any,
max_threshold: Any,
conn_id: Optional[str] = None,
*args,
**kwargs,
):
super().__init__(**kwargs)
Expand Down Expand Up @@ -517,7 +514,6 @@ def __init__(
conn_id: str = "default_conn_id",
database: Optional[str] = None,
parameters: Optional[Union[Mapping, Iterable]] = None,
*args,
**kwargs,
) -> None:
super().__init__(**kwargs)
Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/amazon/aws/sensors/glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, *,
run_id,
aws_conn_id='aws_default',
**kwargs):
super(AwsGlueJobSensor, self).__init__(**kwargs)
super().__init__(**kwargs)
self.job_name = job_name
self.run_id = run_id
self.aws_conn_id = aws_conn_id
Expand Down
1 change: 0 additions & 1 deletion airflow/providers/amazon/aws/transfers/google_api_to_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def __init__(
google_api_endpoint_path,
google_api_endpoint_params,
s3_destination_key,

google_api_response_via_xcom=None,
google_api_endpoint_params_via_xcom=None,
google_api_endpoint_params_via_xcom_task_ids=None,
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/celery/sensors/celery_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ def __init__(
self,
celery_queue: str,
target_task_id: Optional[str] = None,
*args,
**kwargs) -> None:

super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.celery_queue = celery_queue
self.target_task_id = target_task_id

Expand Down
4 changes: 2 additions & 2 deletions airflow/providers/cncf/kubernetes/sensors/spark_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def __init__(self,
application_name: str,
namespace: Optional[str] = None,
kubernetes_conn_id: str = 'kubernetes_default',
*args, **kwargs):
super().__init__(*args, **kwargs)
**kwargs):
super().__init__(**kwargs)
self.application_name = application_name
self.namespace = namespace
self.kubernetes_conn_id = kubernetes_conn_id
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/datadog/sensors/datadog.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ def __init__(
sources: Optional[str] = None,
tags: Optional[List[str]] = None,
response_check: Optional[Callable[[Dict[str, Any]], bool]] = None,
*args,
**kwargs) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.datadog_conn_id = datadog_conn_id
self.from_seconds_ago = from_seconds_ago
self.up_to_seconds_from_now = up_to_seconds_from_now
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/ftp/sensors/ftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ def __init__(
path: str,
ftp_conn_id: str = 'ftp_default',
fail_on_transient_errors: bool = True,
*args,
**kwargs) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)

self.path = path
self.ftp_conn_id = ftp_conn_id
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/google/ads/transfers/ads_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@ def __init__(
google_ads_conn_id: str = "google_ads_default",
page_size: int = 10000,
gzip: bool = False,
*args,
**kwargs,
) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.client_ids = client_ids
self.query = query
self.attributes = attributes
Expand Down
4 changes: 2 additions & 2 deletions airflow/providers/google/cloud/sensors/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def __init__(self,
table_id: str,
bigquery_conn_id: str = 'google_cloud_default',
delegate_to: Optional[str] = None,
*args, **kwargs) -> None:
**kwargs) -> None:

super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.project_id = project_id
self.dataset_id = dataset_id
self.table_id = table_id
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/google/cloud/sensors/bigquery_dts.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@ def __init__(
retry: Optional[Retry] = None,
request_timeout: Optional[float] = None,
metadata: Optional[Sequence[Tuple[str, str]]] = None,
*args,
**kwargs
):
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.run_id = run_id
self.transfer_config_id = transfer_config_id
self.retry = retry
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/google/cloud/sensors/bigtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,14 @@ def __init__(
table_id: str,
project_id: Optional[str] = None,
gcp_conn_id: str = 'google_cloud_default',
*args,
**kwargs
) -> None:
self.project_id = project_id
self.instance_id = instance_id
self.table_id = table_id
self.gcp_conn_id = gcp_conn_id
self._validate_inputs()
super().__init__(*args, **kwargs)
super().__init__(**kwargs)

def poke(self, context):
hook = BigtableHook(gcp_conn_id=self.gcp_conn_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ def __init__(
expected_statuses: Union[Set[str], str],
project_id: Optional[str] = None,
gcp_conn_id: str = 'google_cloud_default',
*args,
**kwargs
) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.job_name = job_name
self.expected_statuses = (
{expected_statuses} if isinstance(expected_statuses, str) else expected_statuses
Expand Down
16 changes: 8 additions & 8 deletions airflow/providers/google/cloud/sensors/gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def __init__(self,
object: str, # pylint: disable=redefined-builtin
google_cloud_conn_id: str = 'google_cloud_default',
delegate_to: Optional[str] = None,
*args, **kwargs) -> None:
**kwargs) -> None:

super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.bucket = bucket
self.object = object
self.google_cloud_conn_id = google_cloud_conn_id
Expand Down Expand Up @@ -111,9 +111,9 @@ def __init__(self,
ts_func: Callable = ts_function,
google_cloud_conn_id: str = 'google_cloud_default',
delegate_to: Optional[str] = None,
*args, **kwargs) -> None:
**kwargs) -> None:

super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.bucket = bucket
self.object = object
self.ts_func = ts_func
Expand Down Expand Up @@ -158,8 +158,8 @@ def __init__(self,
prefix: str,
google_cloud_conn_id: str = 'google_cloud_default',
delegate_to: Optional[str] = None,
*args, **kwargs) -> None:
super().__init__(*args, **kwargs)
**kwargs) -> None:
super().__init__(**kwargs)
self.bucket = bucket
self.prefix = prefix
self.google_cloud_conn_id = google_cloud_conn_id
Expand Down Expand Up @@ -239,9 +239,9 @@ def __init__(self,
allow_delete: bool = True,
google_cloud_conn_id: str = 'google_cloud_default',
delegate_to: Optional[str] = None,
*args, **kwargs) -> None:
**kwargs) -> None:

super().__init__(*args, **kwargs)
super().__init__(**kwargs)

self.bucket = bucket
self.prefix = prefix
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/google/cloud/sensors/pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def __init__(
messages_callback: Optional[Callable[[List[ReceivedMessage], Dict[str, Any]], Any]] = None,
delegate_to: Optional[str] = None,
project: Optional[str] = None,
*args,
**kwargs
) -> None:
# To preserve backward compatibility
Expand All @@ -126,7 +125,7 @@ def __init__(
stacklevel=2
)

super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.gcp_conn_id = gcp_conn_id
self.delegate_to = delegate_to
self.project_id = project_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@ def __init__(self, # pylint: disable=too-many-arguments
labels: Optional[Dict] = None,
encryption_configuration: Optional[Dict] = None,
location: Optional[str] = None,
*args,
**kwargs) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)

if bigquery_conn_id:
warnings.warn(
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/google/cloud/transfers/bigquery_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ def __init__(self, # pylint: disable=too-many-arguments
delegate_to: Optional[str] = None,
labels: Optional[Dict] = None,
location: Optional[str] = None,
*args,
**kwargs) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)

if bigquery_conn_id:
warnings.warn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ def __init__(self, # pylint: disable=too-many-arguments
replace: bool = False,
batch_size: int = 1000,
location: Optional[str] = None,
*args,
**kwargs) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.selected_fields = selected_fields
self.gcp_conn_id = gcp_conn_id
self.mysql_conn_id = mysql_conn_id
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/google/cloud/transfers/cassandra_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ def __init__(self, # pylint: disable=too-many-arguments
gcp_conn_id: str = 'google_cloud_default',
google_cloud_storage_conn_id: Optional[str] = None,
delegate_to: Optional[str] = None,
*args,
**kwargs) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)

if google_cloud_storage_conn_id:
warnings.warn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ def __init__(
api_version: str = "v6.0",
gcp_conn_id: str = "google_cloud_default",
facebook_conn_id: str = "facebook_default",
*args,
**kwargs,
) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.bucket_name = bucket_name
self.object_name = object_name
self.gcp_conn_id = gcp_conn_id
Expand Down
4 changes: 2 additions & 2 deletions airflow/providers/google/cloud/transfers/gcs_to_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ def __init__(self,
autodetect=True,
encryption_configuration=None,
location=None,
*args, **kwargs):
**kwargs):

super().__init__(*args, **kwargs)
super().__init__(**kwargs)

# GCS config
if src_fmt_configs is None:
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/google/cloud/transfers/gcs_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,8 @@ def __init__(self, # pylint: disable=too-many-arguments
last_modified_time=None,
maximum_modified_time=None,
is_older_than=None,
*args,
**kwargs):
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
if google_cloud_storage_conn_id:
warnings.warn(
"The google_cloud_storage_conn_id parameter has been deprecated. You should pass "
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/google/cloud/transfers/gcs_to_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def __init__(self,
gcp_conn_id: str = 'google_cloud_default',
google_cloud_storage_conn_id: Optional[str] = None,
delegate_to: Optional[str] = None,
*args,
**kwargs) -> None:
# To preserve backward compatibility
# TODO: Remove one day
Expand All @@ -95,7 +94,7 @@ def __init__(self,
"the gcp_conn_id parameter.", DeprecationWarning, stacklevel=3)
gcp_conn_id = google_cloud_storage_conn_id

super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.bucket = bucket
self.object = object_name
self.filename = filename # noqa
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/google/cloud/transfers/gcs_to_sftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ def __init__(
gcp_conn_id: str = "google_cloud_default",
sftp_conn_id: str = "ssh_default",
delegate_to: Optional[str] = None,
*args,
**kwargs
) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)

self.source_bucket = source_bucket
self.source_object = source_object
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/google/cloud/transfers/local_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ def __init__(self,
mime_type='application/octet-stream',
delegate_to=None,
gzip=False,
*args,
**kwargs):
super().__init__(*args, **kwargs)
super().__init__(**kwargs)

if google_cloud_storage_conn_id:
warnings.warn(
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/google/cloud/transfers/mssql_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ class MSSQLToGCSOperator(BaseSQLToGCSOperator):
@apply_defaults
def __init__(self,
mssql_conn_id='mssql_default',
*args,
**kwargs):
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.mssql_conn_id = mssql_conn_id

def query(self):
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/google/cloud/transfers/mysql_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ class MySQLToGCSOperator(BaseSQLToGCSOperator):
def __init__(self,
mysql_conn_id='mysql_default',
ensure_utc=False,
*args,
**kwargs):
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.mysql_conn_id = mysql_conn_id
self.ensure_utc = ensure_utc

Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/google/cloud/transfers/postgres_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ class PostgresToGCSOperator(BaseSQLToGCSOperator):
@apply_defaults
def __init__(self,
postgres_conn_id='postgres_default',
*args,
**kwargs):
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.postgres_conn_id = postgres_conn_id

def query(self):
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/google/cloud/transfers/presto_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,9 @@ class PrestoToGCSOperator(BaseSQLToGCSOperator):
def __init__(
self,
presto_conn_id: str = "presto_default",
*args,
**kwargs
):
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.presto_conn_id = presto_conn_id

def query(self):
Expand Down
Loading

0 comments on commit 24c8e4c

Please sign in to comment.