Skip to content

Commit

Permalink
Upgrade mypy to 1.6.1 (#4049)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood committed Nov 18, 2023
1 parent c4cd200 commit d93a942
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.md
Expand Up @@ -20,7 +20,7 @@

### Packaging

<!-- Changes to how Black is packaged, such as dependency requirements -->
- Upgrade to mypy 1.6.1 (#4049)

### Parser

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Expand Up @@ -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
Expand Down Expand Up @@ -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__)') """,
]

Expand Down
2 changes: 1 addition & 1 deletion scripts/check_pre_commit_rev_in_example.py
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion scripts/check_version_in_basics_example.py
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion scripts/diff_shades_gha_helper.py
Expand Up @@ -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"}]
Expand Down
2 changes: 1 addition & 1 deletion scripts/fuzz.py
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion scripts/make_width_table.py
Expand Up @@ -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]]:
Expand Down
4 changes: 1 addition & 3 deletions src/blackd/__init__.py
Expand Up @@ -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:
Expand Down
10 changes: 9 additions & 1 deletion tests/optional.py
Expand Up @@ -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__)

Expand Down

0 comments on commit d93a942

Please sign in to comment.