Upgrade mypy 0.761 -> 0.770

https://mypy-lang.blogspot.com/2020/03/mypy-0770-released.html
This commit is contained in:
Ran Benita 2020-03-15 22:49:14 +02:00
parent 6ca7a0409d
commit 817537523c
6 changed files with 10 additions and 10 deletions

View File

@ -37,7 +37,7 @@ repos:
- id: pyupgrade
args: [--py3-plus]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.761 # NOTE: keep this in sync with setup.py.
rev: v0.770 # NOTE: keep this in sync with setup.py.
hooks:
- id: mypy
files: ^(src/|testing/)

View File

@ -31,7 +31,7 @@ def main():
"xmlschema",
],
"checkqa-mypy": [
"mypy==v0.761", # keep this in sync with .pre-commit-config.yaml.
"mypy==v0.770", # keep this in sync with .pre-commit-config.yaml.
],
},
install_requires=INSTALL_REQUIRES,

View File

@ -678,7 +678,7 @@ def raises( # noqa: F811
"""
__tracebackhide__ = True
for exc in filterfalse(
inspect.isclass, always_iterable(expected_exception, BASE_TYPE) # type: ignore[arg-type] # noqa: F821
inspect.isclass, always_iterable(expected_exception, BASE_TYPE)
):
msg = "exceptions must be derived from BaseException, not %s"
raise TypeError(msg % type(exc))

View File

@ -139,18 +139,18 @@ class WarningsRecorder(warnings.catch_warnings):
def __init__(self):
super().__init__(record=True)
self._entered = False
self._list = [] # type: List[warnings._Record]
self._list = [] # type: List[warnings.WarningMessage]
@property
def list(self) -> List["warnings._Record"]:
def list(self) -> List["warnings.WarningMessage"]:
"""The list of recorded warnings."""
return self._list
def __getitem__(self, i: int) -> "warnings._Record":
def __getitem__(self, i: int) -> "warnings.WarningMessage":
"""Get a recorded warning by index."""
return self._list[i]
def __iter__(self) -> Iterator["warnings._Record"]:
def __iter__(self) -> Iterator["warnings.WarningMessage"]:
"""Iterate through the recorded warnings."""
return iter(self._list)
@ -158,7 +158,7 @@ class WarningsRecorder(warnings.catch_warnings):
"""The number of recorded warnings."""
return len(self._list)
def pop(self, cls: "Type[Warning]" = Warning) -> "warnings._Record":
def pop(self, cls: "Type[Warning]" = Warning) -> "warnings.WarningMessage":
"""Pop the first recorded warning, raise exception if not exists."""
for i, w in enumerate(self._list):
if issubclass(w.category, cls):

View File

@ -55,7 +55,7 @@ class BaseReport:
def toterminal(self, out) -> None:
if hasattr(self, "node"):
out.line(getslaveinfoline(self.node)) # type: ignore
out.line(getslaveinfoline(self.node))
longrepr = self.longrepr
if longrepr is None:

View File

@ -480,7 +480,7 @@ class TerminalReporter:
self._write_progress_information_filling_space()
else:
self.ensure_newline()
self._tw.write("[%s]" % rep.node.gateway.id) # type: ignore
self._tw.write("[%s]" % rep.node.gateway.id)
if self._show_progress_info:
self._tw.write(
self._get_progress_information_message() + " ", cyan=True