Reformatted code base using black.
This commit is contained in:
parent
56319cbad3
commit
53fdaa9d09
1 changed files with 12604 additions and 8966 deletions
|
|
@ -67,7 +67,11 @@ class XEP_0096(object):
|
|||
self._si = self.host.plugins["XEP-0095"]
|
||||
self._si.register_si_profile(SI_PROFILE_NAME, self._transfer_request)
|
||||
host.bridge.add_method(
|
||||
"si_file_send", ".plugin", in_sign="sssss", out_sign="s", method=self._file_send
|
||||
"si_file_send",
|
||||
".plugin",
|
||||
in_sign="sssss",
|
||||
out_sign="s",
|
||||
method=self._file_send,
|
||||
)
|
||||
|
||||
async def can_handle_file_send(self, client, peer_jid, filepath):
|
||||
|
|
@ -280,9 +284,7 @@ class XEP_0096(object):
|
|||
@param data: session data
|
||||
"""
|
||||
log.warning(
|
||||
"Transfer {si_id} failed: {reason}".format(
|
||||
reason=str(failure.value), **data
|
||||
)
|
||||
"Transfer {si_id} failed: {reason}".format(reason=str(failure.value), **data)
|
||||
)
|
||||
data["stream_object"].close()
|
||||
|
||||
|
|
@ -297,9 +299,9 @@ class XEP_0096(object):
|
|||
client: SatXMPPEntity,
|
||||
peer_jid: jid.JID,
|
||||
filepath: str,
|
||||
name: str|None = None,
|
||||
desc: str|None = None,
|
||||
extra: dict|None = None
|
||||
name: str | None = None,
|
||||
desc: str | None = None,
|
||||
extra: dict | None = None,
|
||||
) -> dict:
|
||||
"""Send a file using XEP-0096.
|
||||
|
||||
|
|
@ -373,8 +375,9 @@ class XEP_0096(object):
|
|||
stream_object = stream.FileStreamObject(
|
||||
self.host, client, filepath, uid=sid, size=size
|
||||
)
|
||||
d = plugin.start_stream(client, stream_object, client.jid,
|
||||
jid.JID(iq_elt["from"]), sid)
|
||||
d = plugin.start_stream(
|
||||
client, stream_object, client.jid, jid.JID(iq_elt["from"]), sid
|
||||
)
|
||||
d.addCallback(self._send_cb, client, sid, stream_object)
|
||||
d.addErrback(self._send_eb, client, sid, stream_object)
|
||||
|
||||
|
|
@ -393,7 +396,9 @@ class XEP_0096(object):
|
|||
"Something went wrong during the file transfer session initialisation: {reason}"
|
||||
).format(reason=str(stanza_err))
|
||||
title = D_("File transfer error")
|
||||
xml_tools.quick_note(self.host, client, msg, title, C.XMLUI_DATA_LVL_ERROR)
|
||||
xml_tools.quick_note(
|
||||
self.host, client, msg, title, C.XMLUI_DATA_LVL_ERROR
|
||||
)
|
||||
elif failure.check(exceptions.DataError):
|
||||
log.warning("Invalid stanza received")
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue