[commands] fix Range to allow 3.10 Union syntax

This commit is contained in:
Varun J
2022-09-08 02:04:07 -04:00
committed by GitHub
parent 035dd812de
commit 75fd49e6a1
+3
View File
@@ -1109,6 +1109,9 @@ else:
# Trick to allow it inside typing.Union # Trick to allow it inside typing.Union
pass pass
def __or__(self, rhs) -> Any:
return Union[self, rhs]
def __class_getitem__(cls, obj) -> Range: def __class_getitem__(cls, obj) -> Range:
if not isinstance(obj, tuple): if not isinstance(obj, tuple):
raise TypeError(f'expected tuple for arguments, received {obj.__class__!r} instead') raise TypeError(f'expected tuple for arguments, received {obj.__class__!r} instead')