Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Compiler committed Jun 22, 2020
1 parent 031829c commit 72bb403
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion doc/qutebrowser.1.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ show it.
Which backend to use.

*--enable-webengine-inspector*::
Enable the web inspector / devtools for QtWebEngine. Note that this is a SECURITY RISK and you should not visit untrusted websites with the inspector turned on. See https://bugreports.qt.io/browse/QTBUG-50725 for moredetails. This is not needed anymore since Qt 5.11where the inspector is always enabled and secure.
Enable the web inspector / devtools for QtWebEngine. Note that this is a SECURITY RISK and you should not visit untrusted websites with the inspector turned on. See https://bugreports.qt.io/browse/QTBUG-50725 for more details. This is not needed anymore since Qt 5.11 where the inspector is always enabled and secure.

=== debug arguments
*-l* '{critical,error,warning,info,debug,vdebug}', *--loglevel* '{critical,error,warning,info,debug,vdebug}'::
Expand Down
6 changes: 3 additions & 3 deletions qutebrowser/browser/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@

from qutebrowser.commands import userscripts, runners
from qutebrowser.api import cmdutils
from qutebrowser.config import config, configdata, configfiles
from qutebrowser.browser import (urlmarks, browsertab, inspector, navigate,
webelem, downloads)
from qutebrowser.config import config, configdata
from qutebrowser.browser import (urlmarks, browsertab, navigate, webelem,
downloads)
from qutebrowser.keyinput import modeman, keyutils
from qutebrowser.utils import (message, usertypes, log, qtutils, urlutils,
objreg, utils, standarddir, debug)
Expand Down
6 changes: 3 additions & 3 deletions qutebrowser/browser/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@
import typing
import enum

from PyQt5.QtWidgets import QWidget, QVBoxLayout
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QEvent
from PyQt5.QtWidgets import QWidget
from PyQt5.QtCore import pyqtSlot, QObject, QEvent
from PyQt5.QtGui import QCloseEvent

from qutebrowser.browser import eventfilter
from qutebrowser.config import configfiles
from qutebrowser.utils import log, usertypes
from qutebrowser.keyinput import modeman
from qutebrowser.misc import miscwidgets, objects
from qutebrowser.api import cmdutils


def create(*, splitter: 'miscwidgets.InspectorSplitter',
Expand Down Expand Up @@ -220,5 +219,6 @@ def inspect(self, page: QWidget) -> None:

@pyqtSlot()
def shutdown(self) -> None:
"""Clean up the inspector."""
self.close()
self.deleteLater()
18 changes: 12 additions & 6 deletions qutebrowser/completion/models/miscmodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import typing

from qutebrowser.config import config, configdata
from qutebrowser.utils import objreg, log
from qutebrowser.utils import objreg, log, utils
from qutebrowser.completion.models import completionmodel, listcategory, util
from qutebrowser.browser import inspector

Expand Down Expand Up @@ -50,7 +50,7 @@ def helptopic(*, info):
return model


def quickmark(*, info=None): # pylint: disable=unused-argument
def quickmark(*, info=None):
"""A CompletionModel filled with all quickmarks."""
def delete(data: typing.Sequence[str]) -> None:
"""Delete a quickmark from the completion menu."""
Expand All @@ -59,6 +59,7 @@ def delete(data: typing.Sequence[str]) -> None:
log.completion.debug('Deleting quickmark {}'.format(name))
quickmark_manager.delete(name)

utils.unused(info)
model = completionmodel.CompletionModel(column_widths=(30, 70, 0))
marks = objreg.get('quickmark-manager').marks.items()
model.add_category(listcategory.ListCategory('Quickmarks', marks,
Expand All @@ -67,7 +68,7 @@ def delete(data: typing.Sequence[str]) -> None:
return model


def bookmark(*, info=None): # pylint: disable=unused-argument
def bookmark(*, info=None):
"""A CompletionModel filled with all bookmarks."""
def delete(data: typing.Sequence[str]) -> None:
"""Delete a bookmark from the completion menu."""
Expand All @@ -76,6 +77,7 @@ def delete(data: typing.Sequence[str]) -> None:
bookmark_manager = objreg.get('bookmark-manager')
bookmark_manager.delete(urlstr)

utils.unused(info)
model = completionmodel.CompletionModel(column_widths=(30, 70, 0))
marks = objreg.get('bookmark-manager').marks.items()
model.add_category(listcategory.ListCategory('Bookmarks', marks,
Expand All @@ -84,9 +86,10 @@ def delete(data: typing.Sequence[str]) -> None:
return model


def session(*, info=None): # pylint: disable=unused-argument
def session(*, info=None):
"""A CompletionModel filled with session names."""
from qutebrowser.misc import sessions
utils.unused(info)
model = completionmodel.CompletionModel()
try:
sess = ((name,) for name
Expand Down Expand Up @@ -152,11 +155,12 @@ def delete_buffer(data):
return model


def buffer(*, info=None): # pylint: disable=unused-argument
def buffer(*, info=None):
"""A model to complete on open tabs across all windows.
Used for switching the buffer command.
"""
utils.unused(info)
return _buffer()


Expand Down Expand Up @@ -206,7 +210,9 @@ def window(*, info):

def inspector_position(*, info):
"""A model for possible inspector positions."""
utils.unused(info)
model = completionmodel.CompletionModel(column_widths=(100, 0, 0))
positions = [(e.name,) for e in inspector.Position]
model.add_category(listcategory.ListCategory("Position (optional)", positions))
category = listcategory.ListCategory("Position (optional)", positions)
model.add_category(category)
return model
2 changes: 2 additions & 0 deletions qutebrowser/misc/miscwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ def addItem(self, _widget):
raise utils.Unreachable

def sizeHint(self):
"""Get the size of the underlying widget."""
if self._widget is None:
return QSize()
return self._widget.sizeHint()
Expand All @@ -257,6 +258,7 @@ def takeAt(self, _index):
raise utils.Unreachable

def setGeometry(self, rect):
"""Pass through setGeometry calls to the underlying widget."""
if self._widget is None:
return
self._widget.setGeometry(rect)
Expand Down
4 changes: 2 additions & 2 deletions qutebrowser/qutebrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def get_argparser():
"QtWebEngine. Note that this is a SECURITY RISK and "
"you should not visit untrusted websites with the "
"inspector turned on. See "
"https://bugreports.qt.io/browse/QTBUG-50725 for more"
"details. This is not needed anymore since Qt 5.11"
"https://bugreports.qt.io/browse/QTBUG-50725 for more "
"details. This is not needed anymore since Qt 5.11 "
"where the inspector is always enabled and secure.")

parser.add_argument('--json-args', help=argparse.SUPPRESS)
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/browser/test_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@

import pytest

from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget, QApplication
from PyQt5.QtWidgets import QWidget

from qutebrowser.browser import inspector
from qutebrowser.misc import miscwidgets
from qutebrowser.utils import usertypes


class FakeInspector(inspector.AbstractWebInspector):
Expand Down

0 comments on commit 72bb403

Please sign in to comment.