Add __all__ to remaining modules

This commit is contained in:
Nadir Chowdhury 2021-04-07 07:30:32 +01:00 committed by GitHub
parent ed1341012b
commit 89456022cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 210 additions and 26 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -39,6 +39,18 @@ import warnings
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
class cached_property:

View File

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

View File

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