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

Method on_error

mypy/errors.py:419–433  ·  view source on GitHub ↗

Filter out the "iteration-dependent" errors and notes and store their information to handle them after iteration is completed.

(self, file: str, info: ErrorInfo)

Source from the content-addressed store, hash-verified

417 iteration_dependent_errors.unreachable_lines.append(set())
418
419 def on_error(self, file: str, info: ErrorInfo) -> bool:
420 """Filter out the "iteration-dependent" errors and notes and store their
421 information to handle them after iteration is completed."""
422
423 iter_errors = self.iteration_dependent_errors
424
425 if info.code in (codes.UNREACHABLE, codes.REDUNDANT_EXPR, codes.REDUNDANT_CAST):
426 iter_errors.uselessness_errors[-1].add(
427 (info.code, info.message, info.line, info.column, info.end_line, info.end_column)
428 )
429 if info.code == codes.UNREACHABLE:
430 iter_errors.unreachable_lines[-1].update(range(info.line, info.end_line + 1))
431 return True
432
433 return super().on_error(file, info)
434
435
436class Errors:

Callers

nothing calls this directly

Calls 4

rangeClass · 0.85
addMethod · 0.45
updateMethod · 0.45
on_errorMethod · 0.45

Tested by

no test coverage detected