diff options
| author | Rapptz <[email protected]> | 2021-05-28 01:56:48 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2021-05-28 01:56:48 -0400 |
| commit | aeb2cfb5730031ecd4d35badb3a80e08f97f3028 (patch) | |
| tree | 5cfced4e942c665993f01d1fbde1727bdcb5756c /discord/utils.py | |
| parent | Fix View.wait not returning when it times out (diff) | |
| download | discord.py-aeb2cfb5730031ecd4d35badb3a80e08f97f3028.tar.xz discord.py-aeb2cfb5730031ecd4d35badb3a80e08f97f3028.zip | |
Add private get_slots utility to get slots through MRO
Diffstat (limited to 'discord/utils.py')
| -rw-r--r-- | discord/utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/discord/utils.py b/discord/utils.py index 3682cffd..37e635bc 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -502,6 +502,14 @@ async def sane_wait_for(futures, *, timeout): return done +def get_slots(cls: Type[Any]) -> Iterator[str]: + for mro in reversed(cls.__mro__): + try: + yield from mro.__slots__ + except AttributeError: + continue + + def compute_timedelta(dt: datetime.datetime): if dt.tzinfo is None: dt = dt.astimezone() |