mirror of
https://github.com/p2p-ld/numpydantic.git
synced 2025-01-10 05:54:26 +00:00
python 3.9 compat
This commit is contained in:
parent
d706d8f1e1
commit
9c306db791
3 changed files with 7 additions and 8 deletions
|
@ -111,7 +111,7 @@ ignore = [
|
|||
fixable = ["ALL"]
|
||||
|
||||
[tool.black]
|
||||
exclude = ["tests"]
|
||||
exclude = "tests"
|
||||
|
||||
[tool.mypy]
|
||||
plugins = [
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"): ...
|
||||
|
|
Loading…
Reference in a new issue