Merge pull request #388 from agentydragon/use-setdefault

Use dict.setdefault
This commit is contained in:
Damien Elmes 2019-12-26 07:43:01 +10:00 committed by GitHub
commit df76e8a8ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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