Skip to content

Commit

Permalink
Merge pull request #6307 from bluetech/mypy-750
Browse files Browse the repository at this point in the history
Update mypy 0.740 -> 0.750
  • Loading branch information
bluetech authored Dec 3, 2019
2 parents da091b8 + 16ff9f5 commit c9ec724
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/_code/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def from_current(
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]":
Expand Down
4 changes: 3 additions & 1 deletion src/_pytest/_code/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/_pytest/assertion/rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__"
7 changes: 2 additions & 5 deletions src/_pytest/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@


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

Expand Down Expand Up @@ -385,9 +384,7 @@ def overload(f): # noqa: F811


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]):
Expand Down
4 changes: 3 additions & 1 deletion src/_pytest/recwarn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down

0 comments on commit c9ec724

Please sign in to comment.