From fb3da578c56b3b33aaee4cd8d92a5767995cfcdc Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 9 Aug 2016 17:28:14 +0200 Subject: [PATCH] Fix lint --- qutebrowser/browser/commands.py | 5 ++--- qutebrowser/browser/hints.py | 2 +- qutebrowser/browser/navigate.py | 2 +- qutebrowser/browser/webengine/webenginesettings.py | 8 ++++++++ qutebrowser/browser/webkit/webkitsettings.py | 8 ++++++++ qutebrowser/config/configdata.py | 2 +- qutebrowser/config/configtypes.py | 4 ++-- qutebrowser/misc/earlyinit.py | 8 ++++---- tests/end2end/features/test_downloads_bdd.py | 1 + tests/end2end/test_smoke.py | 1 + tests/unit/browser/webkit/test_webkitelem.py | 1 + tests/unit/completion/test_completer.py | 10 +++++----- tests/unit/completion/test_sortfilter.py | 1 + tests/unit/config/test_config.py | 2 +- 14 files changed, 37 insertions(+), 18 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index f858247ac..12f513e50 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1185,14 +1185,13 @@ class CommandDispatcher: current page's url. """ if url is None: - url = self._current_url().toString(QUrl.RemovePassword - | QUrl.FullyEncoded) + url = self._current_url().toString(QUrl.RemovePassword | + QUrl.FullyEncoded) try: objreg.get('bookmark-manager').delete(url) except KeyError: raise cmdexc.CommandError("Bookmark '{}' not found!".format(url)) - @cmdutils.register(instance='command-dispatcher', hide=True, scope='window') def follow_selected(self, *, tab=False): diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 062ce794b..7ffa634eb 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -761,7 +761,7 @@ class HintManager(QObject): only_visible=True) def current_mode(self): - """Returns the currently active hinting mode (or None otherwise).""" + """Return the currently active hinting mode (or None otherwise).""" if self._context is None: return None diff --git a/qutebrowser/browser/navigate.py b/qutebrowser/browser/navigate.py index 235cb0a7a..86e7eeb77 100644 --- a/qutebrowser/browser/navigate.py +++ b/qutebrowser/browser/navigate.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -"""Implementation of :navigate""" +"""Implementation of :navigate.""" import posixpath diff --git a/qutebrowser/browser/webengine/webenginesettings.py b/qutebrowser/browser/webengine/webenginesettings.py index 2cde8fb1f..5c93bae49 100644 --- a/qutebrowser/browser/webengine/webenginesettings.py +++ b/qutebrowser/browser/webengine/webenginesettings.py @@ -36,22 +36,30 @@ from qutebrowser.utils import objreg, utils class Attribute(websettings.Attribute): + """A setting set via QWebEngineSettings::setAttribute.""" + GLOBAL_SETTINGS = QWebEngineSettings.globalSettings ENUM_BASE = QWebEngineSettings class Setter(websettings.Setter): + """A setting set via QWebEngineSettings getter/setter methods.""" + GLOBAL_SETTINGS = QWebEngineSettings.globalSettings class NullStringSetter(websettings.NullStringSetter): + """A setter for settings requiring a null QString as default.""" + GLOBAL_SETTINGS = QWebEngineSettings.globalSettings class StaticSetter(websettings.StaticSetter): + """A setting set via static QWebEngineSettings getter/setter methods.""" + GLOBAL_SETTINGS = QWebEngineSettings.globalSettings diff --git a/qutebrowser/browser/webkit/webkitsettings.py b/qutebrowser/browser/webkit/webkitsettings.py index 0e8170231..d5af1dfd9 100644 --- a/qutebrowser/browser/webkit/webkitsettings.py +++ b/qutebrowser/browser/webkit/webkitsettings.py @@ -34,22 +34,30 @@ from qutebrowser.utils import standarddir, objreg class Attribute(websettings.Attribute): + """A setting set via QWebSettings::setAttribute.""" + GLOBAL_SETTINGS = QWebSettings.globalSettings ENUM_BASE = QWebSettings class Setter(websettings.Setter): + """A setting set via QWebSettings getter/setter methods.""" + GLOBAL_SETTINGS = QWebSettings.globalSettings class NullStringSetter(websettings.NullStringSetter): + """A setter for settings requiring a null QString as default.""" + GLOBAL_SETTINGS = QWebSettings.globalSettings class StaticSetter(websettings.StaticSetter): + """A setting set via static QWebSettings getter/setter methods.""" + GLOBAL_SETTINGS = QWebSettings.globalSettings diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index a41249d75..6837ed70a 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -1270,7 +1270,7 @@ def data(readonly=False): "Font used in the completion widget."), ('completion.category', - SettingValue(typ.Font(), 'bold ${completion}'), + SettingValue(typ.Font(), 'bold ${completion}'), "Font used in the completion categories."), ('tabbar', diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index 398a5c9bc..e2c0ef1d6 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -125,11 +125,11 @@ class BaseType: self.valid_values = None def get_name(self): - """Get a name for the type for documentation""" + """Get a name for the type for documentation.""" return self.__class__.__name__ def get_valid_values(self): - """Get the type's valid values for documentation""" + """Get the type's valid values for documentation.""" return self.valid_values def _basic_validation(self, value): diff --git a/qutebrowser/misc/earlyinit.py b/qutebrowser/misc/earlyinit.py index 284478866..bda57b35c 100644 --- a/qutebrowser/misc/earlyinit.py +++ b/qutebrowser/misc/earlyinit.py @@ -60,11 +60,11 @@ def _missing_str(name, *, windows=None, pip=None, webengine=False): blocks.append('
'.join(lines)) if webengine: lines = [ - 'Note QtWebEngine is not available for some distributions ' + ('Note QtWebEngine is not available for some distributions ' '(like Debian/Ubuntu), so you need to start without ' - '--backend webengine there.', - 'QtWebEngine is currently unsupported with the OS X .app, see ' - 'https://github.com/The-Compiler/qutebrowser/issues/1692', + '--backend webengine there.'), + ('QtWebEngine is currently unsupported with the OS X .app, see ' + 'https://github.com/The-Compiler/qutebrowser/issues/1692'), ] else: lines = ['If you installed a qutebrowser package for your ' diff --git a/tests/end2end/features/test_downloads_bdd.py b/tests/end2end/features/test_downloads_bdd.py index 0f810a6c3..1c0e2379c 100644 --- a/tests/end2end/features/test_downloads_bdd.py +++ b/tests/end2end/features/test_downloads_bdd.py @@ -77,6 +77,7 @@ def download_open(quteproc): cmd = '{} -c pass'.format(shlex.quote(sys.executable)) quteproc.send_cmd(':download-open {}'.format(cmd)) + @bdd.when("I directly open the download") def download_open_with_prompt(quteproc): cmd = '{} -c pass'.format(shlex.quote(sys.executable)) diff --git a/tests/end2end/test_smoke.py b/tests/end2end/test_smoke.py index 1a579cc02..1e27cf13f 100644 --- a/tests/end2end/test_smoke.py +++ b/tests/end2end/test_smoke.py @@ -26,6 +26,7 @@ import signal import pytest + @pytest.mark.parametrize('cmd', [':quit', ':later 500 quit']) def test_smoke(cmd, capfd): if hasattr(sys, 'frozen'): diff --git a/tests/unit/browser/webkit/test_webkitelem.py b/tests/unit/browser/webkit/test_webkitelem.py index ea613699e..278f7834d 100644 --- a/tests/unit/browser/webkit/test_webkitelem.py +++ b/tests/unit/browser/webkit/test_webkitelem.py @@ -221,6 +221,7 @@ class TestSelectorsAndFilters: elems = [e for e in elems if filterfunc(e)] assert bool(elems) == matching + class TestWebKitElement: """Generic tests for WebKitElement. diff --git a/tests/unit/completion/test_completer.py b/tests/unit/completion/test_completer.py index f3567674e..d7500af80 100644 --- a/tests/unit/completion/test_completer.py +++ b/tests/unit/completion/test_completer.py @@ -96,30 +96,30 @@ def cmdutils_patch(monkeypatch, stubs): @cmdutils.argument('option', completion=usertypes.Completion.option) @cmdutils.argument('value', completion=usertypes.Completion.value) def set_command(section_=None, option=None, value=None): - """docstring!""" + """docstring.""" pass @cmdutils.argument('topic', completion=usertypes.Completion.helptopic) def show_help(tab=False, bg=False, window=False, topic=None): - """docstring!""" + """docstring.""" pass @cmdutils.argument('url', completion=usertypes.Completion.url) @cmdutils.argument('count', count=True) def openurl(url=None, implicit=False, bg=False, tab=False, window=False, count=None): - """docstring!""" + """docstring.""" pass @cmdutils.argument('win_id', win_id=True) @cmdutils.argument('command', completion=usertypes.Completion.command) def bind(key, win_id, command=None, *, mode='normal', force=False): - """docstring!""" + """docstring.""" # pylint: disable=unused-variable pass def tab_detach(): - """docstring!""" + """docstring.""" pass cmds = { diff --git a/tests/unit/completion/test_sortfilter.py b/tests/unit/completion/test_sortfilter.py index c63d08ed5..e3ae69146 100644 --- a/tests/unit/completion/test_sortfilter.py +++ b/tests/unit/completion/test_sortfilter.py @@ -59,6 +59,7 @@ def _extract_model_data(model): data.append(row) return data + @pytest.mark.parametrize('pattern, data, expected', [ ('foo', 'barfoobar', True), ('foo', 'barFOObar', True), diff --git a/tests/unit/config/test_config.py b/tests/unit/config/test_config.py index f2a6a79f1..e995e2690 100644 --- a/tests/unit/config/test_config.py +++ b/tests/unit/config/test_config.py @@ -283,7 +283,7 @@ class TestKeyConfigParser: ('download-remove --all', 'download-clear'), ('hint links fill ":open {hint-url}"', - 'hint links fill :open {hint-url}'), + 'hint links fill :open {hint-url}'), ('hint links fill ":open -t {hint-url}"', 'hint links fill :open -t {hint-url}'),