diff options
| author | Bryan Forbes <[email protected]> | 2021-08-18 00:05:08 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-08-18 01:05:08 -0400 |
| commit | 79bae4799222c57335eb008979d09fd80739f5a4 (patch) | |
| tree | cecfb1aec1820cd966a54a5f39bfd46cec07909f /discord | |
| parent | [commands] Typehinted errors.py (diff) | |
| download | discord.py-79bae4799222c57335eb008979d09fd80739f5a4.tar.xz discord.py-79bae4799222c57335eb008979d09fd80739f5a4.zip | |
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[<nothing>]` in mypy
strict mode and then the `__get__` overloads never match. This leads to
errors when using things like `permissions_instance.embed_links` since
`<nothing>` 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.
Diffstat (limited to 'discord')
| -rw-r--r-- | discord/flags.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/discord/flags.py b/discord/flags.py index b21e4ed8..dad88d93 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__ |