aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh <[email protected]>2021-04-23 11:11:56 +1000
committerGitHub <[email protected]>2021-04-22 21:11:56 -0400
commite5607822d359195d7f4ab409f375c9833533da30 (patch)
treed4cb21f9ee3f7e81312001d96f2ee8babf9c5855
parentAdd support for editing message attachments (diff)
downloaddiscord.py-e5607822d359195d7f4ab409f375c9833533da30.tar.xz
discord.py-e5607822d359195d7f4ab409f375c9833533da30.zip
Define utils.cached_property in if TYPE_CHECKING guard
-rw-r--r--discord/utils.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/discord/utils.py b/discord/utils.py
index f898a650..49d3f441 100644
--- a/discord/utils.py
+++ b/discord/utils.py
@@ -72,7 +72,7 @@ __all__ = (
DISCORD_EPOCH = 1420070400000
-class cached_property:
+class _cached_property:
def __init__(self, function):
self.function = function
self.__doc__ = getattr(function, '__doc__')
@@ -88,7 +88,7 @@ class cached_property:
if TYPE_CHECKING:
- from functools import cached_property
+ from functools import cached_property as cached_property
from .permissions import Permissions
from .abc import Snowflake
from .invite import Invite
@@ -97,6 +97,9 @@ if TYPE_CHECKING:
class _RequestLike(Protocol):
headers: Dict[str, Any]
+else:
+ cached_property = _cached_property
+
T = TypeVar('T')
T_co = TypeVar('T_co', covariant=True)