Reformatted code base using black.
This commit is contained in:
parent
56319cbad3
commit
53fdaa9d09
1 changed files with 12604 additions and 8966 deletions
|
|
@ -68,15 +68,15 @@ class UploadPlugin(object):
|
|||
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 @@ class UploadPlugin(object):
|
|||
"""
|
||||
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 @@ class UploadPlugin(object):
|
|||
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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue