Filter out the "iteration-dependent" errors and notes and store their information to handle them after iteration is completed.
(self, file: str, info: ErrorInfo)
| 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 | |
| 436 | class Errors: |