Browse Source

Add `__all__` to remaining modules

pull/6664/head
Nadir Chowdhury 4 years ago
committed by GitHub
parent
commit
89456022cf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 48
      discord/__init__.py
  2. 9
      discord/abc.py
  3. 3
      discord/appinfo.py
  4. 4
      discord/asset.py
  5. 6
      discord/audit_logs.py
  6. 4
      discord/backoff.py
  7. 4
      discord/client.py
  8. 5
      discord/colour.py
  9. 4
      discord/context_managers.py
  10. 4
      discord/embeds.py
  11. 4
      discord/emoji.py
  12. 16
      discord/errors.py
  13. 4
      discord/ext/commands/__init__.py
  14. 7
      discord/ext/commands/bot.py
  15. 4
      discord/ext/commands/context.py
  16. 4
      discord/ext/tasks/__init__.py
  17. 4
      discord/file.py
  18. 3
      discord/guild.py
  19. 5
      discord/integrations.py
  20. 6
      discord/invite.py
  21. 5
      discord/member.py
  22. 4
      discord/mentions.py
  23. 5
      discord/mixins.py
  24. 4
      discord/object.py
  25. 6
      discord/oggparse.py
  26. 6
      discord/opus.py
  27. 3
      discord/partial_emoji.py
  28. 9
      discord/raw_models.py
  29. 4
      discord/reaction.py
  30. 5
      discord/role.py
  31. 5
      discord/shard.py
  32. 4
      discord/sticker.py
  33. 5
      discord/user.py
  34. 12
      discord/utils.py
  35. 5
      discord/voice_client.py
  36. 6
      discord/widget.py

48
discord/__init__.py

@ -20,41 +20,41 @@ __path__ = __import__('pkgutil').extend_path(__path__, __name__)
from collections import namedtuple from collections import namedtuple
import logging import logging
from .client import Client from .client import *
from .appinfo import AppInfo from .appinfo import *
from .user import User, ClientUser from .user import *
from .emoji import Emoji from .emoji import *
from .partial_emoji import PartialEmoji from .partial_emoji import *
from .activity import * from .activity import *
from .channel import * from .channel import *
from .guild import Guild from .guild import *
from .flags import * from .flags import *
from .member import Member, VoiceState from .member import *
from .message import * from .message import *
from .asset import Asset from .asset import *
from .errors import * from .errors import *
from .permissions import Permissions, PermissionOverwrite from .permissions import *
from .role import Role, RoleTags from .role import *
from .file import File from .file import *
from .colour import Color, Colour from .colour import *
from .integrations import Integration, IntegrationAccount from .integrations import *
from .invite import Invite, PartialInviteChannel, PartialInviteGuild from .invite import *
from .template import Template from .template import *
from .widget import Widget, WidgetMember, WidgetChannel from .widget import *
from .object import Object from .object import *
from .reaction import Reaction from .reaction import *
from . import utils, opus, abc from . import utils, opus, abc
from .enums import * from .enums import *
from .embeds import Embed from .embeds import *
from .mentions import AllowedMentions from .mentions import *
from .shard import AutoShardedClient, ShardInfo from .shard import *
from .player import * from .player import *
from .webhook import * from .webhook import *
from .voice_client import VoiceClient, VoiceProtocol from .voice_client import *
from .audit_logs import AuditLogChanges, AuditLogEntry, AuditLogDiff from .audit_logs import *
from .raw_models import * from .raw_models import *
from .team import * from .team import *
from .sticker import Sticker from .sticker import *
from .interactions import * from .interactions import *
VersionInfo = namedtuple('VersionInfo', 'major minor micro releaselevel serial') VersionInfo = namedtuple('VersionInfo', 'major minor micro releaselevel serial')

9
discord/abc.py

@ -41,6 +41,15 @@ from .file import File
from .voice_client import VoiceClient, VoiceProtocol from .voice_client import VoiceClient, VoiceProtocol
from . import utils from . import utils
__all__ = (
'Snowflake',
'User',
'PrivateChannel',
'GuildChannel',
'Messageable',
'Connectable',
)
if TYPE_CHECKING: if TYPE_CHECKING:
from datetime import datetime from datetime import datetime

3
discord/appinfo.py

@ -27,6 +27,9 @@ from .user import User
from .asset import Asset from .asset import Asset
from .team import Team from .team import Team
__all__ = (
'AppInfo',
)
class AppInfo: class AppInfo:
"""Represents the application info for the bot provided by Discord. """Represents the application info for the bot provided by Discord.

