Reformatted code base using black.

This commit is contained in:
Goffi 2024-06-19 18:44:57 +02:00
commit 53fdaa9d09

View file

@ -49,7 +49,6 @@ PLUGIN_INFO = {
}
class RemoteControl(BaseApplicationHandler):
def __init__(self, host):
@ -84,19 +83,18 @@ class RemoteControl(BaseApplicationHandler):
) -> defer.Deferred[str]:
client = self.host.get_client(profile)
extra = data_format.deserialise(extra_s)
d = defer.ensureDeferred(self.remote_control_start(
client,
jid.JID(peer_jid_s),
extra,
))
d = defer.ensureDeferred(
self.remote_control_start(
client,
jid.JID(peer_jid_s),
extra,
)
)
d.addCallback(data_format.serialise)
return d
async def remote_control_start(
self,
client: SatXMPPEntity,
peer_jid: jid.JID,
extra: dict
self, client: SatXMPPEntity, peer_jid: jid.JID, extra: dict
) -> dict:
"""Start a remote control session.
@ -104,9 +102,7 @@ class RemoteControl(BaseApplicationHandler):
@return: progress id
"""
if not extra:
raise exceptions.DataError(
'"extra" must be set.'
)
raise exceptions.DataError('"extra" must be set.')
# webrtc is always used for remote control
extra["webrtc"] = True
content = {
@ -127,9 +123,7 @@ class RemoteControl(BaseApplicationHandler):
try:
application_data = call_data["application"]
except KeyError:
raise exceptions.DataError(
'"call_data" must have an application media.'
)
raise exceptions.DataError('"call_data" must have an application media.')
try:
content["transport_data"] = {
"sctp-port": metadata["sctp-port"],
@ -139,7 +133,7 @@ class RemoteControl(BaseApplicationHandler):
"pwd": metadata["ice-pwd"],
"candidates": application_data.pop("ice-candidates"),
"fingerprint": application_data.pop("fingerprint", {}),
}
},
}
name = application_data.get("id")
if name:
@ -208,9 +202,7 @@ class RemoteControl(BaseApplicationHandler):
session_id = session["id"]
peer_jid = session["peer_jid"]
is_in_roster, confirm_msg, confirm_title = self._get_confirm_msg(
client, peer_jid
)
is_in_roster, confirm_msg, confirm_title = self._get_confirm_msg(client, peer_jid)
if is_in_roster:
action_type = C.META_TYPE_CONFIRM
else:
@ -227,7 +219,7 @@ class RemoteControl(BaseApplicationHandler):
confirm_msg,
confirm_title,
profile=client.profile,
action_extra=action_extra
action_extra=action_extra,
)
if accepted:
session["pre_accepted"] = True
@ -248,11 +240,7 @@ class RemoteControl(BaseApplicationHandler):
"""The remote control has been rejected"""
def jingle_session_init(
self,
client: SatXMPPEntity,
session: dict,
content_name: str,
extra: dict
self, client: SatXMPPEntity, session: dict, content_name: str, extra: dict
) -> domish.Element:
"""Initializes a jingle session.
@ -305,9 +293,7 @@ class RemoteControl(BaseApplicationHandler):
client, session, content_data, content_name
)
else:
raise exceptions.InternalError(
f"Invalid role {role!r}"
)
raise exceptions.InternalError(f"Invalid role {role!r}")
async def _remote_control_request_conf(
self,
@ -340,7 +326,7 @@ class RemoteControl(BaseApplicationHandler):
confirm_msg,
confirm_title,
profile=client.profile,
action_extra=action_extra
action_extra=action_extra,
)
async def jingle_handler(self, client, action, session, content_name, desc_elt):