Skip to content

Commit

Permalink
Include files in subdirs but ignore dirs as model data files
Browse files Browse the repository at this point in the history
  • Loading branch information
juhoinkinen committed Mar 13, 2024
1 parent eba2b0c commit 47c836c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions annif/backend/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ def params(self) -> dict[str, Any]:

@property
def _model_file_paths(self) -> list:
all_paths = glob(os.path.join(self.datadir, "*"))
all_paths = glob(os.path.join(self.datadir, "**"), recursive=True)
file_paths = [p for p in all_paths if os.path.isfile(p)]
ignore_patterns = ("*-train*", "tmp-*", "vectorizer")
ignore_paths = [
path
for igp in ignore_patterns
for path in glob(os.path.join(self.datadir, igp))
]
return list(set(all_paths) - set(ignore_paths))
return list(set(file_paths) - set(ignore_paths))

@property
def is_trained(self) -> bool:
Expand Down

0 comments on commit 47c836c

Please sign in to comment.