Merge pull request #6943 from bluetech/mypy-770
Upgrade mypy 0.761 -> 0.770
This commit is contained in:
commit
efada09da2
|
@ -37,7 +37,7 @@ repos:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args: [--py3-plus]
|
args: [--py3-plus]
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- 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:
|
hooks:
|
||||||
- id: mypy
|
- id: mypy
|
||||||
files: ^(src/|testing/)
|
files: ^(src/|testing/)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -31,7 +31,7 @@ def main():
|
||||||
"xmlschema",
|
"xmlschema",
|
||||||
],
|
],
|
||||||
"checkqa-mypy": [
|
"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,
|
install_requires=INSTALL_REQUIRES,
|
||||||
|
|
|
@ -678,7 +678,7 @@ def raises( # noqa: F811
|
||||||
"""
|
"""
|
||||||
__tracebackhide__ = True
|
__tracebackhide__ = True
|
||||||
for exc in filterfalse(
|
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"
|
msg = "exceptions must be derived from BaseException, not %s"
|
||||||
raise TypeError(msg % type(exc))
|
raise TypeError(msg % type(exc))
|
||||||
|
|
|
@ -139,18 +139,18 @@ class WarningsRecorder(warnings.catch_warnings):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(record=True)
|
super().__init__(record=True)
|
||||||
self._entered = False
|
self._entered = False
|
||||||
self._list = [] # type: List[warnings._Record]
|
self._list = [] # type: List[warnings.WarningMessage]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def list(self) -> List["warnings._Record"]:
|
def list(self) -> List["warnings.WarningMessage"]:
|
||||||
"""The list of recorded warnings."""
|
"""The list of recorded warnings."""
|
||||||
return self._list
|
return self._list
|
||||||
|
|
||||||
def __getitem__(self, i: int) -> "warnings._Record":
|
def __getitem__(self, i: int) -> "warnings.WarningMessage":
|
||||||
"""Get a recorded warning by index."""
|
"""Get a recorded warning by index."""
|
||||||
return self._list[i]
|
return self._list[i]
|
||||||
|
|
||||||
def __iter__(self) -> Iterator["warnings._Record"]:
|
def __iter__(self) -> Iterator["warnings.WarningMessage"]:
|
||||||
"""Iterate through the recorded warnings."""
|
"""Iterate through the recorded warnings."""
|
||||||
return iter(self._list)
|
return iter(self._list)
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ class WarningsRecorder(warnings.catch_warnings):
|
||||||
"""The number of recorded warnings."""
|
"""The number of recorded warnings."""
|
||||||
return len(self._list)
|
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."""
|
"""Pop the first recorded warning, raise exception if not exists."""
|
||||||
for i, w in enumerate(self._list):
|
for i, w in enumerate(self._list):
|
||||||
if issubclass(w.category, cls):
|
if issubclass(w.category, cls):
|
||||||
|
|
|
@ -55,7 +55,7 @@ class BaseReport:
|
||||||
|
|
||||||
def toterminal(self, out) -> None:
|
def toterminal(self, out) -> None:
|
||||||
if hasattr(self, "node"):
|
if hasattr(self, "node"):
|
||||||
out.line(getslaveinfoline(self.node)) # type: ignore
|
out.line(getslaveinfoline(self.node))
|
||||||
|
|
||||||
longrepr = self.longrepr
|
longrepr = self.longrepr
|
||||||
if longrepr is None:
|
if longrepr is None:
|
||||||
|
|
|
@ -480,7 +480,7 @@ class TerminalReporter:
|
||||||
self._write_progress_information_filling_space()
|
self._write_progress_information_filling_space()
|
||||||
else:
|
else:
|
||||||
self.ensure_newline()
|
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:
|
if self._show_progress_info:
|
||||||
self._tw.write(
|
self._tw.write(
|
||||||
self._get_progress_information_message() + " ", cyan=True
|
self._get_progress_information_message() + " ", cyan=True
|
||||||
|
|
Loading…
Reference in New Issue