Changes to all the constructors to remove the args argument (#10163)

This commit is contained in:
Leon Yuan 2020-08-06 07:42:51 -05:00 коммит произвёл GitHub
Родитель 73ad5a4ba8
Коммит 24c8e4c2d6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
70 изменённых файлов: 117 добавлений и 165 удалений

Просмотреть файл

@ -61,8 +61,8 @@ class EmailOperator(BaseOperator):
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

Просмотреть файл

@ -157,7 +157,6 @@ class SQLValueCheckOperator(BaseOperator):
pass_value: Any,
tolerance: Any = None,
conn_id: Optional[str] = None,
*args,
**kwargs,
):
super().__init__(**kwargs)
@ -280,7 +279,6 @@ class SQLIntervalCheckOperator(BaseOperator):
ratio_formula: Optional[str] = "max_over_min",
ignore_zero: Optional[bool] = True,
conn_id: Optional[str] = None,
*args,
**kwargs,
):
super().__init__(**kwargs)
@ -422,7 +420,6 @@ class SQLThresholdCheckOperator(BaseOperator):
min_threshold: Any,
max_threshold: Any,
conn_id: Optional[str] = None,
*args,
**kwargs,
):
super().__init__(**kwargs)
@ -517,7 +514,6 @@ class BranchSQLOperator(BaseOperator, SkipMixin):
conn_id: str = "default_conn_id",
database: Optional[str] = None,
parameters: Optional[Union[Mapping, Iterable]] = None,
*args,
**kwargs,
) -> None:
super().__init__(**kwargs)

Просмотреть файл

@ -40,7 +40,7 @@ class AwsGlueJobSensor(BaseSensorOperator):
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

Просмотреть файл

@ -91,7 +91,6 @@ class GoogleApiToS3Operator(BaseOperator):
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,

Просмотреть файл

@ -40,10 +40,9 @@ class CeleryQueueSensor(BaseSensorOperator):
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

Просмотреть файл

@ -48,8 +48,8 @@ class SparkKubernetesSensor(BaseSensorOperator):
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

Просмотреть файл

@ -48,9 +48,8 @@ class DatadogSensor(BaseSensorOperator):
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

Просмотреть файл

@ -49,9 +49,8 @@ class FTPSensor(BaseSensorOperator):
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

Просмотреть файл

@ -74,10 +74,9 @@ class GoogleAdsToGcsOperator(BaseOperator):
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

Просмотреть файл

@ -56,9 +56,9 @@ class BigQueryTableExistenceSensor(BaseSensorOperator):
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

Просмотреть файл

@ -77,10 +77,9 @@ class BigQueryDataTransferServiceTransferRunSensor(BaseSensorOperator):
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

Просмотреть файл

@ -59,7 +59,6 @@ class BigtableTableReplicationCompletedSensor(BaseSensorOperator, BigtableValida
table_id: str,
project_id: Optional[str] = None,
gcp_conn_id: str = 'google_cloud_default',
*args,
**kwargs
) -> None:
self.project_id = project_id
@ -67,7 +66,7 @@ class BigtableTableReplicationCompletedSensor(BaseSensorOperator, BigtableValida
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)

Просмотреть файл

@ -60,10 +60,9 @@ class CloudDataTransferServiceJobStatusSensor(BaseSensorOperator):
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

Просмотреть файл

@ -55,9 +55,9 @@ class GCSObjectExistenceSensor(BaseSensorOperator):
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
@ -111,9 +111,9 @@ class GCSObjectUpdateSensor(BaseSensorOperator):
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
@ -158,8 +158,8 @@ class GCSObjectsWtihPrefixExistenceSensor(BaseSensorOperator):
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
@ -239,9 +239,9 @@ class GCSUploadSessionCompleteSensor(BaseSensorOperator):
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

Просмотреть файл

@ -103,7 +103,6 @@ class PubSubPullSensor(BaseSensorOperator):
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
@ -126,7 +125,7 @@ class PubSubPullSensor(BaseSensorOperator):
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

Просмотреть файл

