Container for compile errors. This class generates and keeps tracks of compile errors and the current error context (nested imports).
| 434 | |
| 435 | |
| 436 | class Errors: |
| 437 | """Container for compile errors. |
| 438 | |
| 439 | This class generates and keeps tracks of compile errors and the |
| 440 | current error context (nested imports). |
| 441 | """ |
| 442 | |
| 443 | # Map from files to generated error messages. Is an OrderedDict so |
| 444 | # that it can be used to order messages based on the order the |
| 445 | # files were processed. |
| 446 | error_info_map: dict[str, list[ErrorInfo]] |
| 447 | |
| 448 | # optimization for legacy codebases with many files with errors |
| 449 | has_blockers: set[str] |
| 450 | |
| 451 | # Files that we have reported the errors for |
| 452 | flushed_files: set[str] |
| 453 | |
| 454 | # Current error context: nested import context/stack, as a list of (path, line) pairs. |
| 455 | import_ctx: list[tuple[str, int]] |
| 456 | |
| 457 | # Path name prefix that is removed from all paths, if set. |
| 458 | ignore_prefix: str | None = None |
| 459 | |
| 460 | # Path to current file. |
| 461 | file: str = "" |
| 462 | |
| 463 | # Ignore some errors on these lines of each file |
| 464 | # (path -> line -> error-codes) |
| 465 | ignored_lines: dict[str, dict[int, list[str]]] |
| 466 | |
| 467 | # Lines that were skipped during semantic analysis e.g. due to ALWAYS_FALSE, MYPY_FALSE, |
| 468 | # or platform/version checks. Those lines would not be type-checked. |
| 469 | skipped_lines: dict[str, set[int]] |
| 470 | |
| 471 | # Lines on which an error was actually ignored. |
| 472 | used_ignored_lines: dict[str, dict[int, list[str]]] |
| 473 | |
| 474 | # Files where all errors should be ignored. |
| 475 | ignored_files: set[str] |
| 476 | |
| 477 | # Collection of reported only_once messages. |
| 478 | only_once_messages: set[str] |
| 479 | |
| 480 | # State for keeping track of the current fine-grained incremental mode target. |
| 481 | # (See mypy.server.update for more about targets.) |
| 482 | # Current module id. |
| 483 | target_module: str | None = None |
| 484 | scope: Scope | None = None |
| 485 | |
| 486 | # Have we seen an import-related error so far? If yes, we filter out other messages |
| 487 | # in some cases to avoid reporting huge numbers of errors. |
| 488 | seen_import_error = False |
| 489 | |
| 490 | # Set this flag to record all raw report() calls. Recorded error (per file) can |
| 491 | # be replayed using by calling set_file() and add_error_info(). |
| 492 | global_watcher = False |
| 493 | recorded: dict[str, list[ErrorInfo]] |
no outgoing calls
searching dependent graphs…