mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-07 10:22:59 +00:00
Change certain sequences to use a special proxy type instead of list
This is to speed up cases where someone is just querying the length of the underlying sequence. If anything else is done to the sequence then it is copied from the original iterator. This change should be mostly transparent.
This commit is contained in:
@ -370,18 +370,18 @@ class Client:
|
||||
return self._connection.user
|
||||
|
||||
@property
|
||||
def guilds(self) -> List[Guild]:
|
||||
"""List[:class:`.Guild`]: The guilds that the connected client is a member of."""
|
||||
def guilds(self) -> Sequence[Guild]:
|
||||
"""Sequence[:class:`.Guild`]: The guilds that the connected client is a member of."""
|
||||
return self._connection.guilds
|
||||
|
||||
@property
|
||||
def emojis(self) -> List[Emoji]:
|
||||
"""List[:class:`.Emoji`]: The emojis that the connected client has."""
|
||||
def emojis(self) -> Sequence[Emoji]:
|
||||
"""Sequence[:class:`.Emoji`]: The emojis that the connected client has."""
|
||||
return self._connection.emojis
|
||||
|
||||
@property
|
||||
def stickers(self) -> List[GuildSticker]:
|
||||
"""List[:class:`.GuildSticker`]: The stickers that the connected client has.
|
||||
def stickers(self) -> Sequence[GuildSticker]:
|
||||
"""Sequence[:class:`.GuildSticker`]: The stickers that the connected client has.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
"""
|
||||
@ -396,8 +396,8 @@ class Client:
|
||||
return utils.SequenceProxy(self._connection._messages or [])
|
||||
|
||||
@property
|
||||
def private_channels(self) -> List[PrivateChannel]:
|
||||
"""List[:class:`.abc.PrivateChannel`]: The private channels that the connected client is participating on.
|
||||
def private_channels(self) -> Sequence[PrivateChannel]:
|
||||
"""Sequence[:class:`.abc.PrivateChannel`]: The private channels that the connected client is participating on.
|
||||
|
||||
.. note::
|
||||
|
||||
|
Reference in New Issue
Block a user