Reformatted code base using black.

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

View file

@ -43,12 +43,8 @@ class AccountCreate(base.CommandBase):
)
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 @@ class AccountCreate(base.CommandBase):
"--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 @@ class AccountCreate(base.CommandBase):
)
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 @@ class AccountCreate(base.CommandBase):
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 @@ class AccountCreate(base.CommandBase):
"",
)
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 @@ class AccountCreate(base.CommandBase):
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 @@ class AccountModify(base.CommandBase):
)
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: