MCPcopy Create free account
hub / github.com/python/mypy / find_duplicate

Function find_duplicate

mypy/semanal.py:8239–8247  ·  view source on GitHub ↗

If the list has duplicates, return one of the duplicates. Otherwise, return None.

(list: list[T])

Source from the content-addressed store, hash-verified

8237
8238
8239def find_duplicate(list: list[T]) -> T | None:
8240 """If the list has duplicates, return one of the duplicates.
8241
8242 Otherwise, return None.
8243 """
8244 for i in range(1, len(list)):
8245 if list[i] in list[:i]:
8246 return list[i]
8247 return None
8248
8249
8250def remove_imported_names_from_symtable(names: SymbolTable, module: str) -> None:

Callers 1

Calls 2

rangeClass · 0.85
lenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…