Coverage for sel_tools/utils/comment.py: 100%
14 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-04 21:22 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-04 21:22 +0000
1"""Comment module."""
3from dataclasses import dataclass, field
4from pathlib import Path
6from sel_tools.file_parsing.slide_parser import get_attachments
9@dataclass
10class Comment:
11 """Issue Comment."""
13 issue_id: int
14 message: str
15 state_event: str | None = None
16 attachments: list[Path] = field(default_factory=list)
18 @staticmethod
19 def create(issue_id: int, message_or_file_path: str, state_event: str | None) -> "Comment":
20 file_path = Path(message_or_file_path)
21 message = file_path.read_text() if file_path.is_file() else message_or_file_path
22 return Comment(issue_id, message, state_event, get_attachments(message))