Define utils.cached_property in if TYPE_CHECKING guard
This commit is contained in:
		| @@ -72,7 +72,7 @@ __all__ = ( | |||||||
| DISCORD_EPOCH = 1420070400000 | DISCORD_EPOCH = 1420070400000 | ||||||
|  |  | ||||||
|  |  | ||||||
| class cached_property: | class _cached_property: | ||||||
|     def __init__(self, function): |     def __init__(self, function): | ||||||
|         self.function = function |         self.function = function | ||||||
|         self.__doc__ = getattr(function, '__doc__') |         self.__doc__ = getattr(function, '__doc__') | ||||||
| @@ -88,7 +88,7 @@ class cached_property: | |||||||
|  |  | ||||||
|  |  | ||||||
| if TYPE_CHECKING: | if TYPE_CHECKING: | ||||||
|     from functools import cached_property |     from functools import cached_property as cached_property | ||||||
|     from .permissions import Permissions |     from .permissions import Permissions | ||||||
|     from .abc import Snowflake |     from .abc import Snowflake | ||||||
|     from .invite import Invite |     from .invite import Invite | ||||||
| @@ -97,6 +97,9 @@ if TYPE_CHECKING: | |||||||
|     class _RequestLike(Protocol): |     class _RequestLike(Protocol): | ||||||
|         headers: Dict[str, Any] |         headers: Dict[str, Any] | ||||||
|  |  | ||||||
|  | else: | ||||||
|  |     cached_property = _cached_property | ||||||
|  |  | ||||||
|  |  | ||||||
| T = TypeVar('T') | T = TypeVar('T') | ||||||
| T_co = TypeVar('T_co', covariant=True) | T_co = TypeVar('T_co', covariant=True) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user