@ -86,9 +86,8 @@ class BigQueryToBigQueryOperator(BaseOperator):
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(

Просмотреть файл

@ -85,9 +85,8 @@ class BigQueryToGCSOperator(BaseOperator):
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(

Просмотреть файл

@ -89,9 +89,8 @@ class BigQueryToMySqlOperator(BaseOperator):
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

Просмотреть файл

@ -93,9 +93,8 @@ class CassandraToGCSOperator(BaseOperator):
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(

Просмотреть файл

@ -81,10 +81,9 @@ class FacebookAdsReportToGcsOperator(BaseOperator):
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

Просмотреть файл

@ -187,9 +187,9 @@ class GCSToBigQueryOperator(BaseOperator):
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:

Просмотреть файл

@ -185,9 +185,8 @@ class GCSToGCSOperator(BaseOperator):
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 "

Просмотреть файл

@ -75,7 +75,6 @@ class GCSToLocalFilesystemOperator(BaseOperator):
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
@ -95,7 +94,7 @@ class GCSToLocalFilesystemOperator(BaseOperator):
"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

Просмотреть файл

@ -81,10 +81,9 @@ class GCSToSFTPOperator(BaseOperator):
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

Просмотреть файл

@ -69,9 +69,8 @@ class LocalFilesystemToGCSOperator(BaseOperator):
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(

Просмотреть файл

@ -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):

Просмотреть файл

@ -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

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -105,7 +105,6 @@ class S3ToGCSOperator(S3ListOperator):
delegate_to=None,
replace=False,
gzip=False,
*args,
**kwargs):
super().__init__(
@ -113,7 +112,6 @@ class S3ToGCSOperator(S3ListOperator):
prefix=prefix,
delimiter=delimiter,
aws_conn_id=aws_conn_id,
*args,
**kwargs)
if dest_gcs_conn_id:

Просмотреть файл

@ -84,10 +84,9 @@ class SFTPToGCSOperator(BaseOperator):
mime_type: str = "application/octet-stream",
gzip: bool = False,
move_object: bool = False,
*args,
**kwargs
) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.source_path = source_path
self.destination_path = self._set_destination_path(destination_path)

Просмотреть файл

@ -93,9 +93,8 @@ class BaseSQLToGCSOperator(BaseOperator):
gcp_conn_id='google_cloud_default',
google_cloud_storage_conn_id=None,
delegate_to=None,
*args,
**kwargs):
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
if google_cloud_storage_conn_id:
warnings.warn(

Просмотреть файл

@ -77,10 +77,9 @@ class GoogleCampaignManagerReportSensor(BaseSensorOperator):
delegate_to: Optional[str] = None,
mode: str = "reschedule",
poke_interval: int = 60 * 5,
*args,
**kwargs
):
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.mode = mode
self.poke_interval = poke_interval
self.profile_id = profile_id

Просмотреть файл

@ -78,9 +78,8 @@ class HttpSensor(BaseSensorOperator):
headers: Optional[Dict[str, Any]] = None,
response_check: Optional[Callable[..., Any]] = None,
extra_options: Optional[Dict[str, Any]] = None,
*args: Any, **kwargs: Any
) -> None:
super().__init__(*args, **kwargs)
**kwargs: Any) -> None:
super().__init__(**kwargs)
self.endpoint = endpoint
self.http_conn_id = http_conn_id
self.request_params = request_params or {}

Просмотреть файл

@ -50,9 +50,8 @@ class ImapAttachmentSensor(BaseSensorOperator):
mail_folder='INBOX',
mail_filter='All',
conn_id='imap_default',
*args,
**kwargs):
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.attachment_name = attachment_name
self.check_regex = check_regex

Просмотреть файл

@ -44,9 +44,8 @@ class JiraSensor(BaseSensorOperator):
jira_conn_id: str = 'jira_default',
method_params: Optional[dict] = None,
result_processor: Optional[Callable] = None,
*args,
**kwargs) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.jira_conn_id = jira_conn_id
self.result_processor = None
if result_processor is not None:

Просмотреть файл

@ -51,9 +51,8 @@ class AzureCosmosDocumentSensor(BaseSensorOperator):
collection_name: str,
document_id: str,
azure_cosmos_conn_id: str = "azure_cosmos_default",
*args,
**kwargs) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.azure_cosmos_conn_id = azure_cosmos_conn_id
self.database_name = database_name
self.collection_name = collection_name

Просмотреть файл

