The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ
Python implementation of [Earthstar](https://earthstar-project.org/)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
earthsnake/earthsnake/document/__init__.py

35 lines
829 B

"""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: Optional[str]
@property
@abstractmethod
def content_length(self) -> int:
"""The length of the document"""
@abstractmethod
def sign(self, identity: Optional[Identity] = None) -> None:
"""Sign the document as identity
If ``identity`` is ``None``, use ``self.author`` instead.
"""
def __repr__(self) -> str:
return f'<{self.__class__.__name__} {self.path} by {self.author}>'