4
discord/asset.py

@ -27,6 +27,10 @@ from .errors import DiscordException
from .errors import InvalidArgument from .errors import InvalidArgument
from . import utils from . import utils
__all__ = (
'Asset',
)
VALID_STATIC_FORMATS = frozenset({"jpeg", "jpg", "webp", "png"}) VALID_STATIC_FORMATS = frozenset({"jpeg", "jpg", "webp", "png"})
VALID_AVATAR_FORMATS = VALID_STATIC_FORMATS | {"gif"} VALID_AVATAR_FORMATS = VALID_STATIC_FORMATS | {"gif"}

6
discord/audit_logs.py

@ -29,6 +29,12 @@ from .colour import Colour
from .invite import Invite from .invite import Invite
from .mixins import Hashable from .mixins import Hashable
__all__ = (
'AuditLogDiff',
'AuditLogChanges',
'AuditLogEntry',
)
def _transform_verification_level(entry, data): def _transform_verification_level(entry, data):
return enums.try_enum(enums.VerificationLevel, data) return enums.try_enum(enums.VerificationLevel, data)

4
discord/backoff.py

@ -25,6 +25,10 @@ DEALINGS IN THE SOFTWARE.
import time import time
import random import random
__all__ = (
'ExponentialBackoff',
)
class ExponentialBackoff: class ExponentialBackoff:
"""An implementation of the exponential backoff algorithm """An implementation of the exponential backoff algorithm

4
discord/client.py

@ -52,6 +52,10 @@ from .webhook import Webhook
from .iterators import GuildIterator from .iterators import GuildIterator
from .appinfo import AppInfo from .appinfo import AppInfo
__all__ = (
'Client',
)
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
def _cancel_tasks(loop): def _cancel_tasks(loop):

5
discord/colour.py

@ -25,6 +25,11 @@ DEALINGS IN THE SOFTWARE.
import colorsys import colorsys
import random import random
__all__ = (
'Colour',
'Color',
)
class Colour: class Colour:
"""Represents a Discord role colour. This class is similar """Represents a Discord role colour. This class is similar
to a (red, green, blue) :class:`tuple`. to a (red, green, blue) :class:`tuple`.

4
discord/context_managers.py

@ -24,6 +24,10 @@ DEALINGS IN THE SOFTWARE.
import asyncio import asyncio
__all__ = (
'Typing',
)
def _typing_done_callback(fut): def _typing_done_callback(fut):
# just retrieve any exception and call it a day # just retrieve any exception and call it a day
try: try:

4
discord/embeds.py

@ -27,6 +27,10 @@ import datetime
from . import utils from . import utils
from .colour import Colour from .colour import Colour
__all__ = (
'Embed',
)
class _EmptyEmbed: class _EmptyEmbed:
def __bool__(self): def __bool__(self):
return False return False

4
discord/emoji.py

@ -27,6 +27,10 @@ from . import utils
from .partial_emoji import _EmojiTag from .partial_emoji import _EmojiTag
from .user import User from .user import User
__all__ = (
'Emoji',
)
class Emoji(_EmojiTag): class Emoji(_EmojiTag):
"""Represents a custom emoji. """Represents a custom emoji.

16
discord/errors.py

@ -22,6 +22,22 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
""" """
__all__ = (
'DiscordException',
'ClientException',
'NoMoreItems',
'GatewayNotFound',
'HTTPException',
'Forbidden',
'NotFound',
'DiscordServerError',
'InvalidData',
'InvalidArgument',
'LoginFailure',
'ConnectionClosed',
'PrivilegedIntentsRequired',
)
class DiscordException(Exception): class DiscordException(Exception):
"""Base exception class for discord.py """Base exception class for discord.py

4
discord/ext/commands/__init__.py

@ -8,8 +8,8 @@ An extension module to facilitate creation of bot commands.
:license: MIT, see LICENSE for more details. :license: MIT, see LICENSE for more details.
""" """
from .bot import Bot, AutoShardedBot, when_mentioned, when_mentioned_or from .bot import *
from .context import Context from .context import *
from .core import * from .core import *
from .errors import * from .errors import *
from .help import * from .help import *

7
discord/ext/commands/bot.py

