Compare commits

..

4 Commits

View File

@ -2,8 +2,8 @@
Module implementing message related functions and classes. Module implementing message related functions and classes.
""" """
import pathlib import pathlib
from typing import Type, TypeVar, Optional, Any from typing import Type, TypeVar, Optional, Any, Final
from dataclasses import dataclass, asdict from dataclasses import dataclass, asdict, field
from .tags import Tag from .tags import Tag
QuestionInst = TypeVar('QuestionInst', bound='Question') QuestionInst = TypeVar('QuestionInst', bound='Question')
@ -95,7 +95,7 @@ class Message():
answer: Optional[Answer] answer: Optional[Answer]
tags: Optional[set[Tag]] tags: Optional[set[Tag]]
file_path: Optional[pathlib.Path] file_path: Optional[pathlib.Path]
file_suffixes: list[str] = ['.txt', '.yaml'] file_suffixes: Final[list[str]] = field(default_factory=lambda: ['.txt', '.yaml'])
# @classmethod # @classmethod
# def from_file(cls: Type[MessageInst], file_path: pathlib.Path) -> MessageInst: # def from_file(cls: Type[MessageInst], file_path: pathlib.Path) -> MessageInst: