From e0d9880b320d04aa381ae0ba8309bd35b170bda9 Mon Sep 17 00:00:00 2001 From: Will Miao <13051207myq@gmail.com> Date: Wed, 11 Jun 2025 17:33:13 +0800 Subject: [PATCH] Remove duplicate hash entries with a single path in get_duplicate_hashes method --- py/services/model_hash_index.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/py/services/model_hash_index.py b/py/services/model_hash_index.py index d62dc73a..e9668b1c 100644 --- a/py/services/model_hash_index.py +++ b/py/services/model_hash_index.py @@ -220,6 +220,15 @@ class ModelHashIndex: def get_duplicate_hashes(self) -> Dict[str, List[str]]: """Get dictionary of duplicate hashes and their paths""" + # Remove entries that have only one path + hashes_to_remove = [] + for sha256, paths in self._duplicate_hashes.items(): + if len(paths) <= 1: + hashes_to_remove.append(sha256) + + for sha256 in hashes_to_remove: + del self._duplicate_hashes[sha256] + return self._duplicate_hashes def get_duplicate_filenames(self) -> Dict[str, List[str]]: