Skip to content

Commit 1377933

Browse files
refactor: Update __getitem__ compatibility with all
1 parent 2ce9922 commit 1377933

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/thread/_types.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,16 @@ class SupportsLength(Sized, Protocol):
4949
pass
5050

5151

52+
_SupportsGetItem_T = TypeVar('_SupportsGetItem_T')
53+
54+
5255
@runtime_checkable
53-
class SupportsGetItem(Protocol[_Dataset_T]):
54-
def __getitem__(self, i: int) -> _Dataset_T: ...
56+
class SupportsGetItem(Protocol[_SupportsGetItem_T]):
57+
__getitem__: Callable[..., _SupportsGetItem_T]
5558

5659

5760
@runtime_checkable
58-
class SupportsLengthGetItem(SupportsGetItem[_Dataset_T], SupportsLength, Protocol):
61+
class SupportsLengthGetItem(
62+
SupportsGetItem[_SupportsGetItem_T], SupportsLength, Protocol
63+
):
5964
pass

0 commit comments

Comments
 (0)