From d9247c15a4172d812b3a51b8b2b10df294dba16e Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Tue, 26 Jul 2016 09:48:35 -0400 Subject: [PATCH] Coding style fixes --- qutebrowser/browser/commands.py | 7 +++---- qutebrowser/browser/urlmarks.py | 9 +++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index f86faa0da..3b0e0bc51 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1120,7 +1120,6 @@ class CommandDispatcher: raise cmdexc.CommandError("Quickmark '{}' not found!".format(name)) @cmdutils.register(instance='command-dispatcher', scope='window') - @cmdutils.argument('toggle', flag='t') def bookmark_add(self, url=None, title=None, toggle=False): """Save the current page as a bookmark, or a specific url. @@ -1152,13 +1151,13 @@ class CommandDispatcher: if not title: title = self._current_title() try: - if_added = bookmark_manager.add(url, title, toggle) + was_added = bookmark_manager.add(url, title, toggle=toggle) except urlmarks.Error as e: raise cmdexc.CommandError(str(e)) else: - mes = "Bookmarked {}!" if if_added else "Removed bookmark {}!" + msg = "Bookmarked {}!" if was_added else "Removed bookmark {}!" message.info(self._win_id, - mes.format(url.toDisplayString())) + msg.format(url.toDisplayString())) @cmdutils.register(instance='command-dispatcher', scope='window', maxsplit=0) diff --git a/qutebrowser/browser/urlmarks.py b/qutebrowser/browser/urlmarks.py index 9889c8536..4280f0cd9 100644 --- a/qutebrowser/browser/urlmarks.py +++ b/qutebrowser/browser/urlmarks.py @@ -272,17 +272,18 @@ class BookmarkManager(UrlMarkManager): elif len(parts) == 1: self.marks[parts[0]] = '' - def add(self, url, title, toggle=False): + def add(self, url, title, *, toggle=False): """Add a new bookmark. - Return True if the bookmark was added, and False if it was - removed (which only happens if toggle is True). - Args: url: The url to add as bookmark. title: The title for the new bookmark. toggle: remove the bookmark instead of raising an error if it already exists. + + Return: + True if the bookmark was added, and False if it was + removed (only possible if toggle is True). """ if not url.isValid(): errstr = urlutils.get_errstring(url)