euporie.core.diagnostics

Contains container classes for diagnostic information.

Functions

NamedTuple(typename[, fields])

Typed version of namedtuple.

Classes

ABCMeta(name, bases, namespace, /, **kwargs)

Metaclass for defining Abstract Base Classes (ABCs).

Diagnostic(code, message, level, link, ...)

Represent a diagnostic item for code.

Report([iterable])

Class for storing a diagnostic report.

class euporie.core.diagnostics.Diagnostic(code: str, message: str, level: Literal[0, 1, 2, 3, 4, 5], link: str, lines: slice, chars: slice)

Bases: NamedTuple

Represent a diagnostic item for code.

chars: slice

Alias for field number 5

code: str

Alias for field number 0

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

level: Literal[0, 1, 2, 3, 4, 5]

Alias for field number 2

lines: slice

Alias for field number 4

Alias for field number 3

message: str

Alias for field number 1

class euporie.core.diagnostics.Report(iterable=(), /)

Bases: List[Diagnostic]

Class for storing a diagnostic report.

append(object, /)

Append object to the end of the list.

clear()

Remove all items from list.

copy()

Return a shallow copy of the list.

count(value, /)

Return number of occurrences of value.

extend(iterable, /)

Extend list by appending elements from the iterable.

classmethod from_lsp(text: str, outputs: list[dict]) Report

Create a diagnostic report from LSP output.

classmethod from_reports(*reports: Report) Report

Initialize a new report.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

insert(index, object, /)

Insert object before index.

pop(index=-1, /)

Remove and return item at index (default last).

Raises IndexError if list is empty or index is out of range.

remove(value, /)

Remove first occurrence of value.

Raises ValueError if the value is not present.

reverse()

Reverse IN PLACE.

sort(*, key=None, reverse=False)

Sort the list in ascending order and return None.

The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).

If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.

The reverse flag can be set to sort in descending order.