Skip to content

Commit 4cb991d

Browse files
committed
Fix duplicate entries in index.py
1 parent 821637d commit 4cb991d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

mlc/index.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,18 @@ def add(self, meta, folder_type, path, repo):
8888
unique_id = meta['uid']
8989
alias = meta['alias']
9090
tags = meta['tags']
91-
self.indices[folder_type].append({
91+
92+
index = self.get_index(folder_type, unique_id)
93+
94+
if not index:
95+
self.indices[folder_type].append({
9296
"uid": unique_id,
9397
"tags": tags,
9498
"alias": alias,
9599
"path": path,
96100
"repo": repo
97101
})
98-
self._save_indices()
102+
self._save_indices()
99103

100104
def get_index(self, folder_type, uid):
101105
for index in range(len(self.indices[folder_type])):

0 commit comments

Comments
 (0)