Skip to content

Commit cc273c2

Browse files
committed
Update utils.py
1 parent f81a338 commit cc273c2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

discord/utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,16 +591,16 @@ def get(iterable: Iterable[T], **attrs: Any) -> T | None:
591591
)
592592

593593

594+
# TODO: In version 3.0, remove the 'attr' and 'id' arguments.
595+
# Also, eliminate the default 'MISSING' value for both 'object_type' and 'object_id'.
594596
async def get_or_fetch(
595597
obj: Guild | Client,
596598
object_type: type[_FETCHABLE] = MISSING,
597599
object_id: int | None = MISSING,
598600
default: Any = MISSING,
599601
attr: str = MISSING,
600602
id: int = MISSING,
601-
) -> (
602-
_FETCHABLE | None
603-
): # TODO: Remove in 3.0 the arguments attr and id + remove the = MISSING for both object_type and object_id
603+
) -> _FETCHABLE | None:
604604
"""
605605
Shortcut method to get data from an object either by returning the cached version, or if it does not exist, attempting to fetch it from the API.
606606
@@ -646,7 +646,8 @@ async def get_or_fetch(
646646
"appemoji": AppEmoji,
647647
"role": Role,
648648
}
649-
# backward support for attr and id, this whole if block should be removed in v3
649+
# Temporary backward compatibility for 'attr' and 'id'.
650+
# This entire if block should be removed in version 3.0.
650651
if attr is not MISSING or id is not MISSING or isinstance(object_type, str):
651652
warn_deprecated(
652653
name="get_or_fetch(obj, attr='type', id=...)",

0 commit comments

Comments
 (0)