Skip to content

Commit 47bd5dd

Browse files
hussein-awalaLee-W
andauthored
Remove useless string join from providers (#33968)
Co-authored-by: Wei Lee <weilee.rx@gmail.com>
1 parent cf0c824 commit 47bd5dd

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

β€Žairflow/providers/amazon/aws/log/s3_task_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def s3_write(self, log: str, remote_log_location: str, append: bool = True, max_
201201
try:
202202
if append and self.s3_log_exists(remote_log_location):
203203
old_log = self.s3_read(remote_log_location)
204-
log = "\n".join([old_log, log]) if old_log else log
204+
log = f"{old_log}\n{log}" if old_log else log
205205
except Exception:
206206
self.log.exception("Could not verify previous log to append")
207207
return False

β€Žairflow/providers/cncf/kubernetes/decorators/kubernetes.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,11 @@ def _generate_cmds(self) -> list[str]:
100100
return [
101101
"bash",
102102
"-cx",
103-
" && ".join(
104-
[
105-
write_local_script_file_cmd,
106-
write_local_input_file_cmd,
107-
make_xcom_dir_cmd,
108-
exec_python_cmd,
109-
]
103+
(
104+
f"{write_local_script_file_cmd} && "
105+
f"{write_local_input_file_cmd} && "
106+
f"{make_xcom_dir_cmd} && "
107+
f"{exec_python_cmd}"
110108
),
111109
]
112110

β€Žairflow/providers/google/cloud/log/gcs_task_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def gcs_write(self, log, remote_log_location) -> bool:
241241
try:
242242
blob = storage.Blob.from_string(remote_log_location, self.client)
243243
old_log = blob.download_as_bytes().decode()
244-
log = "\n".join([old_log, log]) if old_log else log
244+
log = f"{old_log}\n{log}" if old_log else log
245245
except Exception as e:
246246
if not self.no_log_found(e):
247247
log += self._add_message(

β€Žairflow/providers/microsoft/azure/log/wasb_task_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def wasb_write(self, log: str, remote_log_location: str, append: bool = True) ->
238238
"""
239239
if append and self.wasb_log_exists(remote_log_location):
240240
old_log = self.wasb_read(remote_log_location)
241-
log = "\n".join([old_log, log]) if old_log else log
241+
log = f"{old_log}\n{log}" if old_log else log
242242

243243
try:
244244
self.hook.load_string(log, self.wasb_container, remote_log_location, overwrite=True)

0 commit comments

Comments
 (0)