Update mypy 0.782 -> 0.790
This commit is contained in:
		
							parent
							
								
									e5e47c1097
								
							
						
					
					
						commit
						1b23a111d2
					
				|  | @ -49,7 +49,7 @@ repos: | ||||||
|     hooks: |     hooks: | ||||||
|     -   id: python-use-type-annotations |     -   id: python-use-type-annotations | ||||||
| -   repo: https://github.com/pre-commit/mirrors-mypy | -   repo: https://github.com/pre-commit/mirrors-mypy | ||||||
|     rev: v0.782  # NOTE: keep this in sync with setup.cfg. |     rev: v0.790  # NOTE: keep this in sync with setup.cfg. | ||||||
|     hooks: |     hooks: | ||||||
|     -   id: mypy |     -   id: mypy | ||||||
|         files: ^(src/|testing/) |         files: ^(src/|testing/) | ||||||
|  |  | ||||||
|  | @ -63,7 +63,7 @@ console_scripts = | ||||||
| 
 | 
 | ||||||
| [options.extras_require] | [options.extras_require] | ||||||
| checkqa-mypy = | checkqa-mypy = | ||||||
|     mypy==0.780 |     mypy==0.790 | ||||||
| testing = | testing = | ||||||
|     argcomplete |     argcomplete | ||||||
|     hypothesis>=3.56 |     hypothesis>=3.56 | ||||||
|  |  | ||||||
|  | @ -382,7 +382,7 @@ class NFPlugin: | ||||||
|             self.cached_nodeids.update(item.nodeid for item in items) |             self.cached_nodeids.update(item.nodeid for item in items) | ||||||
| 
 | 
 | ||||||
|     def _get_increasing_order(self, items: Iterable[nodes.Item]) -> List[nodes.Item]: |     def _get_increasing_order(self, items: Iterable[nodes.Item]) -> List[nodes.Item]: | ||||||
|         return sorted(items, key=lambda item: item.fspath.mtime(), reverse=True) |         return sorted(items, key=lambda item: item.fspath.mtime(), reverse=True)  # type: ignore[no-any-return] | ||||||
| 
 | 
 | ||||||
