Skip to content

Commit

Permalink
add CanClassGetitem[K, V]
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenham committed Feb 26, 2024
1 parent 5dfeb3f commit b24c527
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions optype/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'CanBytes',
'CanCall',
'CanCeil',
'CanClassGetitem',
'CanComplex',
'CanContains',
'CanDelattr',
Expand Down Expand Up @@ -136,6 +137,7 @@
CanBytes,
CanCall,
CanCeil,
CanClassGetitem,
CanComplex,
CanContains,
CanDelattr,
Expand Down
4 changes: 3 additions & 1 deletion optype/_can.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ def __set_name__(self, __cls: type[T], __name: str) -> Any: ...
# 3.3.5. Emulating generic types
# https://docs.python.org/3/reference/datamodel.html#emulating-generic-types

# TODO: CanClassGetItem
@runtime_checkable
class CanClassGetitem[K, V](Protocol):
def __class_getitem__(cls, __k: K) -> V: ...


# 3.3.6. Emulating callable objects
Expand Down

0 comments on commit b24c527

Please sign in to comment.