Adjust ignores/settings after mypy upgrade

See #7478, #7098
This commit is contained in:
Florian Bruhin 2022-11-14 21:21:01 +01:00
parent 7bf1b4af5d
commit b8ddaef967
5 changed files with 9 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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

View File

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