Mercurial > libervia-backend
diff libervia/backend/plugins/plugin_misc_upload.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | 4b842c1fb686 |
children |
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_misc_upload.py Tue Jun 18 12:06:45 2024 +0200 +++ b/libervia/backend/plugins/plugin_misc_upload.py Wed Jun 19 18:44:57 2024 +0200 @@ -68,15 +68,15 @@ self._upload_callbacks = [] def _file_upload( - self, filepath, filename, upload_jid_s="", options='', profile=C.PROF_KEY_NONE + self, filepath, filename, upload_jid_s="", options="", profile=C.PROF_KEY_NONE ): client = self.host.get_client(profile) upload_jid = jid.JID(upload_jid_s) if upload_jid_s else None options = data_format.deserialise(options) - return defer.ensureDeferred(self.file_upload( - client, filepath, filename or None, upload_jid, options - )) + return defer.ensureDeferred( + self.file_upload(client, filepath, filename or None, upload_jid, options) + ) async def file_upload(self, client, filepath, filename, upload_jid, options): """Send a file using best available method @@ -87,10 +87,13 @@ """ try: progress_id, __ = await self.upload( - client, filepath, filename, upload_jid, options) + client, filepath, filename, upload_jid, options + ) except Exception as e: - if (isinstance(e, jabber_error.StanzaError) - and e.condition == 'not-acceptable'): + if ( + isinstance(e, jabber_error.StanzaError) + and e.condition == "not-acceptable" + ): reason = e.text else: reason = str(e) @@ -110,7 +113,7 @@ filepath: Union[Path, str], filename: Optional[str] = None, upload_jid: Optional[jid.JID] = None, - extra: Optional[dict]=None + extra: Optional[dict] = None, ) -> Tuple[str, defer.Deferred]: """Send a file using best available method