From c9c67655448d9c5b44782e430a49396a5e3e5281 Mon Sep 17 00:00:00 2001 From: James Ball Date: Mon, 16 Sep 2024 23:21:13 +0100 Subject: [PATCH] mypy --- detectree2/models/train.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/detectree2/models/train.py b/detectree2/models/train.py index a8f9a3a1..e11fd47c 100644 --- a/detectree2/models/train.py +++ b/detectree2/models/train.py @@ -993,7 +993,11 @@ def get_latest_model_path(output_dir: str) -> str: files = os.listdir(output_dir) # Find all files that match the pattern and extract their indices - model_files = [(f, int(model_pattern.search(f).group(1))) for f in files if model_pattern.search(f)] + model_files = [] + for f in files: + match = model_pattern.search(f) + if match: + model_files.append((f, int(match.group(1)))) if not model_files: raise FileNotFoundError(f"No model files found in the directory {output_dir}")