@ -46,9 +46,8 @@ class WasbBlobSensor(BaseSensorOperator):
blob_name: str,
wasb_conn_id: str = 'wasb_default',
check_options: Optional[dict] = None,
*args,
**kwargs):
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
if check_options is None:
check_options = {}
self.wasb_conn_id = wasb_conn_id
@ -88,9 +87,8 @@ class WasbPrefixSensor(BaseSensorOperator):
prefix: str,
wasb_conn_id: str = 'wasb_default',
check_options: Optional[dict] = None,
*args,
**kwargs) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
if check_options is None:
check_options = {}
self.wasb_conn_id = wasb_conn_id

Просмотреть файл

@ -48,9 +48,8 @@ class FileToWasbOperator(BaseOperator):
blob_name: str,
wasb_conn_id: str = 'wasb_default',
load_options: Optional[dict] = None,
*args,
**kwargs) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
if load_options is None:
load_options = {}
self.file_path = file_path

Просмотреть файл

@ -73,9 +73,8 @@ class OracleToAzureDataLakeOperator(BaseOperator):
encoding: str = "utf-8",
quotechar: str = '"',
quoting: str = csv.QUOTE_MINIMAL,
*args,
**kwargs) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
if sql_params is None:
sql_params = {}
self.filename = filename

Просмотреть файл

@ -45,9 +45,8 @@ class MongoSensor(BaseSensorOperator):
collection: str,
query: dict,
mongo_conn_id: str = "mongo_default",
*args,
**kwargs) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.mongo_conn_id = mongo_conn_id
self.collection = collection
self.query = query

Просмотреть файл

@ -56,8 +56,8 @@ class PrestoToMySqlOperator(BaseOperator):
presto_conn_id: str = 'presto_default',
mysql_conn_id: str = 'mysql_default',
mysql_preoperator: Optional[str] = None,
*args, **kwargs) -> None:
super().__init__(*args, **kwargs)
**kwargs) -> None:
super().__init__(**kwargs)
self.sql = sql
self.mysql_table = mysql_table
self.mysql_conn_id = mysql_conn_id

Просмотреть файл

@ -58,8 +58,8 @@ class S3ToMySqlOperator(BaseOperator):
mysql_extra_options: Optional[str] = None,
aws_conn_id: str = 'aws_default',
mysql_conn_id: str = 'mysql_default',
*args, **kwargs) -> None:
super().__init__(*args, **kwargs)
**kwargs) -> None:
super().__init__(**kwargs)
self.s3_source_key = s3_source_key
self.mysql_table = mysql_table
self.mysql_duplicate_key_handling = mysql_duplicate_key_handling

Просмотреть файл

@ -72,8 +72,8 @@ class VerticaToMySqlOperator(BaseOperator):
mysql_preoperator=None,
mysql_postoperator=None,
bulk_load=False,
*args, **kwargs):
super().__init__(*args, **kwargs)
**kwargs):
super().__init__(**kwargs)
self.sql = sql
self.mysql_table = mysql_table
self.mysql_conn_id = mysql_conn_id

Просмотреть файл

@ -53,8 +53,8 @@ class OracleToOracleOperator(BaseOperator):
source_sql,
source_sql_params=None,
rows_chunk=5000,
*args, **kwargs):
super().__init__(*args, **kwargs)
**kwargs):
super().__init__(**kwargs)
if source_sql_params is None:
source_sql_params = {}
self.oracle_destination_conn_id = oracle_destination_conn_id

Просмотреть файл

@ -184,8 +184,7 @@ class QuboleOperator(BaseOperator):
)
@apply_defaults
def __init__(self, qubole_conn_id="qubole_default", *args, **kwargs):
self.args = args
def __init__(self, qubole_conn_id="qubole_default", **kwargs):
self.kwargs = kwargs
self.kwargs['qubole_conn_id'] = qubole_conn_id
self.hook = None
@ -226,7 +225,7 @@ class QuboleOperator(BaseOperator):
def get_hook(self):
"""Reinitialising the hook, as some template fields might have changed"""
return QuboleHook(*self.args, **self.kwargs)
return QuboleHook(**self.kwargs)
def __getattribute__(self, name):
if name in QuboleOperator.template_fields:

Просмотреть файл

