From b0ad84742e310731bf86a53339832e932936f666 Mon Sep 17 00:00:00 2001 From: Tom Close Date: Mon, 16 Sep 2024 14:11:40 +1000 Subject: [PATCH] fixed up typing --- conftest.py | 7 ++++--- extras/fileformats/extras/image/readwrite.py | 2 ++ fileformats/image/raster.py | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/conftest.py b/conftest.py index fca03ff..9922e6a 100644 --- a/conftest.py +++ b/conftest.py @@ -34,11 +34,12 @@ if os.getenv("_PYTEST_RAISE", "0") != "0": @pytest.hookimpl(tryfirst=True) - def pytest_exception_interact(call: ty.Any) -> None: - raise call.excinfo.value + def pytest_exception_interact(call: pytest.CallInfo[ty.Any]) -> None: + if call.excinfo is not None: + raise call.excinfo.value @pytest.hookimpl(tryfirst=True) - def pytest_internalerror(excinfo: ty.Any) -> None: + def pytest_internalerror(excinfo: pytest.ExceptionInfo[BaseException]) -> None: raise excinfo.value diff --git a/extras/fileformats/extras/image/readwrite.py b/extras/fileformats/extras/image/readwrite.py index 5f67552..2d73da8 100644 --- a/extras/fileformats/extras/image/readwrite.py +++ b/extras/fileformats/extras/image/readwrite.py @@ -1,4 +1,6 @@ import imageio +import numpy # noqa: F401 +import typing # noqa: F401 from fileformats.core import extra_implementation from fileformats.image.raster import RasterImage, DataArrayType diff --git a/fileformats/image/raster.py b/fileformats/image/raster.py index 9a82aab..a92e3f5 100644 --- a/fileformats/image/raster.py +++ b/fileformats/image/raster.py @@ -9,7 +9,7 @@ import numpy.typing # noqa: F401 -DataArrayType: TypeAlias = "numpy.typing.NDArray[ty.Union[numpy.floating[typing.Any], numpy.integer[typing.Any]]]" +DataArrayType: TypeAlias = "numpy.typing.NDArray[typing.Union[numpy.floating[typing.Any], numpy.integer[typing.Any]]]" class RasterImage(Image):