earthsnake/earthsnake/document/__init__.py

28 lines
599 B
Python
Raw Normal View History

"""Document handling classes"""
from abc import ABC, abstractmethod
from datetime import datetime
from typing import Optional
from ..identity import Identity
from ..path import Path
class Document(ABC): # pragma: no cover pylint: disable=too-few-public-methods
"""Abstract base class for documents"""
path: Path
author: Identity
timestamp: datetime
signature: str
@abstractmethod
def sign(self, identity: Optional[Identity] = None) -> None:
"""Sign the document as identity
If ``identity`` is ``None``, use ``self.author`` instead.
"""