Mercurial > libervia-backend
diff libervia/backend/plugins/plugin_xep_0234.py @ 4334:111dce64dcb5
plugins XEP-0300, XEP-0446, XEP-0447, XEP0448 and others: Refactoring to use Pydantic:
Pydantic models are used more and more in Libervia, for the bridge API, and also to
convert `domish.Element` to internal representation.
Type hints have also been added in many places.
rel 453
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 03 Dec 2024 00:12:38 +0100 |
parents | 0d7bb4df2343 |
children |
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_xep_0234.py Tue Dec 03 00:11:00 2024 +0100 +++ b/libervia/backend/plugins/plugin_xep_0234.py Tue Dec 03 00:12:38 2024 +0100 @@ -437,14 +437,14 @@ def _file_jingle_request( self, - peer_jid, - filepath, - name="", - file_hash="", - hash_algo="", - extra=None, - profile=C.PROF_KEY_NONE, - ): + peer_jid: str, + filepath: str, + name: str = "", + file_hash: str = "", + hash_algo: str = "", + extra: dict | None = None, + profile: str = C.PROF_KEY_NONE, + ) -> defer.Deferred[str]: client = self.host.get_client(profile) return defer.ensureDeferred( self.file_jingle_request( @@ -460,21 +460,22 @@ async def file_jingle_request( self, - client, - peer_jid, - filepath, - name=None, - file_hash=None, - hash_algo=None, - extra=None, - ): + client: SatXMPPEntity, + peer_jid: jid.JID, + filepath: str, + name: str | None = None, + file_hash: str | None = None, + hash_algo: str | None = None, + extra: dict | None = None, + ) -> str: """Request a file using jingle file transfer - @param peer_jid(jid.JID): destinee jid - @param filepath(str): absolute path where the file will be downloaded - @param name(unicode, None): name of the file - @param file_hash(unicode, None): hash of the file - @return (D(unicode)): progress id + @param client: Profile session. + @param peer_jid: destinee jid + @param filepath: absolute path where the file will be downloaded + @param name: name of the file + @param file_hash: hash of the file + @return: progress id """ progress_id_d = defer.Deferred() if extra is None: