Skip to content

Commit

Permalink
rename in _folder_can_be_deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
ychiucco committed Aug 26, 2024
1 parent 041a825 commit 8572b07
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions fractal_server/zip_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def iterfile():
return iter([byte_stream.getvalue()])


def _zipping_worked(*, folder: str) -> bool:
def _folder_can_be_deleted(*, folder: str) -> bool:

zip_file = f"{folder}_tmp.zip"
folder = Path(folder)
Expand Down Expand Up @@ -80,9 +80,6 @@ def _zipping_worked(*, folder: str) -> bool:

def _zip_folder_to_file_and_remove(*, folder: str) -> None:
_create_zip(folder, f"{folder}_tmp.zip")
if _zipping_worked(folder=folder):
shutil.move(f"{folder}_tmp.zip", f"{folder}.zip")
shutil.move(f"{folder}_tmp.zip", f"{folder}.zip")
if _folder_can_be_deleted(folder=folder):
shutil.rmtree(folder)
else:
if os.path.exists(f"{folder}_tmp.zip"):
os.remove(f"{folder}_tmp.zip")

0 comments on commit 8572b07

Please sign in to comment.