add type hints + minor reformatting.

This commit is contained in:
Goffi 2025-10-01 17:57:48 +02:00
commit 19f4ce55de
6 changed files with 20 additions and 20 deletions

View file

@ -734,31 +734,32 @@ class SatXMPPEntity(core_types.SatXMPPEntity):
await self.a_send(mess_data["xml"])
return mess_data
def sendMessage(
self,
to_jid,
message,
subject=None,
mess_type="auto",
extra=None,
uid=None,
no_trigger=False,
):
to_jid: jid.JID,
message: dict[str, str],
subject: dict[str, str] | None = None,
mess_type: str = "auto",
extra: dict[str, str] | None = None,
uid: str | None = None,
no_trigger: bool = False,
) -> defer.Deferred:
r"""Send a message to an entity
@param to_jid(jid.JID): destinee of the message
@param message(dict): message body, key is the language (use '' when unknown)
@param subject(dict): message subject, key is the language (use '' when unknown)
@param mess_type(str): one of standard message type (cf RFC 6121 §5.2.2) or:
@param to_jid: destinee of the message
@param message: message body, key is the language (use '' when unknown)
@param subject: message subject, key is the language (use '' when unknown)
@param mess_type: one of standard message type (cf RFC 6121 §5.2.2) or:
- auto: for automatic type detection
- info: for information ("info_type" can be specified in extra)
@param extra(dict, None): extra data. Key can be:
@param extra: extra data. Key can be:
- info_type: information type, can be
TODO
@param uid(unicode, None): unique id:
@param uid: unique id:
should be unique at least in this XMPP session
if None, an uuid will be generated
@param no_trigger (bool): if True, sendMessage[suffix] trigger will no be used
@param no_trigger: if True, sendMessage[suffix] trigger will no be used
useful when a message need to be sent without any modification
/!\ this will also skip encryption methods!
"""

View file

@ -329,7 +329,7 @@ class APGateway:
)
await self.init(client)
def profile_connected(self, client):
def profile_connected(self, client) -> None:
self.ad_hoc.init(client)
async def _items_received(

View file

@ -34,7 +34,6 @@ from libervia.backend.core.log import getLogger
from libervia.backend.tools import xml_tools
from libervia.backend.tools import stream
log = getLogger(__name__)
NS_STREAM = "http://salut-a-toi.org/protocol/stream"

View file

@ -180,7 +180,8 @@ class PubsubHook(object):
except Exception as e:
log.warning(
_(
"Can't load Pubsub hook at node {node}, it will be removed: {reason}"
"Can't load Pubsub hook at node {node}, it will be"
" removed: {reason}"
).format(node=node, reason=e)
)
hooks_list.remove(hook_data)

View file

@ -30,7 +30,6 @@ import collections
import uuid
import json
PLUGIN_INFO = {
C.PI_NAME: "import",
C.PI_IMPORT_NAME: "IMPORT",

View file

@ -75,7 +75,7 @@ class MercurialHandler(object):
MercurialProtocol.command = which("hg")[0]
except IndexError:
raise exceptions.NotFound(
_("Mercurial executable (hg) not found, " "can't use Mercurial handler")
_("Mercurial executable (hg) not found, can't use Mercurial handler")
)
self.host = host
self._m = host.plugins["MERGE_REQUESTS"]