aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2019-04-20 17:20:58 -0400
committerRapptz <[email protected]>2019-04-20 17:20:58 -0400
commit919dbcafb33eb4e2bb595d7e607f525cf2d02178 (patch)
tree206ca4b5430c72854cc818c55d82ce8a641ff9ee
parent[commands] Clean docstrings in Command.parents and Command.root_parent (diff)
downloaddiscord.py-919dbcafb33eb4e2bb595d7e607f525cf2d02178.tar.xz
discord.py-919dbcafb33eb4e2bb595d7e607f525cf2d02178.zip
Consistent use of __all__ to prevent merge conflicts.
-rw-r--r--discord/activity.py7
-rw-r--r--discord/channel.py4
-rw-r--r--discord/enums.py26
-rw-r--r--discord/ext/commands/cog.py5
-rw-r--r--discord/ext/commands/converter.py23
-rw-r--r--discord/ext/commands/cooldowns.py6
-rw-r--r--discord/ext/commands/core.py23
-rw-r--r--discord/ext/commands/errors.py45
-rw-r--r--discord/ext/commands/help.py4
-rw-r--r--discord/gateway.py9
-rw-r--r--discord/player.py7
-rw-r--r--discord/webhook.py7
12 files changed, 130 insertions, 36 deletions
diff --git a/discord/activity.py b/discord/activity.py
index 736b875f..98fd5901 100644
--- a/discord/activity.py
+++ b/discord/activity.py
@@ -30,7 +30,12 @@ from .enums import ActivityType, try_enum
from .colour import Colour
from .utils import _get_as_snowflake
-__all__ = ['Activity', 'Streaming', 'Game', 'Spotify']
+__all__ = (
+ 'Activity',
+ 'Streaming',
+ 'Game',
+ 'Spotify',
+)
"""If curious, this is the current schema for an activity.
diff --git a/discord/channel.py b/discord/channel.py
index 0d472a11..c346bfcc 100644
--- a/discord/channel.py
+++ b/discord/channel.py
@@ -36,7 +36,7 @@ from .asset import Asset
from .errors import ClientException, NoMoreItems
from .webhook import Webhook
-__all__ = [
+__all__ = (
'TextChannel',
'VoiceChannel',
'DMChannel',
@@ -44,7 +44,7 @@ __all__ = [
'StoreChannel',
'GroupChannel',
'_channel_factory',
-]
+)
async def _single_delete_strategy(messages):
for m in messages:
diff --git a/discord/enums.py b/discord/enums.py
index 4c59dbf9..177f88ca 100644
--- a/discord/enums.py
+++ b/discord/enums.py
@@ -26,11 +26,27 @@ DEALINGS IN THE SOFTWARE.
from enum import Enum
-__all__ = ['ChannelType', 'MessageType', 'VoiceRegion', 'SpeakingState',
- 'VerificationLevel', 'ContentFilter', 'Status', 'DefaultAvatar',
- 'RelationshipType', 'AuditLogAction', 'AuditLogActionCategory',
- 'UserFlags', 'ActivityType', 'HypeSquadHouse', 'NotificationLevel',
- 'PremiumType', 'UserContentFilter', 'FriendFlags', 'Theme']
+__all__ = (
+ 'ChannelType',
+ 'MessageType',
+ 'VoiceRegion',
+ 'SpeakingState',
+ 'VerificationLevel',
+ 'ContentFilter',
+ 'Status',
+ 'DefaultAvatar',
+ 'RelationshipType',
+ 'AuditLogAction',
+ 'AuditLogActionCategory',
+ 'UserFlags',
+ 'ActivityType',
+ 'HypeSquadHouse',
+ 'NotificationLevel',
+ 'PremiumType',
+ 'UserContentFilter',
+ 'FriendFlags',
+ 'Theme',
+)
def fast_lookup(cls):
# NOTE: implies hashable
diff --git a/discord/ext/commands/cog.py b/discord/ext/commands/cog.py
index 6d5be625..66988a02 100644
--- a/discord/ext/commands/cog.py
+++ b/discord/ext/commands/cog.py
@@ -28,7 +28,10 @@ import inspect
import copy
from ._types import _BaseCommand
-__all__ = ('CogMeta', 'Cog')
+__all__ = (
+ 'CogMeta',
+ 'Cog',
+)
class CogMeta(type):
"""A怀metaclass for defining a cog.
diff --git a/discord/ext/commands/converter.py b/discord/ext/commands/converter.py
index fdce15d1..78c9bbf4 100644
--- a/discord/ext/commands/converter.py
+++ b/discord/ext/commands/converter.py
@@ -31,11 +31,24 @@ import discord
from .errors import BadArgument, NoPrivateMessage
-__all__ = ['Converter', 'MemberConverter', 'UserConverter', 'MessageConverter',
- 'TextChannelConverter', 'InviteConverter', 'RoleConverter',
- 'GameConverter', 'ColourConverter', 'VoiceChannelConverter',
- 'EmojiConverter', 'PartialEmojiConverter', 'CategoryChannelConverter',
- 'IDConverter', 'clean_content', 'Greedy']
+__all__ = (
+ 'Converter',
+ 'MemberConverter',
+ 'UserConverter',
+ 'MessageConverter',
+ 'TextChannelConverter',
+ 'InviteConverter',
+ 'RoleConverter',
+ 'GameConverter',
+ 'ColourConverter',
+ 'VoiceChannelConverter',
+ 'EmojiConverter',
+ 'PartialEmojiConverter',
+ 'CategoryChannelConverter',
+ 'IDConverter',
+ 'clean_content',
+ 'Greedy',
+)
def _get_from_guilds(bot, getter, argument):
result = None
diff --git a/discord/ext/commands/cooldowns.py b/discord/ext/commands/cooldowns.py
index 02d5c64d..c7a200c9 100644
--- a/discord/ext/commands/cooldowns.py
+++ b/discord/ext/commands/cooldowns.py
@@ -27,7 +27,11 @@ DEALINGS IN THE SOFTWARE.
import enum
import time
-__all__ = ['BucketType', 'Cooldown', 'CooldownMapping']
+__all__ = (
+ 'BucketType',
+ 'Cooldown',
+ 'CooldownMapping',
+)
class BucketType(enum.Enum):
default = 0
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index 321e2c3b..c8f74f56 100644
--- a/discord/ext/commands/core.py
+++ b/discord/ext/commands/core.py
@@ -38,10 +38,25 @@ from . import converter as converters
from ._types import _BaseCommand
from .cog import Cog
-__all__ = ['Command', 'Group', 'GroupMixin', 'command', 'group',
- 'has_role', 'has_permissions', 'has_any_role', 'check',
- 'bot_has_role', 'bot_has_permissions', 'bot_has_any_role',
- 'cooldown', 'dm_only', 'guild_only', 'is_owner', 'is_nsfw']
+__all__ = (
+ 'Command',
+ 'Group',
+ 'GroupMixin',
+ 'command',
+ 'group',
+ 'has_role',
+ 'has_permissions',
+ 'has_any_role',
+ 'check',
+ 'bot_has_role',
+ 'bot_has_permissions',
+ 'bot_has_any_role',
+ 'cooldown',
+ 'dm_only',
+ 'guild_only',
+ 'is_owner',
+ 'is_nsfw',
+)
def wrap_callback(coro):
@functools.wraps(coro)
diff --git a/discord/ext/commands/errors.py b/discord/ext/commands/errors.py
index fff179a2..e41f36bd 100644
--- a/discord/ext/commands/errors.py
+++ b/discord/ext/commands/errors.py
@@ -27,17 +27,40 @@ DEALINGS IN THE SOFTWARE.
from discord.errors import DiscordException
-__all__ = ['CommandError', 'MissingRequiredArgument', 'BadArgument',
- 'PrivateMessageOnly', 'NoPrivateMessage', 'CheckFailure',
- 'CommandNotFound', 'DisabledCommand', 'CommandInvokeError',
- 'TooManyArguments','UserInputError', 'CommandOnCooldown',
- 'NotOwner', 'MissingRole', 'BotMissingRole', 'MissingAnyRole',
- 'BotMissingAnyRole','MissingPermissions', 'BotMissingPermissions',
- 'NSFWChannelRequired', 'ConversionError', 'BadUnionArgument',
- 'ArgumentParsingError', 'UnexpectedQuoteError', 'InvalidEndOfQuotedStringError',
- 'ExpectedClosingQuoteError', 'ExtensionError', 'ExtensionAlreadyLoaded',
- 'ExtensionNotLoaded', 'NoEntryPointError', 'ExtensionFailed',
- 'ExtensionNotFound']
+__all__ = (
+ 'CommandError',
+ 'MissingRequiredArgument',
+ 'BadArgument',
+ 'PrivateMessageOnly',
+ 'NoPrivateMessage',
+ 'CheckFailure',
+ 'CommandNotFound',
+ 'DisabledCommand',
+ 'CommandInvokeError',
+ 'TooManyArguments',
+ 'UserInputError',
+ 'CommandOnCooldown',
+ 'NotOwner',
+ 'MissingRole',
+ 'BotMissingRole',
+ 'MissingAnyRole',
+ 'BotMissingAnyRole',
+ 'MissingPermissions',
+ 'BotMissingPermissions',
+ 'NSFWChannelRequired',
+ 'ConversionError',
+ 'BadUnionArgument',
+ 'ArgumentParsingError',
+ 'UnexpectedQuoteError',
+ 'InvalidEndOfQuotedStringError',
+ 'ExpectedClosingQuoteError',
+ 'ExtensionError',
+ 'ExtensionAlreadyLoaded',
+ 'ExtensionNotLoaded',
+ 'NoEntryPointError',
+ 'ExtensionFailed',
+ 'ExtensionNotFound',
+)
class CommandError(DiscordException):
r"""The base exception type for all command related errors.
diff --git a/discord/ext/commands/help.py b/discord/ext/commands/help.py
index cafc20f3..19c762e8 100644
--- a/discord/ext/commands/help.py
+++ b/discord/ext/commands/help.py
@@ -33,12 +33,12 @@ import discord.utils
from .core import Group, Command
from .errors import CommandError
-__all__ = [
+__all__ = (
'Paginator',
'HelpCommand',
'DefaultHelpCommand',
'MinimalHelpCommand',
-]
+)
# help -> shows info of bot on top/bottom and lists subcommands
# help command -> shows detailed info of command
diff --git a/discord/gateway.py b/discord/gateway.py
index bc9a17a2..bf51377f 100644
--- a/discord/gateway.py
+++ b/discord/gateway.py
@@ -44,8 +44,13 @@ from .errors import ConnectionClosed, InvalidArgument
log = logging.getLogger(__name__)
-__all__ = ['DiscordWebSocket', 'KeepAliveHandler', 'VoiceKeepAliveHandler',
- 'DiscordVoiceWebSocket', 'ResumeWebSocket']
+__all__ = (
+ 'DiscordWebSocket',
+ 'KeepAliveHandler',
+ 'VoiceKeepAliveHandler',
+ 'DiscordVoiceWebSocket',
+ 'ResumeWebSocket',
+)
class ResumeWebSocket(Exception):
"""Signals to initialise via RESUME opcode instead of IDENTIFY."""
diff --git a/discord/player.py b/discord/player.py
index 345edcbc..3834a44a 100644
--- a/discord/player.py
+++ b/discord/player.py
@@ -37,7 +37,12 @@ from .opus import Encoder as OpusEncoder
log = logging.getLogger(__name__)
-__all__ = ['AudioSource', 'PCMAudio', 'FFmpegPCMAudio', 'PCMVolumeTransformer']
+__all__ = (
+ 'AudioSource',
+ 'PCMAudio',
+ 'FFmpegPCMAudio',
+ 'PCMVolumeTransformer',
+)
class AudioSource:
"""Represents an audio stream.
diff --git a/discord/webhook.py b/discord/webhook.py
index 6343b852..1317e627 100644
--- a/discord/webhook.py
+++ b/discord/webhook.py
@@ -36,7 +36,12 @@ from .errors import InvalidArgument, HTTPException, Forbidden, NotFound
from .user import BaseUser, User
from .asset import Asset
-__all__ = ['WebhookAdapter', 'AsyncWebhookAdapter', 'RequestsWebhookAdapter', 'Webhook']
+__all__ = (
+ 'WebhookAdapter',
+ 'AsyncWebhookAdapter',
+ 'RequestsWebhookAdapter',
+ 'Webhook',
+)
class WebhookAdapter:
"""Base class for all webhook adapters.