From 1f42966dd9c6894e4e85fdba88316d9e956a6861 Mon Sep 17 00:00:00 2001 From: John Wilkie <124276291+JBWilkie@users.noreply.github.com> Date: Wed, 22 May 2024 13:13:59 +0100 Subject: [PATCH] Allow compute_distributions() to work with filepaths already with a .json extension (#846) --- darwin/dataset/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/darwin/dataset/utils.py b/darwin/dataset/utils.py index 3976f61ba..3a7f6c6d6 100644 --- a/darwin/dataset/utils.py +++ b/darwin/dataset/utils.py @@ -797,7 +797,9 @@ def compute_distributions( stems: List[str] = [e.rstrip("\n\r") for e in split_file.open()] for stem in stems: - annotation_path: Path = annotations_dir / f"{stem}.json" + if not stem.endswith(".json"): + stem = f"{stem}.json" + annotation_path: Path = annotations_dir / stem annotation_file: Optional[dt.AnnotationFile] = parse_path( annotation_path )