diff libervia/backend/plugins/plugin_misc_remote_control.py @ 4270:0d7bb4df2343

Reformatted code base using black.
author Goffi <goffi@goffi.org>
date Wed, 19 Jun 2024 18:44:57 +0200
parents 898db6daf0d0
children
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_misc_remote_control.py	Tue Jun 18 12:06:45 2024 +0200
+++ b/libervia/backend/plugins/plugin_misc_remote_control.py	Wed Jun 19 18:44:57 2024 +0200
@@ -49,7 +49,6 @@
 }
 
 
-
 class RemoteControl(BaseApplicationHandler):
 
     def __init__(self, host):
@@ -84,19 +83,18 @@
     ) -> 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 @@
         @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 @@
         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 @@
                     "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 @@
         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 @@
             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 @@
         """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 @@
                 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 @@
             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):