Fix issues with imports causing NameErrors
This commit is contained in:
		| @@ -63,6 +63,8 @@ if TYPE_CHECKING: | |||||||
|     from .embeds import Embed |     from .embeds import Embed | ||||||
|     from .message import Message, MessageReference |     from .message import Message, MessageReference | ||||||
|  |  | ||||||
|  |     SnowflakeTime = Union["Snowflake", datetime] | ||||||
|  |  | ||||||
| MISSING = utils.MISSING | MISSING = utils.MISSING | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -98,8 +100,6 @@ class Snowflake(Protocol): | |||||||
|         """:class:`datetime.datetime`: Returns the model's creation time as an aware datetime in UTC.""" |         """:class:`datetime.datetime`: Returns the model's creation time as an aware datetime in UTC.""" | ||||||
|         raise NotImplementedError |         raise NotImplementedError | ||||||
|  |  | ||||||
| SnowflakeTime = Union[Snowflake, datetime] |  | ||||||
|  |  | ||||||
| @runtime_checkable | @runtime_checkable | ||||||
| class User(Snowflake, Protocol): | class User(Snowflake, Protocol): | ||||||
|     """An ABC that details the common operations on a Discord user. |     """An ABC that details the common operations on a Discord user. | ||||||
|   | |||||||
| @@ -22,6 +22,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||||||
| DEALINGS IN THE SOFTWARE. | DEALINGS IN THE SOFTWARE. | ||||||
| """ | """ | ||||||
|  |  | ||||||
|  | from __future__ import annotations | ||||||
|  |  | ||||||
| import copy | import copy | ||||||
| from collections import namedtuple | from collections import namedtuple | ||||||
| from typing import Dict, List, Literal, Optional, TYPE_CHECKING, Union, overload | from typing import Dict, List, Literal, Optional, TYPE_CHECKING, Union, overload | ||||||
| @@ -50,6 +52,7 @@ __all__ = ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| if TYPE_CHECKING: | if TYPE_CHECKING: | ||||||
|  |     from .abc import SnowflakeTime | ||||||
|     from .types.guild import ( |     from .types.guild import ( | ||||||
|         Ban as BanPayload |         Ban as BanPayload | ||||||
|     ) |     ) | ||||||
| @@ -1352,7 +1355,7 @@ class Guild(Hashable): | |||||||
|  |  | ||||||
|         return [convert(d) for d in data] |         return [convert(d) for d in data] | ||||||
|  |  | ||||||
|     def fetch_members(self, *, limit: int = 1000, after: Optional[abc.SnowflakeTime] = None) -> List[Member]: |     def fetch_members(self, *, limit: int = 1000, after: Optional[SnowflakeTime] = None) -> List[Member]: | ||||||
|         """Retrieves an :class:`.AsyncIterator` that enables receiving the guild's members. In order to use this, |         """Retrieves an :class:`.AsyncIterator` that enables receiving the guild's members. In order to use this, | ||||||
|         :meth:`Intents.members` must be enabled. |         :meth:`Intents.members` must be enabled. | ||||||
|  |  | ||||||
| @@ -2221,8 +2224,8 @@ class Guild(Hashable): | |||||||
|         self, |         self, | ||||||
|         *, |         *, | ||||||
|         limit: int = 100, |         limit: int = 100, | ||||||
|         before: Optional[abc.SnowflakeTime] = None, |         before: Optional[SnowflakeTime] = None, | ||||||
|         after: Optional[abc.SnowflakeTime] = None, |         after: Optional[SnowflakeTime] = None, | ||||||
|         oldest_first: Optional[bool] = None, |         oldest_first: Optional[bool] = None, | ||||||
|         user: abc.Snowflake = None, |         user: abc.Snowflake = None, | ||||||
|         action: AuditLogAction = None |         action: AuditLogAction = None | ||||||
|   | |||||||
| @@ -22,6 +22,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||||||
| DEALINGS IN THE SOFTWARE. | DEALINGS IN THE SOFTWARE. | ||||||
| """ | """ | ||||||
|  |  | ||||||
|  | from __future__ import annotations | ||||||
|  |  | ||||||
| import datetime | import datetime | ||||||
| import inspect | import inspect | ||||||
| import itertools | import itertools | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user