Upgrade mypy to 1.6.1 (#4049)

This commit is contained in:
Alex Waygood 2023-11-18 19:42:36 +00:00 committed by GitHub
parent c4cd200a06
commit d93a942a79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 19 additions and 13 deletions

View File

@ -39,7 +39,7 @@ repos:
exclude: ^src/blib2to3/
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
rev: v1.6.1
hooks:
- id: mypy
exclude: ^docs/conf.py

View File

@ -20,7 +20,7 @@
### Packaging
<!-- Changes to how Black is packaged, such as dependency requirements -->
- Upgrade to mypy 1.6.1 (#4049)
### Parser

View File

@ -121,7 +121,7 @@ macos-max-compat = true
enable-by-default = false
dependencies = [
"hatch-mypyc>=0.16.0",
"mypy==1.5.1",
"mypy==1.6.1",
"click==8.1.3", # avoid https://github.com/pallets/click/issues/2558
]
require-runtime-dependencies = true
@ -187,7 +187,7 @@ CC = "clang"
build-frontend = { name = "build", args = ["--no-isolation"] }
# Unfortunately, hatch doesn't respect MACOSX_DEPLOYMENT_TARGET
before-build = [
"python -m pip install 'hatchling==1.18.0' hatch-vcs hatch-fancy-pypi-readme 'hatch-mypyc>=0.16.0' 'mypy==1.5.1' 'click==8.1.3'",
"python -m pip install 'hatchling==1.18.0' hatch-vcs hatch-fancy-pypi-readme 'hatch-mypyc>=0.16.0' 'mypy==1.6.1' 'click==8.1.3'",
"""sed -i '' -e "600,700s/'10_16'/os.environ['MACOSX_DEPLOYMENT_TARGET'].replace('.', '_')/" $(python -c 'import hatchling.builders.wheel as h; print(h.__file__)') """,
]

View File

@ -14,7 +14,7 @@
import commonmark
import yaml
from bs4 import BeautifulSoup # type: ignore[import]
from bs4 import BeautifulSoup # type: ignore[import-untyped]
def main(changes: str, source_version_control: str) -> None:

View File

@ -8,7 +8,7 @@
import sys
import commonmark
from bs4 import BeautifulSoup # type: ignore[import]
from bs4 import BeautifulSoup # type: ignore[import-untyped]
def main(changes: str, the_basics: str) -> None:

View File

@ -119,7 +119,7 @@ def main() -> None:
@main.command("config", help="Acquire run configuration and metadata.")
@click.argument("event", type=click.Choice(["push", "pull_request"]))
def config(event: Literal["push", "pull_request"]) -> None:
import diff_shades # type: ignore[import]
import diff_shades # type: ignore[import-not-found]
if event == "push":
jobs = [{"mode": "preview-changes", "force-flag": "--force-preview-style"}]

View File

@ -80,7 +80,7 @@ def test_idempotent_any_syntatically_valid_python(
try:
import sys
import atheris # type: ignore[import]
import atheris # type: ignore[import-not-found]
except ImportError:
pass
else:

View File

@ -20,7 +20,7 @@
from os.path import basename, dirname, join
from typing import Iterable, Tuple
import wcwidth # type: ignore[import]
import wcwidth # type: ignore[import-not-found]
def make_width_table() -> Iterable[Tuple[int, int, int]]:

View File

@ -74,9 +74,7 @@ def main(bind_host: str, bind_port: int) -> None:
app = make_app()
ver = black.__version__
black.out(f"blackd version {ver} listening on {bind_host} port {bind_port}")
# TODO: aiohttp had an incorrect annotation for `print` argument,
# It'll be fixed once aiohttp releases that code
web.run_app(app, host=bind_host, port=bind_port, handle_signals=True, print=None) # type: ignore[arg-type]
web.run_app(app, host=bind_host, port=bind_port, handle_signals=True, print=None)
def make_app() -> web.Application:

View File

@ -26,7 +26,15 @@
from pytest import StashKey
except ImportError:
# pytest < 7
from _pytest.store import StoreKey as StashKey # type: ignore[import, no-redef]
#
# "isort: skip" is needed or it moves the "type: ignore" to the following line
# because of the line length, and then mypy complains.
# Of course, adding the "isort: skip" means that
# flake8-bugbear then also complains about the line length,
# so we *also* need a "noqa" comment for good measure :)
from _pytest.store import ( # type: ignore[import-not-found, no-redef] # isort: skip # noqa: B950
StoreKey as StashKey,
)
log = logging.getLogger(__name__)