Use dict.setdefault

This commit is contained in:
Michal Pokorný (Rai) 2019-12-25 15:34:30 +01:00
parent ed8340a4e3
commit 60438a0219

View File

@ -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