@ -101,7 +101,7 @@ class QuboleCheckOperator(CheckOperator, QuboleOperator):
if hasattr(self, 'hook') and (self.hook is not None):
return self.hook
else:
return QuboleCheckHook(context=context, *self.args, **self.kwargs)
return QuboleCheckHook(context=context, **self.kwargs)
def __getattribute__(self, name):
if name in QuboleCheckOperator.template_fields:
@ -162,7 +162,7 @@ class QuboleValueCheckOperator(ValueCheckOperator, QuboleOperator):
ui_fgcolor = '#000'
@apply_defaults
def __init__(self, pass_value, tolerance=None, results_parser_callable=None,
def __init__(self, *, pass_value, tolerance=None, results_parser_callable=None,
qubole_conn_id="qubole_default", **kwargs):
sql = get_sql_from_qbol_cmd(kwargs)
@ -191,7 +191,6 @@ class QuboleValueCheckOperator(ValueCheckOperator, QuboleOperator):
else:
return QuboleCheckHook(
context=context,
*self.args,
results_parser_callable=self.results_parser_callable,
**self.kwargs
)

Просмотреть файл

@ -35,7 +35,7 @@ class QuboleSensor(BaseSensorOperator):
template_ext = ('.txt',)
@apply_defaults
def __init__(self, data, qubole_conn_id="qubole_default", *args, **kwargs):
def __init__(self, data, qubole_conn_id="qubole_default", **kwargs):
self.data = data
self.qubole_conn_id = qubole_conn_id
@ -44,7 +44,7 @@ class QuboleSensor(BaseSensorOperator):
"task '{0}' in dag '{1}'."
.format(kwargs['task_id'], kwargs['dag'].dag_id))
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
def poke(self, context):
@ -83,9 +83,9 @@ class QuboleFileSensor(QuboleSensor):
"""
@apply_defaults
def __init__(self, *args, **kwargs):
def __init__(self, **kwargs):
self.sensor_class = FileSensor
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
class QubolePartitionSensor(QuboleSensor):
@ -106,6 +106,6 @@ class QubolePartitionSensor(QuboleSensor):
"""
@apply_defaults
def __init__(self, *args, **kwargs):
def __init__(self, **kwargs):
self.sensor_class = PartitionSensor
super().__init__(*args, **kwargs)
super().__init__(**kwargs)

Просмотреть файл

@ -30,8 +30,8 @@ class RedisKeySensor(BaseSensorOperator):
ui_color = '#f0eee4'
@apply_defaults
def __init__(self, key: str, redis_conn_id: str, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
def __init__(self, key: str, redis_conn_id: str, **kwargs) -> None:
super().__init__(**kwargs)
self.redis_conn_id = redis_conn_id
self.key = key

Просмотреть файл

@ -36,8 +36,8 @@ class RedisPubSubSensor(BaseSensorOperator):
ui_color = '#f0eee4'
@apply_defaults
def __init__(self, channels: Union[List[str], str], redis_conn_id: str, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
def __init__(self, channels: Union[List[str], str], redis_conn_id: str, **kwargs) -> None:
super().__init__(**kwargs)
self.channels = channels
self.redis_conn_id = redis_conn_id
self.pubsub = RedisHook(redis_conn_id=self.redis_conn_id).get_conn().pubsub()

Просмотреть файл

@ -50,9 +50,8 @@ class TableauJobStatusSensor(BaseSensorOperator):
job_id: str,
site_id: Optional[str] = None,
tableau_conn_id: str = 'tableau_default',
*args,
**kwargs):
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.tableau_conn_id = tableau_conn_id
self.job_id = job_id
self.site_id = site_id

Просмотреть файл

@ -37,8 +37,8 @@ class SFTPSensor(BaseSensorOperator):
template_fields = ('path',)
@apply_defaults
def __init__(self, path, sftp_conn_id='sftp_default', *args, **kwargs):
super().__init__(*args, **kwargs)
def __init__(self, path, sftp_conn_id='sftp_default', **kwargs):
super().__init__(**kwargs)
self.path = path
self.hook = None
self.sftp_conn_id = sftp_conn_id

Просмотреть файл

@ -55,8 +55,8 @@ class S3ToSnowflakeOperator(BaseOperator):
columns_array=None,
autocommit=True,
snowflake_conn_id='snowflake_default',
*args, **kwargs):
super().__init__(*args, **kwargs)
**kwargs):
super().__init__(**kwargs)
self.s3_keys = s3_keys
self.table = table
self.stage = stage

