From 01ccbc679d05adf9fd193f1688d76c1170865a17 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 7 Feb 2018 22:26:32 +0100 Subject: [PATCH] Fix lint --- qutebrowser/browser/commands.py | 2 +- qutebrowser/misc/editor.py | 9 +++------ tests/end2end/features/test_editor_bdd.py | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 094563bcc..da5ccbc89 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1639,7 +1639,7 @@ class CommandDispatcher: def on_file_updated(self, elem, text): """Write the editor text into the form field and clean up tempfile. - Callback for GUIProcess when the editor was closed. + Callback for GUIProcess when the edited text was updated. Args: elem: The WebElementWrapper which was modified. diff --git a/qutebrowser/misc/editor.py b/qutebrowser/misc/editor.py index 9565ce28b..db7d3e3e2 100644 --- a/qutebrowser/misc/editor.py +++ b/qutebrowser/misc/editor.py @@ -51,10 +51,7 @@ class ExternalEditor(QObject): self._filename = None self._proc = None self._remove_file = None - if watch: - self._watcher = QFileSystemWatcher(parent=self) - else: - self._watcher = None + self._watcher = QFileSystemWatcher(parent=self) if watch else None self._content = None def _cleanup(self): @@ -125,10 +122,10 @@ class ExternalEditor(QObject): line, column = self._calc_line_and_column(text, caret_position) self._start_editor(line=line, column=column) + @pyqtSlot(str) def _on_file_changed(self, path): - encoding = config.val.editor.encoding try: - with open(path, 'r', encoding=encoding) as f: + with open(path, 'r', encoding=config.val.editor.encoding) as f: text = f.read() except OSError as e: # NOTE: Do not replace this with "raise CommandError" as it's diff --git a/tests/end2end/features/test_editor_bdd.py b/tests/end2end/features/test_editor_bdd.py index 4e480b85d..12de7c92c 100644 --- a/tests/end2end/features/test_editor_bdd.py +++ b/tests/end2end/features/test_editor_bdd.py @@ -84,7 +84,7 @@ def set_up_editor_wait(quteproc, tmpdir, text): import time import signal - def handle(sig, frame): + def handle(sig, _frame): with open(sys.argv[1], 'w', encoding='utf-8') as f: f.write({text!r}) if sig == signal.SIGUSR1: