mypy: Disallow incomplete defs globally
This commit is contained in:
parent
e25a96de94
commit
3679d3a05b
20
mypy.ini
20
mypy.ini
|
|
@ -9,8 +9,7 @@ warn_unused_configs = True
|
|||
disallow_subclassing_any = True
|
||||
# disallow_untyped_calls = True
|
||||
# disallow_untyped_defs = True
|
||||
## https://github.com/python/mypy/issues/5954
|
||||
# disallow_incomplete_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
check_untyped_defs = True
|
||||
disallow_untyped_decorators = True
|
||||
# no_implicit_optional = True
|
||||
|
|
@ -66,68 +65,51 @@ disallow_subclassing_any = False
|
|||
|
||||
[mypy-qutebrowser.browser.browsertab]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.browser.hints]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.misc.objects]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.misc.debugcachestats]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.misc.utilcmds]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.misc.throttle]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.misc.backendproblem]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.config.*]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.api.*]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.components.*]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.extensions.*]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.browser.webelem]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.browser.webkit.webkitelem]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.browser.webengine.webengineelem]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.keyinput.*]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.utils.*]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.mainwindow.statusbar.command]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ class CommandDispatcher:
|
|||
else:
|
||||
return None
|
||||
|
||||
def _tab_focus_stack(self, mode: str, *, show_error=True):
|
||||
def _tab_focus_stack(self, mode: str, *, show_error: bool = True) -> None:
|
||||
"""Select the tab which was last focused."""
|
||||
tab_deque = self._tabbed_browser.tab_deque
|
||||
cur_tab = self._cntwidget()
|
||||
|
|
|
|||
|
|
@ -860,7 +860,7 @@ class AbstractDownloadManager(QObject):
|
|||
self.data_changed.emit(-1)
|
||||
|
||||
@pyqtSlot(str, QUrl)
|
||||
def _on_pdfjs_requested(self, filename: str, original_url: QUrl):
|
||||
def _on_pdfjs_requested(self, filename: str, original_url: QUrl) -> None:
|
||||
"""Open PDF.js when a download requests it."""
|
||||
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
||||
window='last-focused')
|
||||
|
|
|
|||
|
|
@ -132,7 +132,10 @@ class DownloadView(QListView):
|
|||
item.open_file()
|
||||
item.remove()
|
||||
|
||||
def _get_menu_actions(self, item) -> _ActionListType:
|
||||
def _get_menu_actions(
|
||||
self,
|
||||
item: downloads.AbstractDownloadItem
|
||||
) -> _ActionListType:
|
||||
"""Get the available context menu actions for a given DownloadItem.
|
||||
|
||||
Args:
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import os.path
|
|||
import urllib
|
||||
import functools
|
||||
|
||||
from PyQt5.QtCore import pyqtSlot, Qt, QUrl
|
||||
from PyQt5.QtCore import pyqtSlot, Qt, QUrl, QObject
|
||||
from PyQt5.QtWebEngineWidgets import QWebEngineDownloadItem
|
||||
|
||||
from qutebrowser.browser import downloads, pdfjs
|
||||
|
|
@ -39,7 +39,8 @@ class DownloadItem(downloads.AbstractDownloadItem):
|
|||
_qt_item: The wrapped item.
|
||||
"""
|
||||
|
||||
def __init__(self, qt_item: QWebEngineDownloadItem, parent=None):
|
||||
def __init__(self, qt_item: QWebEngineDownloadItem,
|
||||
parent: QObject = None) -> None:
|
||||
super().__init__(parent)
|
||||
self._qt_item = qt_item
|
||||
qt_item.downloadProgress.connect( # type: ignore[attr-defined]
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ class CommandRunner(AbstractCommandRunner):
|
|||
self._win_id = win_id
|
||||
|
||||
@contextlib.contextmanager
|
||||
def _handle_error(self, safely) -> typing.Iterator[None]:
|
||||
def _handle_error(self, safely: bool) -> typing.Iterator[None]:
|
||||
"""Show exceptions as errors if safely=True is given."""
|
||||
try:
|
||||
yield
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class TabDeque:
|
|||
self._ignore_next = True
|
||||
return tab
|
||||
|
||||
def next(self, cur_tab: QWidget, *, keep_overflow=True) -> QWidget:
|
||||
def next(self, cur_tab: QWidget, *, keep_overflow: bool = True) -> QWidget:
|
||||
"""Get the 'next' tab in the stack.
|
||||
|
||||
Throws IndexError on failure.
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ class TabWidget(QTabWidget):
|
|||
if config.val.tabs.tabs_are_windows:
|
||||
self.window().setWindowIcon(self.window().windowIcon())
|
||||
|
||||
def setTabIcon(self, idx: int, icon: QIcon):
|
||||
def setTabIcon(self, idx: int, icon: QIcon) -> None:
|
||||
"""Always show tab icons for pinned tabs in some circumstances."""
|
||||
tab = typing.cast(typing.Optional[browsertab.AbstractTab],
|
||||
self.widget(idx))
|
||||
|
|
|
|||
|
|
@ -587,7 +587,7 @@ def session_save(name: ArgType = default, *,
|
|||
|
||||
@cmdutils.register()
|
||||
@cmdutils.argument('name', completion=miscmodels.session)
|
||||
def session_delete(name, *, force: bool = False) -> None:
|
||||
def session_delete(name: str, *, force: bool = False) -> None:
|
||||
"""Delete a session.
|
||||
|
||||
Args:
|
||||
|
|
|
|||
Loading…
Reference in New Issue