Skip to content

Commit

Permalink
[126] Add bool status to TemporaryZip class
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinHeist committed Nov 29, 2024
1 parent 0b35ba0 commit a2653c2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions modules/TemporaryZip.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ def __init__(self,
context_id = name or generate_context_id()
self.dir = zip_dir / context_id
self.dir.mkdir(exist_ok=True, parents=True)
self.__files = 0


def __bool__(self) -> bool:
"""
Whether this zip folder has files or not.
Returns:
True if this zip has had files added to it, False otherwise.
"""

return self.__files > 0


def __delete_zip(self,
Expand Down Expand Up @@ -92,6 +104,7 @@ def add_file(self,

copy_file(file, self.dir / (filename or file.name))
log.debug(f'Copied "{file}" into zip directory')
self.__files += 1


def zip(self, *, log: Logger = log) -> Path:
Expand Down
2 changes: 1 addition & 1 deletion modules/ref/version_webui
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.0-alpha.13.0-webui125
v2.0-alpha.13.0-webui126

0 comments on commit a2653c2

Please sign in to comment.