Просмотреть файл

@ -80,9 +80,9 @@ class SnowflakeToSlackOperator(BaseOperator):
schema: Optional[str] = None,
role: Optional[str] = None,
slack_token: Optional[str] = None,
*args, **kwargs
**kwargs
) -> None:
super(SnowflakeToSlackOperator, self).__init__(*args, **kwargs)
super(SnowflakeToSlackOperator, self).__init__(**kwargs)
self.snowflake_conn_id = snowflake_conn_id
self.sql = sql

Просмотреть файл

@ -74,9 +74,8 @@ class BaseSensorOperator(BaseOperator, SkipMixin):
soft_fail: bool = False,
mode: str = 'poke',
exponential_backoff: bool = False,
*args,
**kwargs) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.poke_interval = poke_interval
self.soft_fail = soft_fail
self.timeout = timeout

Просмотреть файл

@ -49,8 +49,8 @@ class BashSensor(BaseSensorOperator):
bash_command,
env=None,
output_encoding='utf-8',
*args, **kwargs):
super().__init__(*args, **kwargs)
**kwargs):
super().__init__(**kwargs)
self.bash_command = bash_command
self.env = env
self.output_encoding = output_encoding

Просмотреть файл

@ -58,9 +58,9 @@ class DateTimeSensor(BaseSensorOperator):
@apply_defaults
def __init__(
self, target_time: Union[str, datetime.datetime], *args, **kwargs
self, target_time: Union[str, datetime.datetime], **kwargs
) -> None:
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
if isinstance(target_time, datetime.datetime):
self.target_time = target_time.isoformat()
elif isinstance(target_time, str):

Просмотреть файл

@ -74,9 +74,8 @@ class ExternalTaskSensor(BaseSensorOperator):
execution_delta=None,
execution_date_fn=None,
check_existence=False,
*args,
**kwargs):
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.allowed_states = allowed_states or [State.SUCCESS]
self.failed_states = failed_states or []
@ -248,9 +247,8 @@ class ExternalTaskMarker(DummyOperator):
external_task_id,
execution_date: Optional[Union[str, datetime.datetime]] = "{{ execution_date.isoformat() }}",
recursion_depth: int = 10,
*args,
**kwargs):
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.external_dag_id = external_dag_id
self.external_task_id = external_task_id
if isinstance(execution_date, datetime.datetime):

Просмотреть файл

@ -46,9 +46,8 @@ class FileSensor(BaseSensorOperator):
def __init__(self,
filepath,
fs_conn_id='fs_default',
*args,
**kwargs):
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
self.filepath = filepath
self.fs_conn_id = fs_conn_id

Просмотреть файл

@ -55,8 +55,8 @@ class PythonSensor(BaseSensorOperator):
op_args: Optional[List] = None,
op_kwargs: Optional[Dict] = None,
templates_dict: Optional[Dict] = None,
*args, **kwargs):
super().__init__(*args, **kwargs)
**kwargs):
super().__init__(**kwargs)
self.python_callable = python_callable
self.op_args = op_args or []
self.op_kwargs = op_kwargs or {}

Просмотреть файл

@ -57,14 +57,14 @@ class SqlSensor(BaseSensorOperator):
@apply_defaults
def __init__(self, conn_id, sql, parameters=None, success=None, failure=None, fail_on_empty=False,
*args, **kwargs):
**kwargs):
self.conn_id = conn_id
self.sql = sql
self.parameters = parameters
self.success = success
self.failure = failure
self.fail_on_empty = fail_on_empty
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
def _get_hook(self):
conn = BaseHook.get_connection(self.conn_id)

Просмотреть файл

@ -33,8 +33,8 @@ class TimeDeltaSensor(BaseSensorOperator):
"""
@apply_defaults
def __init__(self, delta, *args, **kwargs):
super().__init__(*args, **kwargs)
def __init__(self, delta, **kwargs):
super().__init__(**kwargs)
self.delta = delta
def poke(self, context):

Просмотреть файл

@ -30,8 +30,8 @@ class TimeSensor(BaseSensorOperator):
"""
@apply_defaults
def __init__(self, target_time, *args, **kwargs):
super().__init__(*args, **kwargs)
def __init__(self, target_time, **kwargs):
super().__init__(**kwargs)
self.target_time = target_time
def poke(self, context):

