Mercurial > libervia-backend
diff libervia/backend/plugins/plugin_xep_0260.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | e11b13418ba6 |
children |
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_xep_0260.py Tue Jun 18 12:06:45 2024 +0200 +++ b/libervia/backend/plugins/plugin_xep_0260.py Wed Jun 19 18:44:57 2024 +0200 @@ -97,7 +97,9 @@ # self._s5b.registerCandidate(candidate) return candidates - def _build_candidates(self, session, candidates, sid, session_hash, client, mode=None): + def _build_candidates( + self, session, candidates, sid, session_hash, client, mode=None + ): """Build <transport> element with candidates @param session(dict): jingle session data @@ -147,7 +149,8 @@ ) # requester and target are inversed for peer candidates transport_data["stream_d"] = self._s5b.register_hash(client, session_hash, None) candidates = transport_data["candidates"] = await self._s5b.get_candidates( - client, session["local_jid"]) + client, session["local_jid"] + ) mode = "tcp" # XXX: we only manage tcp for now transport_elt = self._build_candidates( session, candidates, sid, session_hash, client, mode @@ -155,7 +158,9 @@ return transport_elt - def _proxy_activated_cb(self, iq_result_elt, client, candidate, session, content_name): + def _proxy_activated_cb( + self, iq_result_elt, client, candidate, session, content_name + ): """Called when activation confirmation has been received from proxy cf XEP-0260 ยง 2.4 @@ -304,7 +309,11 @@ ) args = [client, choosed_candidate, session, content_name] d.addCallbacks( - self._proxy_activated_cb, self._proxy_activated_eb, args, None, args + self._proxy_activated_cb, + self._proxy_activated_eb, + args, + None, + args, ) else: # this Deferred will be called when we'll receive activation confirmation from other peer @@ -356,9 +365,7 @@ log.warning("No cid found in <candidate-used>") raise exceptions.DataError try: - candidate = next(( - c for c in transport_data["candidates"] if c.id == cid - )) + candidate = next((c for c in transport_data["candidates"] if c.id == cid)) except StopIteration: log.warning("Given cid doesn't correspond to any known candidate !") raise exceptions.DataError # TODO: send an error to other peer, and use better exception @@ -433,10 +440,8 @@ session_hash = transport_data["session_hash"] = self._s5b.get_session_hash( session["local_jid"], session["peer_jid"], sid ) - peer_session_hash = transport_data[ - "peer_session_hash" - ] = self._s5b.get_session_hash( - session["peer_jid"], session["local_jid"], sid + peer_session_hash = transport_data["peer_session_hash"] = ( + self._s5b.get_session_hash(session["peer_jid"], session["local_jid"], sid) ) # requester and target are inversed for peer candidates peer_candidates = transport_data["peer_candidates"] = self._parse_candidates( transport_elt @@ -505,8 +510,8 @@ def _do_fallback(self, feature_checked, session, content_name, client): """Do the fallback, method called once feature is checked - @param feature_checked(bool): True if other peer can do IBB - """ + @param feature_checked(bool): True if other peer can do IBB + """ if not feature_checked: log.warning( "Other peer can't manage jingle IBB, be have to terminate the session"