From f6f1594f95f5a9828d6d7c1ea5467f0affed96aa Mon Sep 17 00:00:00 2001 From: BvB93 <43369155+BvB93@users.noreply.github.com> Date: Fri, 30 Sep 2022 19:30:03 +0200 Subject: [PATCH 1/2] TST,TYP: Bump mypy to 0.981 --- environment.yml | 2 +- numpy/typing/tests/data/fail/scalars.pyi | 2 -- numpy/typing/tests/data/reveal/ctypeslib.pyi | 2 +- numpy/typing/tests/data/reveal/flatiter.pyi | 2 +- test_requirements.txt | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/environment.yml b/environment.yml index 24bf7383961c..05150eb5fc3c 100644 --- a/environment.yml +++ b/environment.yml @@ -19,7 +19,7 @@ dependencies: - pytest-xdist - hypothesis # For type annotations - - mypy=0.950 + - mypy=0.981 - typing_extensions>=4.2.0 # For building docs - sphinx=4.5.0 diff --git a/numpy/typing/tests/data/fail/scalars.pyi b/numpy/typing/tests/data/fail/scalars.pyi index 96447053888e..c24f9e479eeb 100644 --- a/numpy/typing/tests/data/fail/scalars.pyi +++ b/numpy/typing/tests/data/fail/scalars.pyi @@ -70,8 +70,6 @@ np.timedelta64(value=0) # E: Unexpected keyword argument np.bytes_(b"hello", encoding='utf-8') # E: No overload variant np.str_("hello", encoding='utf-8') # E: No overload variant -complex(np.bytes_("1")) # E: No overload variant - f8.item(1) # E: incompatible type f8.item((0, 1)) # E: incompatible type f8.squeeze(axis=1) # E: incompatible type diff --git a/numpy/typing/tests/data/reveal/ctypeslib.pyi b/numpy/typing/tests/data/reveal/ctypeslib.pyi index ccbdfe36e72b..2d30de3d15fe 100644 --- a/numpy/typing/tests/data/reveal/ctypeslib.pyi +++ b/numpy/typing/tests/data/reveal/ctypeslib.pyi @@ -20,7 +20,7 @@ AR_double: npt.NDArray[np.double] AR_longdouble: npt.NDArray[np.longdouble] AR_void: npt.NDArray[np.void] -pointer: ctypes.pointer[Any] +pointer: ctypes._Pointer[Any] reveal_type(np.ctypeslib.c_intp()) # E: {c_intp} diff --git a/numpy/typing/tests/data/reveal/flatiter.pyi b/numpy/typing/tests/data/reveal/flatiter.pyi index 0f0758175a53..8d3e80632821 100644 --- a/numpy/typing/tests/data/reveal/flatiter.pyi +++ b/numpy/typing/tests/data/reveal/flatiter.pyi @@ -7,7 +7,7 @@ reveal_type(a.base) # E: ndarray[Any, dtype[str_]] reveal_type(a.copy()) # E: ndarray[Any, dtype[str_]] reveal_type(a.coords) # E: tuple[builtins.int, ...] reveal_type(a.index) # E: int -reveal_type(iter(a)) # E: flatiter[ndarray[Any, dtype[str_]]] +reveal_type(iter(a)) # E: Any reveal_type(next(a)) # E: str_ reveal_type(a[0]) # E: str_ reveal_type(a[[0, 1, 2]]) # E: ndarray[Any, dtype[str_]] diff --git a/test_requirements.txt b/test_requirements.txt index c5fec8cd7e48..3e7d3fef79dd 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -10,5 +10,5 @@ cffi; python_version < '3.10' # For testing types. Notes on the restrictions: # - Mypy relies on C API features not present in PyPy # NOTE: Keep mypy in sync with environment.yml -mypy==0.950; platform_python_implementation != "PyPy" +mypy==0.981; platform_python_implementation != "PyPy" typing_extensions>=4.2.0 From dc5caa8db0b92671ef35c57ea8c7a8fc5d914ebe Mon Sep 17 00:00:00 2001 From: BvB93 <43369155+BvB93@users.noreply.github.com> Date: Fri, 30 Sep 2022 21:53:02 +0200 Subject: [PATCH 2/2] TST,DEP: Ignore an internal mypy deprecation warning for python 3.11 --- pytest.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pytest.ini b/pytest.ini index f1c49d0ff33c..29ec1d1a4fce 100644 --- a/pytest.ini +++ b/pytest.ini @@ -25,3 +25,5 @@ filterwarnings = # Ignore DeprecationWarnings from distutils ignore::DeprecationWarning:.*distutils ignore:\n\n `numpy.distutils`:DeprecationWarning +# Ignore mypy >= 0.971 DeprecationWarnings + ignore:path is deprecated\. Use files\(\) instead:DeprecationWarning:mypy