Skip to content

Commit d5263c7

Browse files
committed
♻️ move get_slots function to private module
1 parent 006a7f8 commit d5263c7

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

discord/components.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929

3030
from .enums import ButtonStyle, ChannelType, ComponentType, InputTextStyle, try_enum
3131
from .partial_emoji import PartialEmoji, _EmojiTag
32-
from .utils import MISSING, Undefined, get_slots
32+
from .utils import MISSING, Undefined
33+
from .utils.private import get_slots
3334

3435
if TYPE_CHECKING:
3536
from .emoji import AppEmoji, GuildEmoji

discord/utils/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,3 @@ def _to_json(obj: Any) -> str:
196196
return json.dumps(obj, separators=(",", ":"), ensure_ascii=True)
197197

198198
_from_json = json.loads
199-
200-
201-
def get_slots(cls: type[Any]) -> Iterator[str]:
202-
for mro in reversed(cls.__mro__):
203-
try:
204-
yield from mro.__slots__
205-
except AttributeError:
206-
continue

discord/utils/private.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,14 @@ def __get__(self, instance: T | None, owner: type[T]) -> Any:
515515
return value
516516

517517

518+
def get_slots(cls: type[Any]) -> Iterator[str]:
519+
for mro in reversed(cls.__mro__):
520+
try:
521+
yield from mro.__slots__
522+
except AttributeError:
523+
continue
524+
525+
518526
def cached_slot_property(
519527
name: str,
520528
) -> Callable[[Callable[[T], T_co]], CachedSlotProperty[T, T_co]]:

0 commit comments

Comments
 (0)