[commands] fix Range to allow 3.10 Union syntax

This commit is contained in:
Varun J 2022-09-08 11:34:07 +05:30 committed by GitHub
parent 035dd812de
commit 75fd49e6a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1109,6 +1109,9 @@ else:
# Trick to allow it inside typing.Union
pass
def __or__(self, rhs) -> Any:
return Union[self, rhs]
def __class_getitem__(cls, obj) -> Range:
if not isinstance(obj, tuple):
raise TypeError(f'expected tuple for arguments, received {obj.__class__!r} instead')