@ -39,6 +39,13 @@ from . import errors
from .help import HelpCommand, DefaultHelpCommand from .help import HelpCommand, DefaultHelpCommand
from .cog import Cog from .cog import Cog
__all__ = (
'when_mentioned',
'when_mentioned_or',
'Bot',
'AutoShardedBot',
)
def when_mentioned(bot, msg): def when_mentioned(bot, msg):
"""A callable that implements a command prefix equivalent to being mentioned. """A callable that implements a command prefix equivalent to being mentioned.

4
discord/ext/commands/context.py

@ -25,6 +25,10 @@ DEALINGS IN THE SOFTWARE.
import discord.abc import discord.abc
import discord.utils import discord.utils
__all__ = (
'Context',
)
class Context(discord.abc.Messageable): class Context(discord.abc.Messageable):
r"""Represents the context in which a command is being invoked under. r"""Represents the context in which a command is being invoked under.

4
discord/ext/tasks/__init__.py

@ -35,6 +35,10 @@ from discord.backoff import ExponentialBackoff
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
__all__ = (
'loop',
)
class Loop: class Loop:
"""A background task helper that abstracts the loop and reconnection logic for you. """A background task helper that abstracts the loop and reconnection logic for you.

4
discord/file.py

@ -25,6 +25,10 @@ DEALINGS IN THE SOFTWARE.
import os.path import os.path
import io import io
__all__ = (
'File',
)
class File: class File:
r"""A parameter object used for :meth:`abc.Messageable.send` r"""A parameter object used for :meth:`abc.Messageable.send`
for sending file objects. for sending file objects.

3
discord/guild.py

@ -44,6 +44,9 @@ from .asset import Asset
from .flags import SystemChannelFlags from .flags import SystemChannelFlags
from .integrations import Integration from .integrations import Integration
__all__ = (
'Guild',
)
BanEntry = namedtuple('BanEntry', 'reason user') BanEntry = namedtuple('BanEntry', 'reason user')
_GuildLimit = namedtuple('_GuildLimit', 'emoji bitrate filesize') _GuildLimit = namedtuple('_GuildLimit', 'emoji bitrate filesize')

5
discord/integrations.py

@ -28,6 +28,11 @@ from .user import User
from .errors import InvalidArgument from .errors import InvalidArgument
from .enums import try_enum, ExpireBehaviour from .enums import try_enum, ExpireBehaviour
__all__ = (
'IntegrationAccount',
'Integration',
)
class IntegrationAccount: class IntegrationAccount:
"""Represents an integration account. """Represents an integration account.

6
discord/invite.py

@ -28,6 +28,12 @@ from .object import Object
from .mixins import Hashable from .mixins import Hashable
from .enums import ChannelType, VerificationLevel, try_enum from .enums import ChannelType, VerificationLevel, try_enum
__all__ = (
'PartialInviteChannel',
'PartialInviteGuild',
'Invite',
)
class PartialInviteChannel: class PartialInviteChannel:
"""Represents a "partial" invite channel. """Represents a "partial" invite channel.

5
discord/member.py

@ -39,6 +39,11 @@ from .enums import Status, try_enum
from .colour import Colour from .colour import Colour
from .object import Object from .object import Object
__all__ = (
'VoiceState',
'Member',
)
class VoiceState: class VoiceState:
"""Represents a Discord user's voice state. """Represents a Discord user's voice state.

4
discord/mentions.py

@ -22,6 +22,10 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
""" """
__all__ = (
'AllowedMentions',
)
class _FakeBool: class _FakeBool:
def __repr__(self): def __repr__(self):
return 'True' return 'True'

5
discord/mixins.py

@ -22,6 +22,11 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
""" """
__all__ = (
'EqualityComparable',
'Hashable',
)
class EqualityComparable: class EqualityComparable:
__slots__ = () __slots__ = ()

4
discord/object.py

@ -25,6 +25,10 @@ DEALINGS IN THE SOFTWARE.
from . import utils from . import utils
from .mixins import Hashable from .mixins import Hashable
__all__ = (
'Object',
)
class Object(Hashable): class Object(Hashable):
"""Represents a generic Discord object. """Represents a generic Discord object.

6
discord/oggparse.py

@ -26,6 +26,12 @@ import struct
from .errors import DiscordException from .errors import DiscordException
__all__ = (
'OggError',
'OggPage',
'OggStream',
)
class OggError(DiscordException): class OggError(DiscordException):
"""An exception that is thrown for Ogg stream parsing errors.""" """An exception that is thrown for Ogg stream parsing errors."""
pass pass

6
discord/opus.py

@ -33,6 +33,12 @@ import sys
from .errors import DiscordException from .errors import DiscordException
__all__ = (
'Encoder',
'OpusError',
'OpusNotLoaded',
)
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
c_int_ptr = ctypes.POINTER(ctypes.c_int) c_int_ptr = ctypes.POINTER(ctypes.c_int)

3
discord/partial_emoji.py

@ -25,6 +25,9 @@ DEALINGS IN THE SOFTWARE.
from .asset import Asset from .asset import Asset
from . import utils from . import utils
__all__ = (
'PartialEmoji',
)
class _EmojiTag: class _EmojiTag:
__slots__ = () __slots__ = ()

9
discord/raw_models.py

@ -22,6 +22,15 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
""" """
__all__ = (
'RawMessageDeleteEvent',
'RawBulkMessageDeleteEvent',
'RawMessageUpdateEvent',
'RawReactionActionEvent',
'RawReactionClearEvent',
'RawReactionClearEmojiEvent',
)
class _RawReprMixin: class _RawReprMixin:
def __repr__(self): def __repr__(self):
value = ' '.join(f'{attr}={getattr(self, attr)!r}' for attr in self.__slots__) value = ' '.join(f'{attr}={getattr(self, attr)!r}' for attr in self.__slots__)

4
discord/reaction.py

@ -24,6 +24,10 @@ DEALINGS IN THE SOFTWARE.
from .iterators import ReactionIterator from .iterators import ReactionIterator
__all__ = (
'Reaction',
)
class Reaction: class Reaction:
"""Represents a reaction to a message. """Represents a reaction to a message.

5
discord/role.py

@ -28,6 +28,11 @@ from .colour import Colour
from .mixins import Hashable from .mixins import Hashable
from .utils import snowflake_time, _get_as_snowflake from .utils import snowflake_time, _get_as_snowflake
__all__ = (
'RoleTags',
'Role',
)
class RoleTags: class RoleTags:
"""Represents tags on a role. """Represents tags on a role.

5
discord/shard.py

@ -44,6 +44,11 @@ from .errors import (
from . import utils from . import utils
from .enums import Status from .enums import Status
__all__ = (
'AutoShardedClient',
'ShardInfo',
)
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class EventType: class EventType:

4
discord/sticker.py

@ -27,6 +27,10 @@ from .asset import Asset
from .utils import snowflake_time from .utils import snowflake_time
from .enums import StickerType, try_enum from .enums import StickerType, try_enum
__all__ = (
'Sticker',
)
class Sticker(Hashable): class Sticker(Hashable):
"""Represents a sticker """Represents a sticker

5
discord/user.py

@ -29,6 +29,11 @@ from .enums import DefaultAvatar, try_enum
from .colour import Colour from .colour import Colour
from .asset import Asset from .asset import Asset
__all__ = (
'User',
'ClientUser',
)
_BaseUser = discord.abc.User _BaseUser = discord.abc.User
class BaseUser(_BaseUser): class BaseUser(_BaseUser):

12
discord/utils.py

@ -39,6 +39,18 @@ import warnings
from .errors import InvalidArgument from .errors import InvalidArgument
__all__ = (
'oauth_uri',
'snowflake_time',
'time_snowflake',
'find',
'get',
'sleep_until',
'utcnow',
'remove_markdown',
'escape_markdown',
'escape_mentions',
)
DISCORD_EPOCH = 1420070400000 DISCORD_EPOCH = 1420070400000
class cached_property: class cached_property:

5
discord/voice_client.py

@ -55,6 +55,11 @@ try:
except ImportError: except ImportError:
has_nacl = False has_nacl = False
__all__ = (
'VoiceProtocol',
'VoiceClient',
)
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class VoiceProtocol: class VoiceProtocol:

6
discord/widget.py

@ -28,6 +28,12 @@ from .activity import create_activity
from .invite import Invite from .invite import Invite
from .enums import Status, try_enum from .enums import Status, try_enum
__all__ = (
'WidgetChannel',
'WidgetMember',
'Widget',
)
class WidgetChannel: class WidgetChannel:
"""Represents a "partial" widget channel. """Represents a "partial" widget channel.

Loading…
Cancel
Save