Skip to content

Commit c5016f7

Browse files
authored
Refactor: Consolidate import textwrap in providers (#34220)
1 parent 6f9443f commit c5016f7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

airflow/providers/cncf/kubernetes/decorators/kubernetes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
import inspect
2121
import os
2222
import pickle
23+
import textwrap
2324
import uuid
2425
from shlex import quote
2526
from tempfile import TemporaryDirectory
26-
from textwrap import dedent
2727
from typing import TYPE_CHECKING, Callable, Sequence
2828

2929
import dill
@@ -80,7 +80,7 @@ def __init__(self, namespace: str = "default", use_dill: bool = False, **kwargs)
8080
# TODO: Remove me once this provider min supported Airflow version is 2.6
8181
def get_python_source(self):
8282
raw_source = inspect.getsource(self.python_callable)
83-
res = dedent(raw_source)
83+
res = textwrap.dedent(raw_source)
8484
res = remove_task_decorator(res, self.custom_operator_name)
8585
return res
8686

airflow/providers/docker/decorators/docker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
import inspect
2121
import os
2222
import pickle
23+
import textwrap
2324
from tempfile import TemporaryDirectory
24-
from textwrap import dedent
2525
from typing import TYPE_CHECKING, Callable, Sequence
2626

2727
import dill
@@ -139,7 +139,7 @@ def execute(self, context: Context):
139139
# TODO: Remove me once this provider min supported Airflow version is 2.6
140140
def get_python_source(self):
141141
raw_source = inspect.getsource(self.python_callable)
142-
res = dedent(raw_source)
142+
res = textwrap.dedent(raw_source)
143143
res = remove_task_decorator(res, self.custom_operator_name)
144144
return res
145145

0 commit comments

Comments
 (0)