Skip to content

Commit

Permalink
Add is_compatible API (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
swashko authored Jan 24, 2024
1 parent 4f760ac commit a647a2b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions modelscan/modelscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,20 @@ def _generate_results(self) -> Dict[str, Any]:

return report

def is_compatible(self, path: str) -> bool:
# Determines whether a file path is compatible with any of the available scanners
if Path(path).suffix in self._settings["supported_zip_extensions"]:
return True
for scanner_path, scanner_settings in self._settings["scanners"].items():
if (
"supported_extensions" in scanner_settings.keys()
and Path(path).suffix
in self._settings["scanners"][scanner_path]["supported_extensions"]
):
return True

return False

@property
def issues(self) -> Issues:
return self._issues
Expand Down

0 comments on commit a647a2b

Please sign in to comment.