diff options
author | Florian Bruhin <me@the-compiler.org> | 2022-11-14 21:21:01 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2022-11-14 21:21:01 +0100 |
commit | b8ddaef967700fb581e6150b72ec990edb9abafa (patch) | |
tree | 6e78075a12faeec4e6b8148347458edfa3ebbc72 | |
parent | 7bf1b4af5d8882a8576787dbf98c7013061a2714 (diff) | |
download | qutebrowser-b8ddaef967700fb581e6150b72ec990edb9abafa.tar.gz qutebrowser-b8ddaef967700fb581e6150b72ec990edb9abafa.zip |
Adjust ignores/settings after mypy upgrade
See #7478, #7098
-rw-r--r-- | .mypy.ini | 4 | ||||
-rw-r--r-- | qutebrowser/api/cmdutils.py | 2 | ||||
-rw-r--r-- | qutebrowser/misc/checkpyver.py | 4 | ||||
-rw-r--r-- | qutebrowser/utils/objreg.py | 2 | ||||
-rw-r--r-- | qutebrowser/utils/utils.py | 2 |
5 files changed, 9 insertions, 5 deletions
@@ -10,7 +10,6 @@ disallow_subclassing_any = True disallow_incomplete_defs = True check_untyped_defs = True disallow_untyped_decorators = True -# no_implicit_optional = True warn_redundant_casts = True warn_unused_ignores = True # warn_return_any = True @@ -27,6 +26,9 @@ show_error_codes = True show_error_context = True pretty = True +### FIXME:qt6 get rid of this for v3 +no_implicit_optional = False + [mypy-colorama] # https://github.com/tartley/colorama/issues/206 ignore_missing_imports = True diff --git a/qutebrowser/api/cmdutils.py b/qutebrowser/api/cmdutils.py index 73c6a1bc5..3e1bc9432 100644 --- a/qutebrowser/api/cmdutils.py +++ b/qutebrowser/api/cmdutils.py @@ -233,7 +233,7 @@ class argument: # noqa: N801,N806 pylint: disable=invalid-name self._argname)) if not hasattr(func, 'qute_args'): func.qute_args = {} # type: ignore[attr-defined] - elif func.qute_args is None: # type: ignore[attr-defined] + elif func.qute_args is None: raise ValueError("@cmdutils.argument got called above (after) " "@cmdutils.register for {}!".format(funcname)) diff --git a/qutebrowser/misc/checkpyver.py b/qutebrowser/misc/checkpyver.py index 7d6a524c3..82fe3d70f 100644 --- a/qutebrowser/misc/checkpyver.py +++ b/qutebrowser/misc/checkpyver.py @@ -49,7 +49,9 @@ def check_python_version(): version_str = '.'.join(map(str, sys.version_info[:3])) text = ("At least Python 3.7 is required to run qutebrowser, but " + "it's running with " + version_str + ".\n") - if Tk and '--no-err-windows' not in sys.argv: # pragma: no cover + + show_errors = '--no-err-windows' not in sys.argv + if Tk and show_errors: # type: ignore[truthy-function] # pragma: no cover root = Tk() root.withdraw() messagebox.showerror("qutebrowser: Fatal error!", text) diff --git a/qutebrowser/utils/objreg.py b/qutebrowser/utils/objreg.py index c3cdb1071..78d862ab4 100644 --- a/qutebrowser/utils/objreg.py +++ b/qutebrowser/utils/objreg.py @@ -170,7 +170,7 @@ def _get_tab_registry(win_id: _WindowTab, window: Optional[QWidget] = QApplication.activeWindow() if window is None or not hasattr(window, 'win_id'): raise RegistryUnavailableError('tab') - win_id = window.win_id # type: ignore[attr-defined] + win_id = window.win_id elif win_id is None: raise TypeError("window is None with scope tab!") diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py index 704fcdb75..0c5074e3e 100644 --- a/qutebrowser/utils/utils.py +++ b/qutebrowser/utils/utils.py @@ -55,7 +55,7 @@ try: CSafeDumper as YamlDumper) YAML_C_EXT = True except ImportError: # pragma: no cover - from yaml import (SafeLoader as YamlLoader, # type: ignore[misc] + from yaml import (SafeLoader as YamlLoader, # type: ignore[assignment] SafeDumper as YamlDumper) YAML_C_EXT = False |