Skip to content

Commit 1476bac

Browse files
committed
apply ruff
1 parent 6d3a3fe commit 1476bac

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

nemo_run/core/packaging/git.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ class GitArchivePackager(Packager):
7373
check_uncommitted_changes: bool = False
7474
check_untracked_files: bool = False
7575

76-
def _concatenate_tar_files(self, ctx: Context, output_file: str, files_to_concatenate: list[str]):
76+
def _concatenate_tar_files(
77+
self, ctx: Context, output_file: str, files_to_concatenate: list[str]
78+
):
7779
"""Concatenate multiple uncompressed tar files into a single tar archive.
7880
7981
The list should include ALL fragments to merge (base + additions).
@@ -139,20 +141,16 @@ def package(self, path: Path, job_dir: str, name: str) -> str:
139141
capture_output=True,
140142
text=True,
141143
).stdout.strip()
142-
assert not bool(untracked_files), (
143-
"Your repo has untracked files. Please track your files via git or set check_untracked_files to False to proceed with packaging."
144-
)
144+
assert not bool(
145+
untracked_files
146+
), "Your repo has untracked files. Please track your files via git or set check_untracked_files to False to proceed with packaging."
145147

146148
ctx = Context()
147149
# Build the base uncompressed archive, then separately generate all additional fragments.
148150
# Finally, concatenate all fragments in one pass for performance and portability.
149151
base_tar_tmp = f"{output_file}.tmp.base"
150-
git_archive_cmd = (
151-
f"git archive --format=tar --output={shlex.quote(base_tar_tmp)} {self.ref}:{git_sub_path}"
152-
)
153-
git_submodule_cmd = (
154-
"git submodule foreach --recursive 'git archive --format=tar --prefix=$sm_path/ --output=$sha1.tmp HEAD'"
155-
)
152+
git_archive_cmd = f"git archive --format=tar --output={shlex.quote(base_tar_tmp)} {self.ref}:{git_sub_path}"
153+
git_submodule_cmd = "git submodule foreach --recursive 'git archive --format=tar --prefix=$sm_path/ --output=$sha1.tmp HEAD'"
156154

157155
with ctx.cd(git_base_path):
158156
ctx.run(git_archive_cmd)
@@ -194,9 +192,7 @@ def package(self, path: Path, job_dir: str, name: str) -> str:
194192
include_pattern, include_pattern_relative_path
195193
)
196194
pattern_tar_file_name = os.path.join(git_base_path, pattern_tar_file_name)
197-
include_pattern_cmd = (
198-
f"find {relative_include_pattern} -type f | tar -cf {shlex.quote(pattern_tar_file_name)} -T -"
199-
)
195+
include_pattern_cmd = f"find {relative_include_pattern} -type f | tar -cf {shlex.quote(pattern_tar_file_name)} -T -"
200196

201197
with ctx.cd(include_pattern_relative_path):
202198
ctx.run(include_pattern_cmd)

0 commit comments

Comments
 (0)