diff options
| author | Rapptz <[email protected]> | 2021-07-08 10:17:44 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2021-07-08 10:17:44 -0400 |
| commit | af8742a911e090a17771936d3fb774b00b126088 (patch) | |
| tree | feddb0534e4d361103fea32a6a4eaed0294fa614 /discord/member.py | |
| parent | Remove extraneous dict assignment from view store (diff) | |
| download | discord.py-af8742a911e090a17771936d3fb774b00b126088.tar.xz discord.py-af8742a911e090a17771936d3fb774b00b126088.zip | |
Use a specific tag type for member and user comparisons
The previous protocol based tag type caused significant overhead
(in the magnitude of seconds). Removing this should simplify object
creation by removing typing.Generic from the __mro__
Diffstat (limited to 'discord/member.py')
| -rw-r--r-- | discord/member.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/discord/member.py b/discord/member.py index 86e08ef6..2cc8cc92 100644 --- a/discord/member.py +++ b/discord/member.py @@ -35,7 +35,7 @@ import discord.abc from . import utils from .utils import MISSING -from .user import BaseUser, User +from .user import BaseUser, User, _UserTag from .activity import create_activity, ActivityTypes from .permissions import Permissions from .enums import Status, try_enum @@ -194,13 +194,11 @@ def flatten_user(cls): return cls -_BaseUser = discord.abc.User - M = TypeVar('M', bound='Member') @flatten_user -class Member(discord.abc.Messageable, _BaseUser): +class Member(discord.abc.Messageable, _UserTag): """Represents a Discord member to a :class:`Guild`. This implements a lot of the functionality of :class:`User`. @@ -301,7 +299,7 @@ class Member(discord.abc.Messageable, _BaseUser): ) def __eq__(self, other: Any) -> bool: - return isinstance(other, _BaseUser) and other.id == self.id + return isinstance(other, _UserTag) and other.id == self.id def __ne__(self, other: Any) -> bool: return not self.__eq__(other) |