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

Method yield_uselessness_error_infos

mypy/errors.py:334–349  ·  view source on GitHub ↗

Report only those `unreachable`, `redundant-expr`, and `redundant-casts` errors that could not be ruled out in any iteration step.

(self)

Source from the content-addressed store, hash-verified

332 self.revealed_types = defaultdict(list)
333
334 def yield_uselessness_error_infos(self) -> Iterator[tuple[str, Context, ErrorCode]]:
335 """Report only those `unreachable`, `redundant-expr`, and `redundant-casts`
336 errors that could not be ruled out in any iteration step."""
337
338 persistent_uselessness_errors = set()
339 for candidate in set(chain(*self.uselessness_errors)):
340 if all(
341 (candidate in errors) or (candidate[2] in lines)
342 for errors, lines in zip(self.uselessness_errors, self.unreachable_lines)
343 ):
344 persistent_uselessness_errors.add(candidate)
345 for error_info in persistent_uselessness_errors:
346 context = Context(line=error_info[2], column=error_info[3])
347 context.end_line = error_info[4]
348 context.end_column = error_info[5]
349 yield error_info[1], context, error_info[0]
350
351 def yield_nonoverlapping_types(
352 self,

Callers 1

Calls 5

ContextClass · 0.90
setClass · 0.85
allFunction · 0.85
zipFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected