Browse Source

Fix issues with imports causing NameErrors

pull/6905/head
Josh 4 years ago
committed by GitHub
parent
commit
5fa64e83e0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      discord/abc.py
  2. 9
      discord/guild.py
  3. 2
      discord/member.py

4
discord/abc.py

@ -63,6 +63,8 @@ if TYPE_CHECKING:
from .embeds import Embed
from .message import Message, MessageReference
SnowflakeTime = Union["Snowflake", datetime]
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."""
raise NotImplementedError
SnowflakeTime = Union[Snowflake, datetime]
@runtime_checkable
class User(Snowflake, Protocol):
"""An ABC that details the common operations on a Discord user.

9
discord/guild.py

@ -22,6 +22,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""
from __future__ import annotations
import copy
from collections import namedtuple
from typing import Dict, List, Literal, Optional, TYPE_CHECKING, Union, overload
@ -50,6 +52,7 @@ __all__ = (
)
if TYPE_CHECKING:
from .abc import SnowflakeTime
from .types.guild import (
Ban as BanPayload
)
@ -1352,7 +1355,7 @@ class Guild(Hashable):
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,
:meth:`Intents.members` must be enabled.
@ -2221,8 +2224,8 @@ class Guild(Hashable):
self,
*,
limit: int = 100,
before: Optional[abc.SnowflakeTime] = None,
after: Optional[abc.SnowflakeTime] = None,
before: Optional[SnowflakeTime] = None,
after: Optional[SnowflakeTime] = None,
oldest_first: Optional[bool] = None,
user: abc.Snowflake = None,
action: AuditLogAction = None

2
discord/member.py

@ -22,6 +22,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""
from __future__ import annotations
import datetime
import inspect
import itertools

Loading…
Cancel
Save