40 lines
750 B
Python
40 lines
750 B
Python
import dataclasses
|
|
from typing import Self
|
|
|
|
|
|
@dataclasses.dataclass
|
|
class RenderError:
|
|
line: int
|
|
pos: int
|
|
error: str
|
|
|
|
@classmethod
|
|
def from_dict(cls, error_match: dict[str, str]) -> Self:
|
|
return cls(
|
|
line=int(error_match["line"]),
|
|
pos=int(error_match["pos"]),
|
|
error=error_match["error"],
|
|
)
|
|
|
|
def to_dict(self) -> dict[str, str]:
|
|
return dict(
|
|
line=str(self.line),
|
|
pos=str(self.pos),
|
|
error=self.error,
|
|
)
|
|
|
|
|
|
@dataclasses.dataclass
|
|
class LyricsParagraph:
|
|
lines: list[str]
|
|
|
|
|
|
@dataclasses.dataclass
|
|
class LyricsLine:
|
|
paragraphs: list[LyricsParagraph]
|
|
|
|
|
|
@dataclasses.dataclass
|
|
class LyricsText:
|
|
lines: list[LyricsLine]
|