Style improvements

This adds a blank line and makes Completer arguments keyword-only to make their
meaning more clear.
This commit is contained in:
Florian Bruhin 2017-12-03 22:32:17 +01:00
parent 9dfff43d99
commit a137a29cce
4 changed files with 6 additions and 3 deletions

View File

@ -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

View File

@ -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.
"""

View File

@ -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',

View File

@ -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)