Skip to content

Commit 4830687

Browse files
authored
Use Python 3 style super classes (#11806)
example: ``` super().__init__(label, validators, **kwargs) ``` instead of ``` super(DateTimeWithTimezoneField, self).__init__(label, validators, **kwargs) ```
1 parent 6ca933b commit 4830687

File tree

11 files changed

+17
-17
lines changed

11 files changed

+17
-17
lines changed

airflow/api_connexion/exceptions.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class NotFound(ProblemException):
7878
def __init__(
7979
self, title: str = 'Not Found', detail: Optional[str] = None, headers: Optional[Dict] = None, **kwargs
8080
):
81-
super(NotFound, self).__init__(
81+
super().__init__(
8282
status=404, type=EXCEPTIONS_LINK_MAP[404], title=title, detail=detail, headers=headers, **kwargs
8383
)
8484

@@ -93,7 +93,7 @@ def __init__(
9393
headers: Optional[Dict] = None,
9494
**kwargs,
9595
):
96-
super(BadRequest, self).__init__(
96+
super().__init__(
9797
status=400, type=EXCEPTIONS_LINK_MAP[400], title=title, detail=detail, headers=headers, **kwargs
9898
)
9999

@@ -108,7 +108,7 @@ def __init__(
108108
headers: Optional[Dict] = None,
109109
**kwargs,
110110
):
111-
super(Unauthenticated, self).__init__(
111+
super().__init__(
112112
status=401, type=EXCEPTIONS_LINK_MAP[401], title=title, detail=detail, headers=headers, **kwargs
113113
)
114114

@@ -119,7 +119,7 @@ class PermissionDenied(ProblemException):
119119
def __init__(
120120
self, title: str = 'Forbidden', detail: Optional[str] = None, headers: Optional[Dict] = None, **kwargs
121121
):
122-
super(PermissionDenied, self).__init__(
122+
super().__init__(
123123
status=403, type=EXCEPTIONS_LINK_MAP[403], title=title, detail=detail, headers=headers, **kwargs
124124
)
125125

@@ -130,7 +130,7 @@ class AlreadyExists(ProblemException):
130130
def __init__(
131131
self, title='Conflict', detail: Optional[str] = None, headers: Optional[Dict] = None, **kwargs
132132
):
133-
super(AlreadyExists, self).__init__(
133+
super().__init__(
134134
status=409, type=EXCEPTIONS_LINK_MAP[409], title=title, detail=detail, headers=headers, **kwargs
135135
)
136136

@@ -145,6 +145,6 @@ def __init__(
145145
headers: Optional[Dict] = None,
146146
**kwargs,
147147
):
148-
super(Unknown, self).__init__(
148+
super().__init__(
149149
status=500, type=EXCEPTIONS_LINK_MAP[500], title=title, detail=detail, headers=headers, **kwargs
150150
)

airflow/providers/amazon/aws/operators/glue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def __init__(
7575
iam_role_name: Optional[str] = None,
7676
**kwargs,
7777
): # pylint: disable=too-many-arguments
78-
super(AwsGlueJobOperator, self).__init__(**kwargs)
78+
super().__init__(**kwargs)
7979
self.job_name = job_name
8080
self.job_desc = job_desc
8181
self.script_location = script_location

airflow/providers/apache/livy/hooks/livy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class LivyHook(HttpHook, LoggingMixin):
6565
_def_headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}
6666

6767
def __init__(self, livy_conn_id: str = 'livy_default') -> None:
68-
super(LivyHook, self).__init__(http_conn_id=livy_conn_id)
68+
super().__init__(http_conn_id=livy_conn_id)
6969

7070
def get_conn(self, headers: Optional[Dict[str, Any]] = None) -> Any:
7171
"""

airflow/providers/exasol/hooks/exasol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ExasolHook(DbApiHook):
4141
supports_autocommit = True
4242

4343
def __init__(self, *args, **kwargs) -> None:
44-
super(ExasolHook, self).__init__(*args, **kwargs)
44+
super().__init__(*args, **kwargs)
4545
self.schema = kwargs.pop("schema", None)
4646

4747
def get_conn(self) -> ExaConnection:
@@ -167,7 +167,7 @@ def get_autocommit(self, conn) -> bool:
167167
"""
168168
autocommit = conn.attr.get('autocommit')
169169
if autocommit is None:
170-
autocommit = super(ExasolHook, self).get_autocommit(conn)
170+
autocommit = super().get_autocommit(conn)
171171
return autocommit
172172

173173
@staticmethod

airflow/providers/exasol/operators/exasol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(
5656
schema: Optional[str] = None,
5757
**kwargs,
5858
) -> None:
59-
super(ExasolOperator, self).__init__(**kwargs)
59+
super().__init__(**kwargs)
6060
self.exasol_conn_id = exasol_conn_id
6161
self.sql = sql
6262
self.autocommit = autocommit

airflow/providers/google/cloud/hooks/gdm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(
3737
delegate_to: Optional[str] = None,
3838
impersonation_chain: Optional[Union[str, Sequence[str]]] = None,
3939
) -> None:
40-
super(GoogleDeploymentManagerHook, self).__init__(
40+
super().__init__(
4141
gcp_conn_id=gcp_conn_id,
4242
delegate_to=delegate_to,
4343
impersonation_chain=impersonation_chain,

airflow/providers/google/marketing_platform/operators/analytics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def __init__(
460460
impersonation_chain: Optional[Union[str, Sequence[str]]] = None,
461461
**kwargs,
462462
) -> None:
463-
super(GoogleAnalyticsModifyFileHeadersDataImportOperator, self).__init__(**kwargs)
463+
super().__init__(**kwargs)
464464
self.storage_bucket = storage_bucket
465465
self.storage_name_object = storage_name_object
466466
self.gcp_conn_id = gcp_conn_id

airflow/providers/singularity/operators/singularity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def __init__( # pylint: disable=too-many-arguments
8787
**kwargs,
8888
) -> None:
8989

90-
super(SingularityOperator, self).__init__(**kwargs)
90+
super().__init__(**kwargs)
9191
self.auto_remove = auto_remove
9292
self.command = command
9393
self.start_command = start_command

airflow/providers/slack/operators/slack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def __init__(
206206
self.filename = filename
207207
self.filetype = filetype
208208
self.content = content
209-
super(SlackAPIFileOperator, self).__init__(method=self.method, **kwargs)
209+
super().__init__(method=self.method, **kwargs)
210210

211211
def construct_api_call_params(self) -> Any:
212212
self.api_params = {

airflow/providers/snowflake/transfers/snowflake_to_slack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def __init__( # pylint: disable=too-many-arguments
8484
slack_token: Optional[str] = None,
8585
**kwargs,
8686
) -> None:
87-
super(SnowflakeToSlackOperator, self).__init__(**kwargs)
87+
super().__init__(**kwargs)
8888

8989
self.snowflake_conn_id = snowflake_conn_id
9090
self.sql = sql

0 commit comments

Comments
 (0)