summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2023-06-30 00:49:30 +0200
committerFlorian Bruhin <me@the-compiler.org>2023-06-30 00:49:30 +0200
commit904cab911d664b92cfb2abb5f569a3a35ca39e29 (patch)
tree4ed2bef94817c45ae69d2126defb5eaaa5a20dba
parenta6d42275781c45f2f050dd72d2f0f7615502381b (diff)
downloadqutebrowser-904cab911d664b92cfb2abb5f569a3a35ca39e29.tar.gz
qutebrowser-904cab911d664b92cfb2abb5f569a3a35ca39e29.zip
mypy: Install more typeshed types
-rw-r--r--.mypy.ini8
-rw-r--r--misc/requirements/requirements-mypy.txt4
-rw-r--r--misc/requirements/requirements-mypy.txt-raw2
-rw-r--r--qutebrowser/utils/log.py6
-rw-r--r--scripts/dev/changelog_urls.json4
5 files changed, 13 insertions, 11 deletions
diff --git a/.mypy.ini b/.mypy.ini
index e0bff335f..68839e86f 100644
--- a/.mypy.ini
+++ b/.mypy.ini
@@ -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
diff --git a/misc/requirements/requirements-mypy.txt b/misc/requirements/requirements-mypy.txt
index ba144db4b..b5d23bf61 100644
--- a/misc/requirements/requirements-mypy.txt
+++ b/misc/requirements/requirements-mypy.txt
@@ -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
diff --git a/misc/requirements/requirements-mypy.txt-raw b/misc/requirements/requirements-mypy.txt-raw
index 2c22167d6..487d30ca6 100644
--- a/misc/requirements/requirements-mypy.txt-raw
+++ b/misc/requirements/requirements-mypy.txt-raw
@@ -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
diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py
index 040e75f16..f3363e8a2 100644
--- a/qutebrowser/utils/log.py
+++ b/qutebrowser/utils/log.py
@@ -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)
diff --git a/scripts/dev/changelog_urls.json b/scripts/dev/changelog_urls.json
index 1c9528f22..5d7b13e28 100644
--- a/scripts/dev/changelog_urls.json
+++ b/scripts/dev/changelog_urls.json
@@ -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",