Skip to content

Commit 8f560d9

Browse files
committed
[BugFix] Fix typing.NotRequired reference for Python 3.10
Use the imported NotRequired instead of typing.NotRequired in _is_not_required(), since typing.NotRequired only exists in 3.11+. Made-with: Cursor
1 parent dda393d commit 8f560d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tensordict/typedtensordict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _get_td_dir() -> frozenset[str]:
6161
def _is_not_required(tp: Any) -> bool:
6262
"""Check whether a type annotation is NotRequired[T]."""
6363
origin = getattr(tp, "__origin__", None)
64-
if origin is typing.NotRequired:
64+
if origin is NotRequired:
6565
return True
6666
origin = getattr(tp, "__class__", None)
6767
if origin is not None and getattr(origin, "__name__", None) == "_SpecialForm":

0 commit comments

Comments
 (0)