Coverage for fpdf2_textindex/interface/alias.py: 100.00%
12 statements
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-01 14:22 +0000
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-01 14:22 +0000
1"""Alias."""
3from __future__ import annotations
5import dataclasses
7from fpdf2_textindex.interface.abc import _LabelPathABC
8from fpdf2_textindex.interface.label_path import LabelPath
11@dataclasses.dataclass(frozen=True, kw_only=True, slots=True)
12class Alias(_LabelPathABC):
13 """Alias."""
15 name: str
16 """The name of the alias."""
18 label_path: LabelPath
19 """The label path of the alias."""
21 def __post_init__(self) -> None:
22 object.__setattr__(self, "label_path", LabelPath(self.label_path))
24 def __repr__(self) -> str:
25 return (
26 f"{type(self).__name__}"
27 f"(#{self.name:s} -> {self.joined_label_path!r:s})"
28 )