MCPcopy Index your code
hub / github.com/python/mypy / remove_duplicates

Method remove_duplicates

mypy/errors.py:1267–1284  ·  view source on GitHub ↗
(self, errors: list[ErrorInfo])

Source from the content-addressed store, hash-verified

1265 return result
1266
1267 def remove_duplicates(self, errors: list[ErrorInfo]) -> list[ErrorInfo]:
1268 filtered_errors = []
1269 seen_by_line: defaultdict[int, set[tuple[str, str]]] = defaultdict(set)
1270 removed = set()
1271 for err in errors:
1272 if err.parent_error is not None:
1273 # Notes with specified parent are removed together with error below.
1274 filtered_errors.append(err)
1275 elif (err.severity, err.message) not in seen_by_line[err.line]:
1276 filtered_errors.append(err)
1277 seen_by_line[err.line].add((err.severity, err.message))
1278 else:
1279 removed.add(err)
1280 return [
1281 err
1282 for err in filtered_errors
1283 if err.parent_error is None or err.parent_error not in removed
1284 ]
1285
1286
1287class CompileError(Exception):

Callers 1

file_messagesMethod · 0.95

Calls 3

setClass · 0.85
appendMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected