diff --git a/pyproject.toml b/pyproject.toml index 4ff77a3..3374d6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -111,7 +111,7 @@ ignore = [ fixable = ["ALL"] [tool.black] -exclude = ["tests"] +exclude = "tests" [tool.mypy] plugins = [ diff --git a/src/numpydantic/interface/interface.py b/src/numpydantic/interface/interface.py index 86646a8..50991ea 100644 --- a/src/numpydantic/interface/interface.py +++ b/src/numpydantic/interface/interface.py @@ -133,7 +133,7 @@ class Interface(ABC, Generic[T]): """Input types for all enabled interfaces""" in_types = [] for iface in cls.interfaces(): - if isinstance(iface.input_types, tuple | list): + if isinstance(iface.input_types, Union[tuple, list]): in_types.extend(iface.input_types) else: in_types.append(iface.input_types) diff --git a/src/numpydantic/types.py b/src/numpydantic/types.py index 30a5e5b..c629fbf 100644 --- a/src/numpydantic/types.py +++ b/src/numpydantic/types.py @@ -6,13 +6,12 @@ Note that these are types as in python typing types, not classes. # ruff: noqa: D102 -from typing import Any, Protocol, Tuple, runtime_checkable +from typing import Any, Protocol, Tuple, Union, runtime_checkable -import numpy as np from nptyping import DType -ShapeType = Tuple[int, ...] | Any -DtypeType = np.dtype | str | type | Any | DType +ShapeType = Union[Tuple[int, ...], Any] +DtypeType = Union[str, type, Any, DType] @runtime_checkable @@ -25,6 +24,6 @@ class NDArrayType(Protocol): @property def shape(self) -> ShapeType: ... - def __getitem__(self, key: int | slice) -> "NDArrayType": ... + def __getitem__(self, key: Union[int, slice]) -> "NDArrayType": ... - def __setitem__(self, key: int | slice, value: "NDArrayType"): ... + def __setitem__(self, key: Union[int, slice], value: "NDArrayType"): ...