Skip to content

Commit

Permalink
rearrange since keras are zips
Browse files Browse the repository at this point in the history
  • Loading branch information
swashko committed Feb 12, 2024
1 parent d7ad232 commit 63128cc
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions modelscan/modelscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,18 @@ def _scan_zip(
file_names = zip.namelist()
for file_name in file_names:
with zip.open(file_name, "r") as file_io:
if _is_zipfile(file_name, data=file_io):
scanned = False
self._errors.append(
ModelScanError(
"ModelScan",
f"{source}:{file_name} is a zip file. ModelScan does not support nested zip files.",
)
)
else:
scanned = self._scan_source(
source=f"{source}:{file_name}",
data=file_io,
)
scanned = self._scan_source(
source=f"{source}:{file_name}",
data=file_io,
)
if not scanned:
if _is_zipfile(file_name, data=file_io):
self._errors.append(
ModelScanError(
"ModelScan",
f"{source}:{file_name} is a zip file. ModelScan does not support nested zip files.",
)
)
self._skipped.append(f"{source}:{file_name}")
except zipfile.BadZipFile as e:
logger.debug(f"Skipping zip file {source}, due to error", e, exc_info=True)
Expand Down

0 comments on commit 63128cc

Please sign in to comment.