Skip to content

Commit

Permalink
iterating
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Sep 16, 2024
1 parent 79fa1e4 commit c71fcf2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion python-spec/src/somacore/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

import enum
from typing import Any, Dict, Mapping, Optional, Sequence, TypeVar, Tuple, Union
from typing import Any, Dict, Mapping, Optional, Sequence, Tuple, TypeVar, Union

import attrs
import numpy as np
Expand Down
13 changes: 9 additions & 4 deletions python-spec/src/somacore/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import sys
from concurrent import futures
from typing import TYPE_CHECKING, Any, NoReturn, Optional, Sequence, Type, TypeVar
from types import get_original_bases # only exists in Python 3.12 and above

from typing_extensions import Protocol, TypeGuard

Expand Down Expand Up @@ -58,9 +57,15 @@ 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, 12):

@property
def __orig_bases__(self) -> Any:
# Only exists in Python 3.12 and above
from types import get_original_bases

return get_original_bases(int)
# 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
Expand Down

0 comments on commit c71fcf2

Please sign in to comment.