Просмотреть файл

@ -75,8 +75,8 @@ class DayOfWeekSensor(BaseSensorOperator):
@apply_defaults
def __init__(self, week_day,
use_task_execution_day=False,
*args, **kwargs):
super().__init__(*args, **kwargs)
**kwargs):
super().__init__(**kwargs)
self.week_day = week_day
self.use_task_execution_day = use_task_execution_day
if isinstance(self.week_day, str):

Просмотреть файл

@ -47,8 +47,8 @@ Let's implement an example ``HelloOperator`` in a new file ``hello_operator.py``
def __init__(
self,
name: str,
*args, **kwargs) -> None:
super().__init__(*args, **kwargs)
**kwargs) -> None:
super().__init__(**kwargs)
self.name = name
def execute(self, context):
@ -104,8 +104,8 @@ Let's extend our previous example to fetch name from MySQL:
name: str,
mysql_conn_id: str,
database: str,
*args, **kwargs) -> None:
super().__init__(*args, **kwargs)
**kwargs) -> None:
super().__init__(**kwargs)
self.name = name
self.mysql_conn_id = mysql_conn_id
self.database = database
@ -157,8 +157,8 @@ the operator.
def __init__(
self,
name: str,
*args, **kwargs) -> None:
super().__init__(*args, **kwargs)
**kwargs) -> None:
super().__init__(**kwargs)
self.name = name
def execute(self, context):
@ -193,8 +193,8 @@ with actual value. Note that Jinja substitutes the operator attributes and not t
def __init__(
self,
name: str,
*args, **kwargs) -> None:
super().__init__(*args, **kwargs)
**kwargs) -> None:
super().__init__(**kwargs)
self.guest_name = name
In the example, the ``template_fields`` should be ``['guest_name']`` and not ``['name']``

Просмотреть файл

@ -48,8 +48,8 @@ The following code shows how to add extra links to an operator:
)
@apply_defaults
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __init__(self, **kwargs):
super().__init__(**kwargs)
def execute(self, context):
self.log.info("Hello World!")

Просмотреть файл

@ -363,8 +363,8 @@ class CustomOp(DummyOperator):
template_fields = ("field", "field2")
@apply_defaults
def __init__(self, field=None, field2=None, *args, **kwargs):
super().__init__(*args, **kwargs)
def __init__(self, field=None, field2=None, **kwargs):
super().__init__(**kwargs)
self.field = field
self.field2 = field2

Просмотреть файл

@ -43,10 +43,9 @@ class TimeoutTestSensor(BaseSensorOperator):
@apply_defaults
def __init__(self,
return_value=False,
*args,
**kwargs):
self.return_value = return_value
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
def poke(self, context):
return self.return_value

Просмотреть файл

@ -121,8 +121,8 @@ class CustomOperator(BaseOperator):
)
@apply_defaults
def __init__(self, bash_command=None, *args, **kwargs):
super(CustomOperator, self).__init__(*args, **kwargs)
def __init__(self, bash_command=None, **kwargs):
super(CustomOperator, self).__init__(**kwargs)
self.bash_command = bash_command
def execute(self, context):
@ -170,9 +170,9 @@ class MockHiveOperator(HiveOperator):
class DeprecatedOperator(BaseOperator):
@apply_defaults
def __init__(self, *args, **kwargs):
def __init__(self, **kwargs):
warnings.warn("This operator is deprecated.", DeprecationWarning, stacklevel=4)
super().__init__(*args, **kwargs)
super().__init__(**kwargs)
def execute(self, context):
pass

Просмотреть файл

@ -31,8 +31,8 @@ class DummyClass:
class DummySubClass(DummyClass):
@apply_defaults
def __init__(self, test_sub_param, *args, **kwargs):
super().__init__(*args, **kwargs)
def __init__(self, test_sub_param, **kwargs):
super().__init__(**kwargs)
self.test_sub_param = test_sub_param