From 6ce599a6dc92bbe4474b44d61ab3fbbd208f08af Mon Sep 17 00:00:00 2001 From: John Kerl Date: Mon, 16 Sep 2024 21:51:13 +0000 Subject: [PATCH] WIP --- python-spec/src/somacore/options.py | 3 ++- python-spec/src/somacore/types.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/python-spec/src/somacore/options.py b/python-spec/src/somacore/options.py index 6a6e629f..83306594 100644 --- a/python-spec/src/somacore/options.py +++ b/python-spec/src/somacore/options.py @@ -5,7 +5,7 @@ """ import enum -from typing import Any, Dict, Mapping, Optional, Sequence, TypeVar, Union +from typing import Any, Dict, Mapping, Optional, Sequence, TypeVar, Tuple, Union import attrs import numpy as np @@ -171,6 +171,7 @@ class ResultOrder(enum.Enum): SparseNDCoord = Union[ None, + Tuple[int,...], ValSliceOrSequence[int], npt.NDArray[np.integer], pa.IntegerArray, diff --git a/python-spec/src/somacore/types.py b/python-spec/src/somacore/types.py index 5a64153f..61eb9123 100644 --- a/python-spec/src/somacore/types.py +++ b/python-spec/src/somacore/types.py @@ -8,6 +8,7 @@ import sys from concurrent import futures from typing import TYPE_CHECKING, NoReturn, Optional, Sequence, Type, TypeVar +from types import get_original_bases from typing_extensions import Protocol, TypeGuard @@ -57,6 +58,10 @@ def stop(self) -> Optional[_T_co]: ... @property def step(self) -> Optional[_T_co]: ... + @property + def __orig_bases__(self) -> Any: + return get_original_bases(_T_co) + if sys.version_info < (3, 10) and not TYPE_CHECKING: # Python 3.9 and below have a bug where any Protocol with an @property # was always regarded as runtime-checkable.