Skip to content

Commit cdec301

Browse files
authored
Add correct signature to all operators and sensors (#10205)
* add correct signature to operators in providers package * add keyword only to operators and sensors outside provider package * remove unused type ignore
1 parent c920b1b commit cdec301

File tree

104 files changed

+122
-114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+122
-114
lines changed

airflow/operators/email.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class EmailOperator(BaseOperator):
5151
ui_color = '#e6faf9'
5252

5353
@apply_defaults
54-
def __init__(
55-
self,
54+
def __init__( # pylint: disable=invalid-name
55+
self, *,
5656
to: Union[List[str], str],
5757
subject: str,
5858
html_content: str,

airflow/operators/sql.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class SQLValueCheckOperator(BaseOperator):
152152

153153
@apply_defaults
154154
def __init__(
155-
self,
155+
self, *,
156156
sql: str,
157157
pass_value: Any,
158158
tolerance: Any = None,
@@ -271,7 +271,7 @@ class SQLIntervalCheckOperator(BaseOperator):
271271

272272
@apply_defaults
273273
def __init__(
274-
self,
274+
self, *,
275275
table: str,
276276
metrics_thresholds: Dict[str, int],
277277
date_filter_column: Optional[str] = "ds",
@@ -415,7 +415,7 @@ class SQLThresholdCheckOperator(BaseOperator):
415415

416416
@apply_defaults
417417
def __init__(
418-
self,
418+
self, *,
419419
sql: str,
420420
min_threshold: Any,
421421
max_threshold: Any,
@@ -507,7 +507,7 @@ class BranchSQLOperator(BaseOperator, SkipMixin):
507507

508508
@apply_defaults
509509
def __init__(
510-
self,
510+
self, *,
511511
sql: str,
512512
follow_task_ids_if_true: List[str],
513513
follow_task_ids_if_false: List[str],

airflow/providers/celery/sensors/celery_queue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CeleryQueueSensor(BaseSensorOperator):
3737
"""
3838
@apply_defaults
3939
def __init__(
40-
self,
40+
self, *,
4141
celery_queue: str,
4242
target_task_id: Optional[str] = None,
4343
**kwargs) -> None:

airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ class KubernetesPodOperator(BaseOperator): # pylint: disable=too-many-instance-
152152

153153
@apply_defaults
154154
def __init__(self, # pylint: disable=too-many-arguments,too-many-locals
155+
*,
155156
namespace: Optional[str] = None,
156157
image: Optional[str] = None,
157158
name: Optional[str] = None,

airflow/providers/cncf/kubernetes/operators/spark_kubernetes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class SparkKubernetesOperator(BaseOperator):
4343
ui_color = '#f4a460'
4444

4545
@apply_defaults
46-
def __init__(self,
46+
def __init__(self, *,
4747
application_file: str,
4848
namespace: Optional[str] = None,
4949
kubernetes_conn_id: str = 'kubernetes_default',

airflow/providers/cncf/kubernetes/sensors/spark_kubernetes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class SparkKubernetesSensor(BaseSensorOperator):
4444
SUCCESS_STATES = ('COMPLETED',)
4545

4646
@apply_defaults
47-
def __init__(self,
47+
def __init__(self, *,
4848
application_name: str,
4949
namespace: Optional[str] = None,
5050
kubernetes_conn_id: str = 'kubernetes_default',

airflow/providers/databricks/operators/databricks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ class DatabricksSubmitRunOperator(BaseOperator):
245245
# pylint: disable=too-many-arguments
246246
@apply_defaults
247247
def __init__(
248-
self,
248+
self, *,
249249
json=None,
250250
spark_jar_task=None,
251251
notebook_task=None,
@@ -457,7 +457,7 @@ class DatabricksRunNowOperator(BaseOperator):
457457
# pylint: disable=too-many-arguments
458458
@apply_defaults
459459
def __init__(
460-
self,
460+
self, *,
461461
job_id=None,
462462
json=None,
463463
notebook_params=None,

airflow/providers/datadog/sensors/datadog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class DatadogSensor(BaseSensorOperator):
4040

4141
@apply_defaults
4242
def __init__(
43-
self,
43+
self, *,
4444
datadog_conn_id: str = 'datadog_default',
4545
from_seconds_ago: int = 3600,
4646
up_to_seconds_from_now: int = 0,

airflow/providers/dingding/operators/dingding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class DingdingOperator(BaseOperator):
4646
ui_color = '#4ea4d4' # Dingding icon color
4747

4848
@apply_defaults
49-
def __init__(self,
49+
def __init__(self, *,
5050
dingding_conn_id='dingding_default',
5151
message_type='text',
5252
message=None,

airflow/providers/discord/operators/discord_webhook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class DiscordWebhookOperator(SimpleHttpOperator):
5757
template_fields = ['username', 'message']
5858

5959
@apply_defaults
60-
def __init__(self,
60+
def __init__(self, *,
6161
http_conn_id: Optional[str] = None,
6262
webhook_endpoint: Optional[str] = None,
6363
message: str = "",

0 commit comments

Comments
 (0)