Skip to content

Commit 9509908

Browse files
committed
Refactor artifact ZIP file path code
Previously the code for assembling the ZIP file path was duplicated.
1 parent c387258 commit 9509908

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

reportsizedeltas/reportsizedeltas.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,13 @@ def get_artifact(self, artifact_download_url: str):
268268
# Create temporary folder
269269
artifact_folder_object = tempfile.TemporaryDirectory(prefix="reportsizedeltas-")
270270
try:
271+
artifact_zip_file = artifact_folder_object.name + "/" + self.sketches_reports_source + ".zip"
271272
# Download artifact
272-
with open(
273-
file=artifact_folder_object.name + "/" + self.sketches_reports_source + ".zip", mode="wb"
274-
) as out_file:
273+
with open(file=artifact_zip_file, mode="wb") as out_file:
275274
with self.raw_http_request(url=artifact_download_url) as fp:
276275
out_file.write(fp.read())
277276

278277
# Unzip artifact
279-
artifact_zip_file = artifact_folder_object.name + "/" + self.sketches_reports_source + ".zip"
280278
with zipfile.ZipFile(file=artifact_zip_file, mode="r") as zip_ref:
281279
zip_ref.extractall(path=artifact_folder_object.name)
282280
os.remove(artifact_zip_file)

0 commit comments

Comments
 (0)