Mercurial > libervia-backend
diff libervia/backend/tools/common/data_objects.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | 32388d743348 |
children |
line wrap: on
line diff
--- a/libervia/backend/tools/common/data_objects.py Tue Jun 18 12:06:45 2024 +0200 +++ b/libervia/backend/tools/common/data_objects.py Wed Jun 19 18:44:57 2024 +0200 @@ -55,12 +55,10 @@ if "url" not in attachment: try: attachment["url"] = next( - s['url'] for s in attachment["sources"] if 'url' in s + s["url"] for s in attachment["sources"] if "url" in s ) except (StopIteration, KeyError): - log.warning( - f"An attachment has no URL: {attachment}" - ) + log.warning(f"An attachment has no URL: {attachment}") @property def id(self): @@ -126,7 +124,6 @@ return self.extra.get("attachments", []) - class Messages(object): def __init__(self, msgs_data): self.messages = [Message(m) for m in msgs_data] @@ -166,7 +163,7 @@ @property def avatar_basename(self): try: - return basename(self.data['avatar']['path']) + return basename(self.data["avatar"]["path"]) except (TypeError, KeyError): return None