aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/models.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--webmentions_ssg/models.py45
1 files changed, 9 insertions, 36 deletions
diff --git a/webmentions_ssg/models.py b/webmentions_ssg/models.py
index 0932962..37e5f0e 100644
--- a/webmentions_ssg/models.py
+++ b/webmentions_ssg/models.py
@@ -60,10 +60,7 @@ class User(UserMixin, Base):
password_hash: Mapped[str] = mapped_column(Text(), nullable=False)
def __repr__(self) -> str:
- """Return a developer-readable representation of the user.
-
- :return: Representation containing the username.
- """
+ """Represent the user by username."""
return f"<User {self.username}>"
@property
@@ -149,10 +146,7 @@ class ReceivedWebmention(Base):
)
def __repr__(self) -> str:
- """Return a developer-readable representation of the received Webmention.
-
- :return: Representation containing the identifier, source, and target.
- """
+ """Represent the received Webmention by source and target."""
return f"<ReceivedWebmention {self.source!r} -> {self.target!r}>"
@staticmethod
@@ -175,18 +169,12 @@ class ReceivedWebmention(Base):
@property
def verified(self) -> bool:
- """Return whether the Webmention has been successfully verified.
-
- :return: Whether the Webmention status is ``verified``.
- """
+ """Return whether the Webmention has been successfully verified."""
return self.status == ReceivedStatus.VERIFIED
@property
def created_at(self) -> datetime:
- """Return the creation time encoded in the Webmention UUID.
-
- :return: Creation time as a timezone-aware datetime.
- """
+ """Return the creation time encoded in the Webmention UUID."""
return uuid7_to_datetime(self.uuid)
@@ -220,18 +208,12 @@ class Source(Base):
)
def __repr__(self) -> str:
- """Return a developer-readable representation of the source.
-
- :return: Representation containing the identifier and public URL.
- """
+ """Represent the source by its public URL."""
return f"<Source {self.url!r}>"
@property
def created_at(self) -> datetime:
- """Return the creation time encoded in the source UUID.
-
- :return: Creation time as a timezone-aware datetime.
- """
+ """Return the creation time encoded in the source UUID."""
return uuid7_to_datetime(self.uuid)
@@ -312,10 +294,7 @@ class SentWebmention(Base):
)
def __repr__(self) -> str:
- """Return a developer-readable representation of the sent Webmention.
-
- :return: Representation containing the identifier and target URL.
- """
+ """Represent the sent Webmention by its target URL."""
return f"<SentWebmention {self.target!r}>"
def reopen(
@@ -339,10 +318,7 @@ class SentWebmention(Base):
@property
def pending(self) -> bool:
- """Return whether the Webmention has an unprocessed source revision.
-
- :return: Whether the desired revision still requires processing.
- """
+ """Return whether the Webmention has an unprocessed source revision."""
return (
self.processed_revision is None
or self.processed_revision < self.desired_revision
@@ -350,10 +326,7 @@ class SentWebmention(Base):
@property
def created_at(self) -> datetime:
- """Return the creation time encoded in the Webmention UUID.
-
- :return: Creation time as a timezone-aware datetime.
- """
+ """Return the creation time encoded in the Webmention UUID."""
return uuid7_to_datetime(self.uuid)