Compare commits

..

3 Commits

View File

@ -97,7 +97,7 @@ class Message():
path: Optional[pathlib.Path] path: Optional[pathlib.Path]
# @classmethod # @classmethod
# def from_file(cls: Type[MessageInst], path: str) -> MessageInst: # def from_file(cls: Type[MessageInst], path: pathlib.Path) -> MessageInst:
# """ # """
# Create a Message from the given file. Expects the following file structure: # Create a Message from the given file. Expects the following file structure:
# * TagLine (from 'self.tags') # * TagLine (from 'self.tags')
@ -107,7 +107,7 @@ class Message():
# """ # """
# pass # pass
def to_file(self, path: str) -> None: def to_file(self, path: Optional[pathlib.Path]) -> None:
""" """
Write Message to the given file. Creates the following file structure: Write Message to the given file. Creates the following file structure:
* TagLine (from 'self.tags') * TagLine (from 'self.tags')
@ -116,6 +116,8 @@ class Message():
* Answer.Header * Answer.Header
* Answer * Answer
""" """
if not path and not self.path:
raise MessageError('Got no valid path to write message')
pass pass
def asdict(self) -> dict[str, Any]: def asdict(self) -> dict[str, Any]: