Update mypy 0.740 -> 0.750

Release notes:
https://mypy-lang.blogspot.com/2019/11/mypy-0.html
This commit is contained in:
Ran Benita 2019-12-02 18:01:08 +02:00
parent da091b832d
commit 16ff9f591e
6 changed files with 12 additions and 12 deletions

View File

@ -38,7 +38,7 @@ repos:
- id: pyupgrade
args: [--py3-plus]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.740
rev: v0.750
hooks:
- id: mypy
files: ^(src/|testing/)

View File

@ -479,7 +479,7 @@ class ExceptionInfo(Generic[_E]):
assert tup[1] is not None, "no current exception"
assert tup[2] is not None, "no current exception"
exc_info = (tup[0], tup[1], tup[2])
return cls.from_exc_info(exc_info, exprinfo)
return ExceptionInfo.from_exc_info(exc_info, exprinfo)
@classmethod
def for_later(cls) -> "ExceptionInfo[_E]":

View File

@ -339,7 +339,9 @@ def getstatementrange_ast(
block_finder.started = source.lines[start][0].isspace()
it = ((x + "\n") for x in source.lines[start:end])
try:
for tok in tokenize.generate_tokens(lambda: next(it)):
# Type ignored until next mypy release.
# https://github.com/python/typeshed/commit/c0d46a20353b733befb85d8b9cc24e5b0bcd8f9a
for tok in tokenize.generate_tokens(lambda: next(it)): # type: ignore
block_finder.tokeneater(*tok)
except (inspect.EndOfBlock, IndentationError):
end = block_finder.last + start

View File

@ -1074,14 +1074,13 @@ def try_makedirs(cache_dir) -> bool:
def get_cache_dir(file_path: Path) -> Path:
"""Returns the cache directory to write .pyc files for the given .py file path"""
# Type ignored until added in next mypy release.
if sys.version_info >= (3, 8) and sys.pycache_prefix: # type: ignore
if sys.version_info >= (3, 8) and sys.pycache_prefix:
# given:
# prefix = '/tmp/pycs'
# path = '/home/user/proj/test_app.py'
# we want:
# '/tmp/pycs/home/user/proj'
return Path(sys.pycache_prefix) / Path(*file_path.parts[1:-1]) # type: ignore
return Path(sys.pycache_prefix) / Path(*file_path.parts[1:-1])
else:
# classic pycache directory
return file_path.parent / "__pycache__"

View File

@ -43,8 +43,7 @@ MODULE_NOT_FOUND_ERROR = (
if sys.version_info >= (3, 8):
# Type ignored until next mypy release.
from importlib import metadata as importlib_metadata # type: ignore
from importlib import metadata as importlib_metadata
else:
import importlib_metadata # noqa: F401
@ -385,9 +384,7 @@ else:
if sys.version_info >= (3, 8):
# TODO: Remove type ignore on next mypy update.
# https://github.com/python/typeshed/commit/add0b5e930a1db16560fde45a3b710eefc625709
from functools import cached_property # type: ignore
from functools import cached_property
else:
class cached_property(Generic[_S, _T]):

View File

@ -129,7 +129,9 @@ def warns( # noqa: F811
return func(*args[1:], **kwargs)
class WarningsRecorder(warnings.catch_warnings):
# Type ignored until next mypy release. Regression fixed by:
# https://github.com/python/typeshed/commit/41bf6a19822d6694973449d795f8bfe1d50d5a03
class WarningsRecorder(warnings.catch_warnings): # type: ignore
"""A context manager to record raised warnings.
Adapted from `warnings.catch_warnings`.