Summary
Severity: Medium
File: sdk/basyx/aas/backend/local_file.py:153
Description
__len__ returns the count of all entries in the store directory, including non-JSON files, hidden files (.DS_Store), and subdirectories.
def __len__(self) -> int:
return len(os.listdir(self.directory_path))
Callers expecting len(store) == number_of_aas_objects get incorrect results whenever the directory contains anything other than {hash}.json files.
Fix
return sum(1 for f in os.listdir(self.directory_path) if f.endswith(".json"))
Summary
Severity: Medium
File:
sdk/basyx/aas/backend/local_file.py:153Description
__len__returns the count of all entries in the store directory, including non-JSON files, hidden files (.DS_Store), and subdirectories.Callers expecting
len(store) == number_of_aas_objectsget incorrect results whenever the directory contains anything other than{hash}.jsonfiles.Fix