Global reformatting with black.

This commit is contained in:
Goffi 2025-09-13 10:46:10 +02:00
commit 96bf3af324

View file

@ -33,9 +33,11 @@ class BookmarksList(base.CommandBase):
def __init__(self, host):
extra_outputs = {"default": self.default_output}
super().__init__(
host, "list", help=_("list bookmarks"),
host,
"list",
help=_("list bookmarks"),
use_output=C.OUTPUT_COMPLEX,
extra_outputs=extra_outputs
extra_outputs=extra_outputs,
)
def add_parser_options(self):
@ -55,16 +57,16 @@ class BookmarksList(base.CommandBase):
conference_data.get("name", ""),
conference_data.get("nick", ""),
conference_data.get("password", ""),
"✅" if conference_data.get("autojoin", False) else "❌"
"✅" if conference_data.get("autojoin", False) else "❌",
)
self.console.print(table)
async def start(self):
try:
data = data_format.deserialise(await self.host.bridge.bookmarks_list(
"", self.host.profile
))
data = data_format.deserialise(
await self.host.bridge.bookmarks_list("", self.host.profile)
)
except Exception as e:
self.disp(f"can't get bookmarks list: {e}", error=True)
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
@ -79,9 +81,7 @@ class BookmarksRemove(base.CommandBase):
super().__init__(host, "remove", help=_("remove a bookmark"))
def add_parser_options(self):
self.parser.add_argument(
"bookmark", help=_("jid of the bookmark to remove")
)
self.parser.add_argument("bookmark", help=_("jid of the bookmark to remove"))
self.parser.add_argument(
"-f",
"--force",
@ -92,14 +92,13 @@ class BookmarksRemove(base.CommandBase):
async def start(self):
if not self.args.force:
await self.host.confirm_or_quit(
_("Are you sure to delete the bookmark {bookmark_id!r}?")
.format(bookmark_id=self.args.bookmark)
_("Are you sure to delete the bookmark {bookmark_id!r}?").format(
bookmark_id=self.args.bookmark
)
)
try:
await self.host.bridge.bookmark_remove(
self.args.bookmark, self.host.profile
)
await self.host.bridge.bookmark_remove(self.args.bookmark, self.host.profile)
except Exception as e:
self.disp(_("can't delete bookmark: {e}").format(e=e), error=True)
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
@ -110,9 +109,7 @@ class BookmarksRemove(base.CommandBase):
class BookmarksSet(base.CommandBase):
def __init__(self, host):
super().__init__(
host, "set", help=_("add or update a bookmark")
)
super().__init__(host, "set", help=_("add or update a bookmark"))
def add_parser_options(self):
self.parser.add_argument("bookmark", help=_("jid of the chat room"))
@ -133,18 +130,16 @@ class BookmarksSet(base.CommandBase):
help=_("join the conference room"),
)
self.parser.add_argument(
"-N",
"--nick", help=_("preferred roomnick for the chatroom")
"-N", "--nick", help=_("preferred roomnick for the chatroom")
)
self.parser.add_argument(
"-P",
"--password", help=_("password used to access the chatroom")
"-P", "--password", help=_("password used to access the chatroom")
)
self.parser.add_argument(
"-u",
"--update",
action="store_true",
help=_("update bookmark data instead of replacing")
help=_("update bookmark data instead of replacing"),
)
async def start(self):
@ -167,7 +162,7 @@ class BookmarksSet(base.CommandBase):
self.disp(
f"Can't find existing bookmark {self.args.bookmark!r}: {e}. We "
"create it.",
error=True
error=True,
)
else:
old_conference_data.update(conference_data)
@ -190,6 +185,4 @@ class Bookmarks(base.CommandBase):
subcommands = (BookmarksList, BookmarksSet, BookmarksRemove, BookmarksLegacy)
def __init__(self, host):
super().__init__(
host, "bookmarks", use_profile=False, help=_("manage bookmarks")
)
super().__init__(host, "bookmarks", use_profile=False, help=_("manage bookmarks"))