|     def pytest_sessionfinish(self) -> None: |     def pytest_sessionfinish(self) -> None: | ||||||
|         config = self.config |         config = self.config | ||||||
|  |  | ||||||
|  | @ -380,8 +380,7 @@ class FDCaptureBinary: | ||||||
|             self.syscapture = SysCapture(targetfd) |             self.syscapture = SysCapture(targetfd) | ||||||
|         else: |         else: | ||||||
|             self.tmpfile = EncodedFile( |             self.tmpfile = EncodedFile( | ||||||
|                 # TODO: Remove type ignore, fixed in next mypy release. |                 TemporaryFile(buffering=0), | ||||||
|                 TemporaryFile(buffering=0),  # type: ignore[arg-type] |  | ||||||
|                 encoding="utf-8", |                 encoding="utf-8", | ||||||
|                 errors="replace", |                 errors="replace", | ||||||
|                 newline="", |                 newline="", | ||||||
|  |  | ||||||
|  | @ -150,9 +150,8 @@ def getfuncargnames( | ||||||
|         p.name |         p.name | ||||||
|         for p in parameters.values() |         for p in parameters.values() | ||||||
|         if ( |         if ( | ||||||
|             # TODO: Remove type ignore after https://github.com/python/typeshed/pull/4383 |             p.kind is Parameter.POSITIONAL_OR_KEYWORD | ||||||
|             p.kind is Parameter.POSITIONAL_OR_KEYWORD  # type: ignore[unreachable] |             or p.kind is Parameter.KEYWORD_ONLY | ||||||
|             or p.kind is Parameter.KEYWORD_ONLY  # type: ignore[unreachable] |  | ||||||
|         ) |         ) | ||||||
|         and p.default is Parameter.empty |         and p.default is Parameter.empty | ||||||
|     ) |     ) | ||||||
|  |  | ||||||
|  | @ -1322,8 +1322,10 @@ class Pytester: | ||||||
|         """ |         """ | ||||||
|         __tracebackhide__ = True |         __tracebackhide__ = True | ||||||
| 
 | 
 | ||||||
|  |         # TODO: Remove type ignore in next mypy release. | ||||||
|  |         #       https://github.com/python/typeshed/pull/4582 | ||||||
|         cmdargs = tuple( |         cmdargs = tuple( | ||||||
|             os.fspath(arg) if isinstance(arg, os.PathLike) else arg for arg in cmdargs |             os.fspath(arg) if isinstance(arg, os.PathLike) else arg for arg in cmdargs  # type: ignore[misc] | ||||||
|         ) |         ) | ||||||
|         p1 = self.path.joinpath("stdout") |         p1 = self.path.joinpath("stdout") | ||||||
|         p2 = self.path.joinpath("stderr") |         p2 = self.path.joinpath("stderr") | ||||||
|  |  | ||||||
|  | @ -210,7 +210,7 @@ class ApproxScalar(ApproxBase): | ||||||
|         # tolerances, i.e. non-numerics and infinities. Need to call abs to |         # tolerances, i.e. non-numerics and infinities. Need to call abs to | ||||||
|         # handle complex numbers, e.g. (inf + 1j). |         # handle complex numbers, e.g. (inf + 1j). | ||||||
|         if (not isinstance(self.expected, (Complex, Decimal))) or math.isinf( |         if (not isinstance(self.expected, (Complex, Decimal))) or math.isinf( | ||||||
|             abs(self.expected) |             abs(self.expected)  # type: ignore[arg-type] | ||||||
|         ): |         ): | ||||||
|             return str(self.expected) |             return str(self.expected) | ||||||
| 
 | 
 | ||||||
|  | @ -253,8 +253,8 @@ class ApproxScalar(ApproxBase): | ||||||
|         # Allow the user to control whether NaNs are considered equal to each |         # Allow the user to control whether NaNs are considered equal to each | ||||||
|         # other or not.  The abs() calls are for compatibility with complex |         # other or not.  The abs() calls are for compatibility with complex | ||||||
|         # numbers. |         # numbers. | ||||||
|         if math.isnan(abs(self.expected)): |         if math.isnan(abs(self.expected)):  # type: ignore[arg-type] | ||||||
|             return self.nan_ok and math.isnan(abs(actual)) |             return self.nan_ok and math.isnan(abs(actual))  # type: ignore[arg-type] | ||||||
| 
 | 
 | ||||||
|         # Infinity shouldn't be approximately equal to anything but itself, but |         # Infinity shouldn't be approximately equal to anything but itself, but | ||||||
|         # if there's a relative tolerance, it will be infinite and infinity |         # if there's a relative tolerance, it will be infinite and infinity | ||||||
|  | @ -262,7 +262,7 @@ class ApproxScalar(ApproxBase): | ||||||
|         # case would have been short circuited above, so here we can just |         # case would have been short circuited above, so here we can just | ||||||
|         # return false if the expected value is infinite.  The abs() call is |         # return false if the expected value is infinite.  The abs() call is | ||||||
|         # for compatibility with complex numbers. |         # for compatibility with complex numbers. | ||||||
|         if math.isinf(abs(self.expected)): |         if math.isinf(abs(self.expected)):  # type: ignore[arg-type] | ||||||
|             return False |             return False | ||||||
| 
 | 
 | ||||||
|         # Return true if the two numbers are within the tolerance. |         # Return true if the two numbers are within the tolerance. | ||||||
|  |  | ||||||
|  | @ -77,7 +77,7 @@ def pytest_terminal_summary(terminalreporter: "TerminalReporter") -> None: | ||||||
|                 dlist.append(rep) |                 dlist.append(rep) | ||||||
|     if not dlist: |     if not dlist: | ||||||
|         return |         return | ||||||
|     dlist.sort(key=lambda x: x.duration) |     dlist.sort(key=lambda x: x.duration)  # type: ignore[no-any-return] | ||||||
|     dlist.reverse() |     dlist.reverse() | ||||||
|     if not durations: |     if not durations: | ||||||
|         tr.write_sep("=", "slowest durations") |         tr.write_sep("=", "slowest durations") | ||||||
|  |  | ||||||
|  | @ -1595,7 +1595,7 @@ class TestPyCacheDir: | ||||||
|         if prefix: |         if prefix: | ||||||
|             if sys.version_info < (3, 8): |             if sys.version_info < (3, 8): | ||||||
|                 pytest.skip("pycache_prefix not available in py<38") |                 pytest.skip("pycache_prefix not available in py<38") | ||||||
|             monkeypatch.setattr(sys, "pycache_prefix", prefix)  # type:ignore |             monkeypatch.setattr(sys, "pycache_prefix", prefix) | ||||||
| 
 | 
 | ||||||
|         assert get_cache_dir(Path(source)) == Path(expected) |         assert get_cache_dir(Path(source)) == Path(expected) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1606,7 +1606,7 @@ def test_stderr_write_returns_len(capsys): | ||||||
| def test_encodedfile_writelines(tmpfile: BinaryIO) -> None: | def test_encodedfile_writelines(tmpfile: BinaryIO) -> None: | ||||||
|     ef = capture.EncodedFile(tmpfile, encoding="utf-8") |     ef = capture.EncodedFile(tmpfile, encoding="utf-8") | ||||||
|     with pytest.raises(TypeError): |     with pytest.raises(TypeError): | ||||||
|         ef.writelines([b"line1", b"line2"]) |         ef.writelines([b"line1", b"line2"])  # type: ignore[list-item] | ||||||
|     assert ef.writelines(["line3", "line4"]) is None  # type: ignore[func-returns-value] |     assert ef.writelines(["line3", "line4"]) is None  # type: ignore[func-returns-value] | ||||||
|     ef.flush() |     ef.flush() | ||||||
|     tmpfile.seek(0) |     tmpfile.seek(0) | ||||||
|  |  | ||||||
|  | @ -886,14 +886,9 @@ class TestPDB: | ||||||
| 
 | 
 | ||||||
| class TestDebuggingBreakpoints: | class TestDebuggingBreakpoints: | ||||||
|     def test_supports_breakpoint_module_global(self): |     def test_supports_breakpoint_module_global(self): | ||||||
|         """ |         """Test that supports breakpoint global marks on Python 3.7+.""" | ||||||
|         Test that supports breakpoint global marks on Python 3.7+ and not on |  | ||||||
|         CPython 3.5, 2.7 |  | ||||||
|         """ |  | ||||||
|         if sys.version_info >= (3, 7): |         if sys.version_info >= (3, 7): | ||||||
|             assert SUPPORTS_BREAKPOINT_BUILTIN is True |             assert SUPPORTS_BREAKPOINT_BUILTIN is True | ||||||
|         if sys.version_info.major == 3 and sys.version_info.minor == 5: |  | ||||||
|             assert SUPPORTS_BREAKPOINT_BUILTIN is False  # type: ignore[comparison-overlap] |  | ||||||
| 
 | 
 | ||||||
|     @pytest.mark.skipif( |     @pytest.mark.skipif( | ||||||
|         not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin" |         not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin" | ||||||
|  |  | ||||||
|  | @ -1049,7 +1049,7 @@ class TestLiterals: | ||||||
|             ("1e3", "999"), |             ("1e3", "999"), | ||||||
|             # The current implementation doesn't understand that numbers inside |             # The current implementation doesn't understand that numbers inside | ||||||
|             # strings shouldn't be treated as numbers: |             # strings shouldn't be treated as numbers: | ||||||
|             pytest.param("'3.1416'", "'3.14'", marks=pytest.mark.xfail),  # type: ignore |             pytest.param("'3.1416'", "'3.14'", marks=pytest.mark.xfail), | ||||||
|         ], |         ], | ||||||
|     ) |     ) | ||||||
|     def test_number_non_matches(self, pytester, expression, output): |     def test_number_non_matches(self, pytester, expression, output): | ||||||
|  |  | ||||||
|  | @ -1,3 +1,4 @@ | ||||||
|  | import io | ||||||
| from typing import List | from typing import List | ||||||
| from typing import Union | from typing import Union | ||||||
| 
 | 
 | ||||||
|  | @ -95,7 +96,7 @@ class TestPaste: | ||||||
| 
 | 
 | ||||||
|         def mocked(url, data): |         def mocked(url, data): | ||||||
|             calls.append((url, data)) |             calls.append((url, data)) | ||||||
|             raise urllib.error.HTTPError(url, 400, "Bad request", None, None) |             raise urllib.error.HTTPError(url, 400, "Bad request", {}, io.BytesIO()) | ||||||
| 
 | 
 | ||||||
|         monkeypatch.setattr(urllib.request, "urlopen", mocked) |         monkeypatch.setattr(urllib.request, "urlopen", mocked) | ||||||
|         return calls |         return calls | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue