Skip to content

Commit f81a338

Browse files
committed
add some more comment
1 parent dffef1f commit f81a338

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

discord/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,9 @@ async def get_or_fetch(
598598
default: Any = MISSING,
599599
attr: str = MISSING,
600600
id: int = MISSING,
601-
) -> _FETCHABLE | None: # TODO: Remove in 3.0 the arguments attr and id
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
602604
"""
603605
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.
604606
@@ -644,12 +646,13 @@ async def get_or_fetch(
644646
"appemoji": AppEmoji,
645647
"role": Role,
646648
}
647-
649+
# backward support for attr and id, this whole if block should be removed in v3
648650
if attr is not MISSING or id is not MISSING or isinstance(object_type, str):
649651
warn_deprecated(
650652
name="get_or_fetch(obj, attr='type', id=...)",
651653
instead="get_or_fetch(obj, object_type=Type, object_id=...)",
652654
since="2.7",
655+
removed="3.0",
653656
)
654657

655658
deprecated_attr = attr if attr is not MISSING else object_type

0 commit comments

Comments
 (0)