class Errors: (source)
Container for compile errors. This class generates and keeps tracks of compile errors and the current error context (nested imports).
Method | __init__ |
Undocumented |
Method | add |
Undocumented |
Method | blocker |
Return the module with a blocking error, or None if not possible. |
Method | clear |
Remove errors in specific fine-grained targets within a file. |
Method | current |
Undocumented |
Method | current |
Retrieves the current target from the associated scope. |
Method | file |
Return a string list of new error messages from a given file. |
Method | format |
Return a string list that represents the error messages. |
Method | generate |
Undocumented |
Method | generate |
Undocumented |
Method | has |
Undocumented |
Method | import |
Return a copy of the import context. |
Method | initialize |
Undocumented |
Method | is |
Are the any errors that are blockers? |
Method | is |
Undocumented |
Method | is |
Are there any generated messages? |
Method | is |
Are there any errors for the given file? |
Method | is |
Undocumented |
Method | new |
Return a string list of new error messages. |
Method | num |
Return the number of generated messages. |
Method | prefer |
Should we generate simple/fast error messages? |
Method | raise |
Raise a CompileError with the generated messages. |
Method | remove |
Remove duplicates from a sorted error list. |
Method | render |
Translate the messages into a sequence of tuples. |
Method | report |
Report message at the given line using the current error context. |
Method | report |
Undocumented |
Method | reset |
Undocumented |
Method | set |
Set the path and module id of the current file. |
Method | set |
Undocumented |
Method | set |
Set path prefix that will be removed from all paths. |
Method | set |
Replace the entire import context with a new value. |
Method | simplify |
Undocumented |
Method | sort |
Sort an array of error messages locally by line number. |
Method | targets |
Return a set of all targets that contain errors. |
Instance Variable | error |
Undocumented |
Instance Variable | file |
Undocumented |
Instance Variable | flushed |
Undocumented |
Instance Variable | function |
Undocumented |
Instance Variable | has |
Undocumented |
Instance Variable | hide |
Undocumented |
Instance Variable | ignore |
Undocumented |
Instance Variable | ignored |
Undocumented |
Instance Variable | ignored |
Undocumented |
Instance Variable | import |
Undocumented |
Instance Variable | many |
Undocumented |
Instance Variable | only |
Undocumented |
Instance Variable | options |
Undocumented |
Instance Variable | pretty |
Undocumented |
Instance Variable | read |
Undocumented |
Instance Variable | scope |
Undocumented |
Instance Variable | seen |
Undocumented |
Instance Variable | show |
Undocumented |
Instance Variable | show |
Undocumented |
Instance Variable | show |
Undocumented |
Instance Variable | show |
Undocumented |
Instance Variable | target |
Undocumented |
Instance Variable | used |
Undocumented |
Method | _add |
Undocumented |
Method | _filter |
process ErrorWatcher stack from top to bottom, stopping early if error needs to be filtered out |
Class Variable | _watchers |
Undocumented |
bool
= False, show_column_numbers: bool
= False, hide_error_codes: bool
= False, pretty: bool
= False, show_error_end: bool
= False, read_source: Callable[ [ str], list[ str]|None]|None
= None, show_absolute_path: bool
= False, many_errors_threshold: int
= -1, options: Options|None
= None):
(source)
¶
Undocumented
Retrieves the current target from the associated scope. If there is no associated scope, use the target module.
Return a string list of new error messages from a given file. Use a form suitable for displaying to the user.
list[ ErrorInfo]
, source_lines: list[ str]|None
) -> list[ str]
:
(source)
¶
Return a string list that represents the error messages. Use a form suitable for displaying to the user. If self.pretty is True also append a relevant trimmed source code line (only for severity 'error').
str
, is_warning_unused_ignores: bool
):
(source)
¶
Undocumented
int
, info: ErrorInfo
, ignores: dict[ int, list[ str]]
) -> bool
:
(source)
¶
Undocumented
Return a string list of new error messages. Use a form suitable for displaying to the user. Errors from different files are ordered based on the order in which they first generated an error.
Should we generate simple/fast error messages? Return True if errors are not shown to user, i.e. errors are ignored or they are collected for internal use only. If True, we should prefer to generate a simple message quickly. All normal errors should still be reported.
Translate the messages into a sequence of tuples. Each tuple is of form (path, line, col, severity, message, allow_dups, code). The rendered sequence includes information about error contexts. The path item may be None. If the line item is negative, the line number is not defined for the tuple.
int
, column: int|None
, message: str
, code: ErrorCode|None
= None, *, blocker: bool
= False, severity: str
= 'error', file: str|None
= None, only_once: bool
= False, allow_dups: bool
= False, origin_span: Iterable[ int]|None
= None, offset: int
= 0, end_line: int|None
= None, end_column: int|None
= None):
(source)
¶
Report message at the given line using the current error context. Args: line: line number of error column: column number of error message: message to report code: error code (defaults to 'misc'; not shown for notes) blocker: if True, don't continue analysis after this error severity: 'error' or 'note' file: if non-None, override current file as context only_once: if True, only report this exact message once per build allow_dups: if True, allow duplicate copies of this message (ignored if only_once) origin_span: if non-None, override current context as origin (type: ignores have effect here) end_line: if non-None, override current context as end
str
, module: str|None
, options: Options
, scope: Scope|None
= None):
(source)
¶
Set the path and module id of the current file.
str
, ignored_lines: dict[ int, list[ str]]
, ignore_all: bool
= False):
(source)
¶
Undocumented
Sort an array of error messages locally by line number. I.e., sort a run of consecutive messages with the same context by line number, but otherwise retain the general ordering of the messages.