text_lint.results.tree.ResultTree

class text_lint.results.tree.ResultTree(value: str | List[str])[Quellcode]

Bases: object

Nested parsing results represented as tree.

__eq__(other: object) bool[Quellcode]

Implement the equality operator for ResultTree instances.

Parameter:

other (object) – The other object to compare to this ResultTree instance.

Rückgabe:

A boolean for whether this tree is equal to the specified tree.

Raises:

NotImplemented

Rückgabetyp:

bool

__hash__() int[Quellcode]

Implement hashing for ResultTree instances.

Rückgabe:

The hashed value of this tree.

Rückgabetyp:

int

__init__(value: str | List[str]) None[Quellcode]

Initialize ResultTree instances.

Parameter:

value (str | List[str]) – The root value of the new ResultTree.

add_matches(capture_groups: Tuple[str | List[str], ...], splits: Dict[int, str | None], index: int = 0) None[Quellcode]

Add a set of capture groups to the tree.

Parameter:
  • capture_groups (Tuple[str | List[str], ...]) – A tuple of values captured from assertion regexes.

  • splits (Dict[int, str | None]) – A dictionary of splits to perform on the captured values.

  • index (int) – The index of the current captured value being processed.

clone() ResultTree[Quellcode]

Generate a separate copy of this tree.

Rückgabe:

The cloned tree instance.

Rückgabetyp:

ResultTree

classmethod create(value: str | List[str]) ResultTree[Quellcode]

Create a new ResultTree instance.

Parameter:

value (str | List[str]) – The root value of the new ResultTree.

Rückgabe:

The created tree.

Rückgabetyp:

ResultTree

representation() Dict[str | List[str], str | List[str] | List[AliasRecursiveTreeResult]][Quellcode]

Return a dictionary representation of the nested tree structure.

Rückgabe:

A dictionary representation of this tree.

Rückgabetyp:

Dict[str | List[str], str | List[str] | List[AliasRecursiveTreeResult]]