From a137a29ccea17fa0228e339182b656ed63090e27 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 3 Dec 2017 22:32:17 +0100 Subject: [PATCH] Style improvements This adds a blank line and makes Completer arguments keyword-only to make their meaning more clear. --- qutebrowser/completion/completer.py | 2 +- qutebrowser/completion/models/miscmodels.py | 1 + qutebrowser/mainwindow/mainwindow.py | 3 ++- tests/unit/completion/test_completer.py | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/qutebrowser/completion/completer.py b/qutebrowser/completion/completer.py index 15c5d7f14..edb1aca97 100644 --- a/qutebrowser/completion/completer.py +++ b/qutebrowser/completion/completer.py @@ -52,7 +52,7 @@ class Completer(QObject): _last_completion_func: The completion function used for the last text. """ - def __init__(self, cmd, win_id, parent=None): + def __init__(self, *, cmd, win_id, parent=None): super().__init__(parent) self._cmd = cmd self._win_id = win_id diff --git a/qutebrowser/completion/models/miscmodels.py b/qutebrowser/completion/models/miscmodels.py index 6175dcfb4..b1e599798 100644 --- a/qutebrowser/completion/models/miscmodels.py +++ b/qutebrowser/completion/models/miscmodels.py @@ -96,6 +96,7 @@ def session(*, info=None): # pylint: disable=unused-argument def _buffer(skip_win_id=None): """Helper to get the completion model for buffer/other_buffer. + Args: skip_win_id: The id of the window to skip, or None to include all. """ diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 5acec2384..7c35f0529 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -320,7 +320,8 @@ class MainWindow(QWidget): def _init_completion(self): self._completion = completionwidget.CompletionView(self.win_id, self) cmd = objreg.get('status-command', scope='window', window=self.win_id) - completer_obj = completer.Completer(cmd, self.win_id, self._completion) + completer_obj = completer.Completer(cmd=cmd, win_id=self.win_id, + parent=self._completion) self._completion.selection_changed.connect( completer_obj.on_selection_changed) objreg.register('completion', self._completion, scope='window', diff --git a/tests/unit/completion/test_completer.py b/tests/unit/completion/test_completer.py index 0e8aabb93..012122937 100644 --- a/tests/unit/completion/test_completer.py +++ b/tests/unit/completion/test_completer.py @@ -65,7 +65,8 @@ def completer_obj(qtbot, status_command_stub, config_stub, monkeypatch, stubs, """Create the completer used for testing.""" monkeypatch.setattr(completer, 'QTimer', stubs.InstaTimer) config_stub.val.completion.show = 'auto' - return completer.Completer(status_command_stub, 0, completion_widget_stub) + return completer.Completer(cmd=status_command_stub, win_id=0, + parent=completion_widget_stub) @pytest.fixture(autouse=True)