mypy: Install more typeshed types

This commit is contained in:
Florian Bruhin 2023-06-30 00:49:30 +02:00
parent a6d4227578
commit 904cab911d
5 changed files with 13 additions and 11 deletions

View File

@ -29,18 +29,10 @@ pretty = True
### FIXME:v4 get rid of this
no_implicit_optional = False
[mypy-colorama]
# https://github.com/tartley/colorama/issues/206
ignore_missing_imports = True
[mypy-hunter]
# https://github.com/ionelmc/python-hunter/issues/43
ignore_missing_imports = True
[mypy-pygments.*]
# https://github.com/pygments/pygments/issues/1189
ignore_missing_imports = True
[mypy-objc]
# https://github.com/ronaldoussoren/pyobjc/issues/417
ignore_missing_imports = True

View File

@ -14,6 +14,10 @@ Pygments==2.15.1
PyQt5-stubs==5.15.6.0
tomli==2.0.1
PyQt6-stubs @ git+https://github.com/python-qt-tools/PyQt6-stubs.git@f623a641cd5cdff53342177e4fbbf9cae8172336
types-colorama==0.4.15.11
types-docutils==0.20.0.1
types-Pygments==2.15.0.1
types-PyYAML==6.0.12.10
typing_extensions==4.6.3
zipp==3.15.0
types-setuptools==68.0.0.0

View File

@ -5,6 +5,8 @@ diff-cover
PyQt5-stubs
git+https://github.com/python-qt-tools/PyQt6-stubs.git
types-PyYAML
types-colorama
types-Pygments
# So stubs are available even on newer Python versions
importlib_resources

View File

@ -33,14 +33,14 @@ import json
import inspect
import argparse
from typing import (TYPE_CHECKING, Any, Iterator, Mapping, MutableSequence,
Optional, Set, Tuple, Union)
Optional, Set, Tuple, Union, TextIO, cast)
from qutebrowser.qt import core as qtcore
# Optional imports
try:
import colorama
except ImportError:
colorama = None
colorama = None # type: ignore[assignment]
if TYPE_CHECKING:
from qutebrowser.config import config as configmodule
@ -279,7 +279,7 @@ def _init_handlers(
else:
strip = False if force_color else None
if use_colorama:
stream = colorama.AnsiToWin32(sys.stderr, strip=strip)
stream = cast(TextIO, colorama.AnsiToWin32(sys.stderr, strip=strip))
else:
stream = sys.stderr
console_handler = logging.StreamHandler(stream)

View File

@ -25,6 +25,10 @@
"hypothesis": "https://hypothesis.readthedocs.io/en/latest/changes.html",
"mypy": "https://mypy-lang.blogspot.com/",
"types-PyYAML": "https://github.com/python/typeshed/commits/main/stubs/PyYAML",
"types-colorama": "https://github.com/python/typeshed/commits/main/stubs/colorama",
"types-docutils": "https://github.com/python/typeshed/commits/main/stubs/docutils",
"types-Pygments": "https://github.com/python/typeshed/commits/main/stubs/Pygments",
"types-setuptools": "https://github.com/python/typeshed/commits/main/stubs/setuptools",
"pytest": "https://docs.pytest.org/en/latest/changelog.html",
"iniconfig": "https://github.com/pytest-dev/iniconfig/blob/master/CHANGELOG",
"tox": "https://tox.readthedocs.io/en/latest/changelog.html",