From 79bae4799222c57335eb008979d09fd80739f5a4 Mon Sep 17 00:00:00 2001 From: Bryan Forbes Date: Wed, 18 Aug 2021 00:05:08 -0500 Subject: [PATCH] flag_value should not be a generic class Since there is no generic information in `flag_value.__init__()`, `flag_value` descriptors get stored as `flag_value[]` in mypy strict mode and then the `__get__` overloads never match. This leads to errors when using things like `permissions_instance.embed_links` since `` never matches `Permissions`. The generic inheritance isn't needed at all since the type information we care about comes from the call site of `__get__` and not the instantiation of the descriptor. --- discord/flags.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/flags.py b/discord/flags.py index b21e4ed83..dad88d938 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -41,7 +41,7 @@ FV = TypeVar('FV', bound='flag_value') BF = TypeVar('BF', bound='BaseFlags') -class flag_value(Generic[BF]): +class flag_value: def __init__(self, func: Callable[[Any], int]): self.flag = func(None) self.__doc__ = func.__doc__