From 610eac071827dbd17a264609e4affb44edc8d005 Mon Sep 17 00:00:00 2001 From: Goffi Date: Mon, 27 Apr 2026 15:45:40 +0200 Subject: [PATCH] Formatting + type hints --- libervia/backend/memory/memory.py | 2 +- libervia/backend/memory/sqla.py | 14 ++++++++------ libervia/backend/plugins/plugin_xep_0277.py | 8 +++++--- libervia/cli/cmd_blog.py | 4 +--- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/libervia/backend/memory/memory.py b/libervia/backend/memory/memory.py index bd8ca125..a1ab39d3 100644 --- a/libervia/backend/memory/memory.py +++ b/libervia/backend/memory/memory.py @@ -665,7 +665,7 @@ class Memory: to_jid: jid.JID | None, limit: int = C.HISTORY_LIMIT_NONE, between: bool = True, - filters: dict[str, str] | None = None, + filters: dict[str, str | bool] | None = None, profile: str = C.PROF_KEY_NONE, ) -> defer.Deferred[list]: """Retrieve messages in history diff --git a/libervia/backend/memory/sqla.py b/libervia/backend/memory/sqla.py index 55f41bb4..27a7efc7 100644 --- a/libervia/backend/memory/sqla.py +++ b/libervia/backend/memory/sqla.py @@ -547,13 +547,15 @@ class Storage: @aio async def history_get( self, - from_jid: Optional[jid.JID], - to_jid: Optional[jid.JID], - limit: Optional[int] = None, + from_jid: jid.JID | None, + to_jid: jid.JID | None, + limit: int | None = None, between: bool = True, - filters: Optional[Dict[str, str]] = None, - profile: Optional[str] = None, - ) -> List[Tuple[str, int, str, str, Dict[str, str], Dict[str, str], str, str, str]]: + filters: dict[str, str | bool] | None = None, + profile: str | None = None, + ) -> list[ + tuple[str, float, str, str, dict[str, str], dict[str, str], str, dict[str, Any]] + ]: """Retrieve messages in history @param from_jid: source JID (full, or bare for catchall) diff --git a/libervia/backend/plugins/plugin_xep_0277.py b/libervia/backend/plugins/plugin_xep_0277.py index 78ae1427..b624f2e9 100644 --- a/libervia/backend/plugins/plugin_xep_0277.py +++ b/libervia/backend/plugins/plugin_xep_0277.py @@ -1188,9 +1188,11 @@ class XEP_0277: pass else: # other server, let's try to find a non PEP service there - d = defer.ensureDeferred(self.host.find_service_entity( - client, "pubsub", "service", parent_service - )) + d = defer.ensureDeferred( + self.host.find_service_entity( + client, "pubsub", "service", parent_service + ) + ) d.addCallback(lambda entity: entity or parent_service) else: # parent is already on a normal Pubsub service, we re-use it diff --git a/libervia/cli/cmd_blog.py b/libervia/cli/cmd_blog.py index b290d68b..e663e276 100644 --- a/libervia/cli/cmd_blog.py +++ b/libervia/cli/cmd_blog.py @@ -972,9 +972,7 @@ class Preview(base.CommandBase, common.BaseEdit): self.disp(_('File "{file}" doesn\'t exist!').format(file=self.args.file)) self.host.quit(C.EXIT_NOT_FOUND) - self.syntax = await guess_syntax_from_path( - self.host, self.content_file_path - ) + self.syntax = await guess_syntax_from_path(self.host, self.content_file_path) # at this point the syntax is converted, we can display the preview preview_file = tempfile.NamedTemporaryFile(suffix=".xhtml", delete=False)