Mercurial > libervia-backend
diff libervia/cli/cmd_account.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | 47401850dec6 |
children |
line wrap: on
line diff
--- a/libervia/cli/cmd_account.py Tue Jun 18 12:06:45 2024 +0200 +++ b/libervia/cli/cmd_account.py Wed Jun 19 18:44:57 2024 +0200 @@ -43,12 +43,8 @@ ) def add_parser_options(self): - self.parser.add_argument( - "jid", help=_("jid to create") - ) - self.parser.add_argument( - "password", help=_("password of the account") - ) + self.parser.add_argument("jid", help=_("jid to create")) + self.parser.add_argument("password", help=_("password of the account")) self.parser.add_argument( "-p", "--profile", @@ -73,9 +69,7 @@ "--port", type=int, default=0, - help=_("server port (default: {port})").format( - port=C.XMPP_C2S_PORT - ), + help=_("server port (default: {port})").format(port=C.XMPP_C2S_PORT), ) async def start(self): @@ -89,16 +83,15 @@ ) except BridgeException as e: - if e.condition == 'conflict': - self.disp( - f"The account {self.args.jid} already exists", - error=True - ) + if e.condition == "conflict": + self.disp(f"The account {self.args.jid} already exists", error=True) self.host.quit(C.EXIT_CONFLICT) else: self.disp( f"can't create account on {self.args.host or 'localhost'!r} with jid " - f"{self.args.jid!r} using In-Band Registration: {e}", error=True) + f"{self.args.jid!r} using In-Band Registration: {e}", + error=True, + ) self.host.quit(C.EXIT_BRIDGE_ERRBACK) except Exception as e: self.disp(f"Internal error: {e}", error=True) @@ -109,7 +102,6 @@ if self.args.profile is None: self.host.quit() - self.disp(_("creating profile"), 2) try: await self.host.bridge.profile_create( @@ -118,20 +110,15 @@ "", ) except BridgeException as e: - if e.condition == 'conflict': - self.disp( - f"The profile {self.args.profile} already exists", - error=True - ) + if e.condition == "conflict": + self.disp(f"The profile {self.args.profile} already exists", error=True) self.host.quit(C.EXIT_CONFLICT) else: self.disp( - _("Can't create profile {profile} to associate with jid " - "{jid}: {e}").format( - profile=self.args.profile, - jid=self.args.jid, - e=e - ), + _( + "Can't create profile {profile} to associate with jid " + "{jid}: {e}" + ).format(profile=self.args.profile, jid=self.args.jid, e=e), error=True, ) self.host.quit(C.EXIT_BRIDGE_ERRBACK) @@ -173,7 +160,9 @@ self.disp( f"profile {self.args.profile} successfully created and associated to the new " - f"account", 1) + f"account", + 1, + ) self.host.quit() @@ -184,9 +173,7 @@ ) def add_parser_options(self): - self.parser.add_argument( - "password", help=_("new XMPP password") - ) + self.parser.add_argument("password", help=_("new XMPP password")) async def start(self): try: