Reformatted code base using black.

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

View file

@ -37,7 +37,6 @@ __commands__ = ["Call"]
class Common(base.CommandBase):
def __init__(self, *args, **kwargs):
super().__init__(
*args,
@ -52,7 +51,7 @@ class Common(base.CommandBase):
#: experimental TUI output
"tui": partial(self.use_output, "tui"),
},
**kwargs
**kwargs,
)
def add_parser_options(self):
@ -61,8 +60,11 @@ class Common(base.CommandBase):
)
sources_group = self.parser.add_mutually_exclusive_group()
sources_group.add_argument(
"-s", "--sources", choices=['auto', 'test'], default='auto',
help='Well-known sources to use (default: "auto").'
"-s",
"--sources",
choices=["auto", "test"],
default="auto",
help='Well-known sources to use (default: "auto").',
)
def get_call_data_kw(self) -> dict[str, Any]:
@ -70,10 +72,10 @@ class Common(base.CommandBase):
kwargs: dict[str, Any] = {}
if self.args.sources == "test":
from libervia.frontends.tools.webrtc_models import SourcesTest
kwargs["sources_data"] = SourcesTest()
return kwargs
async def start(self):
root_logger = logging.getLogger()
# we don't want any formatting for messages from webrtc
@ -133,10 +135,9 @@ class Make(Common):
async def start(self):
await super().start()
await super().output(CallData(
callee=jid.JID(self.args.entity),
kwargs=self.get_call_data_kw()
))
await super().output(
CallData(callee=jid.JID(self.args.entity), kwargs=self.get_call_data_kw())
)
class Receive(Common):
@ -157,12 +158,14 @@ class Receive(Common):
action="append",
metavar="JID",
default=[],
help=_("automatically accept call from this jid (can be used multiple times)")
help=_(
"automatically accept call from this jid (can be used multiple times)"
),
)
auto_accept_group.add_argument(
"--auto-accept-all",
action="store_true",
help=_("automatically accept call from anybody")
help=_("automatically accept call from anybody"),
)
async def on_action_new(
@ -179,9 +182,7 @@ class Receive(Common):
not self.args.auto_accept_all
and caller not in self.args.auto_accept
and not await self.host.confirm(
_("📞 Incoming call from {caller}, do you accept?").format(
caller=caller
)
_("📞 Incoming call from {caller}, do you accept?").format(caller=caller)
)
):
await self.host.bridge.action_launch(
@ -191,12 +192,14 @@ class Receive(Common):
self.disp(_("✅ Incoming call from {caller} accepted.").format(caller=caller))
await super().output(CallData(
callee=peer_jid,
sid=action_data["session_id"],
action_id=action_id,
kwargs=self.get_call_data_kw()
))
await super().output(
CallData(
callee=peer_jid,
sid=action_data["session_id"],
action_id=action_id,
kwargs=self.get_call_data_kw(),
)
)
async def start(self):
await super().start()