Use dict.setdefault
This commit is contained in:
parent
ed8340a4e3
commit
60438a0219
@ -608,9 +608,7 @@ def findDupes(col, fieldName, search="") -> List[Tuple[Any, List]]:
|
||||
# empty does not count as duplicate
|
||||
if not val:
|
||||
continue
|
||||
if val not in vals:
|
||||
vals[val] = []
|
||||
vals[val].append(nid)
|
||||
vals.setdefault(val, []).append(nid)
|
||||
if len(vals[val]) == 2:
|
||||
dupes.append((val, vals[val]))
|
||||
return dupes
|
||||
|
Loading…
Reference in New Issue
Block a user