[lint] Fix incorrect and inconsistent whitespace

Adjust whitespace to be consistent with the rest of the library.
This commit is contained in:
Hornwitser 2018-06-22 16:08:27 +02:00 committed by Rapptz
parent 3679819c53
commit c8b49d37be
26 changed files with 62 additions and 66 deletions

View File

@ -153,4 +153,3 @@ class GroupCall:
"""
return self._voice_states.get(user.id)

View File

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
@ -79,8 +80,8 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
top channel is position 0.
"""
__slots__ = ( 'name', 'id', 'guild', 'topic', '_state', 'nsfw',
'category_id', 'position', '_overwrites' )
__slots__ = ('name', 'id', 'guild', 'topic', '_state', 'nsfw',
'category_id', 'position', '_overwrites')
def __init__(self, *, state, guild, data):
self._state = state
@ -415,7 +416,7 @@ class VoiceChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable):
"""
__slots__ = ('name', 'id', 'guild', 'bitrate', 'user_limit',
'_state', 'position', '_overwrites', 'category_id' )
'_state', 'position', '_overwrites', 'category_id')
def __init__(self, *, state, guild, data):
self._state = state

View File

@ -369,10 +369,8 @@ class Client:
await self.ws.poll_event()
except ResumeWebSocket:
log.info('Got a request to RESUME the websocket.')
coro = DiscordWebSocket.from_client(self, shard_id=self.shard_id,
session=self.ws.session_id,
sequence=self.ws.sequence,
resume=True)
coro = DiscordWebSocket.from_client(self, shard_id=self.shard_id, session=self.ws.session_id,
sequence=self.ws.sequence, resume=True)
self.ws = await asyncio.wait_for(coro, timeout=180.0, loop=self.loop)
async def connect(self, *, reconnect=True):

View File

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)

View File

@ -30,11 +30,11 @@ import inspect
from .errors import BadArgument, NoPrivateMessage
__all__ = [ 'Converter', 'MemberConverter', 'UserConverter',
__all__ = ['Converter', 'MemberConverter', 'UserConverter',
'TextChannelConverter', 'InviteConverter', 'RoleConverter',
'GameConverter', 'ColourConverter', 'VoiceChannelConverter',
'EmojiConverter', 'PartialEmojiConverter', 'CategoryChannelConverter',
'IDConverter', 'clean_content' ]
'IDConverter', 'clean_content']
def _get_from_guilds(bot, getter, argument):
result = None

View File

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)

View File

@ -35,10 +35,10 @@ from .cooldowns import Cooldown, BucketType, CooldownMapping
from .view import quoted_word
from . import converter as converters
__all__ = [ 'Command', 'Group', 'GroupMixin', 'command', 'group',
__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', 'guild_only', 'is_owner', 'is_nsfw', ]
'cooldown', 'guild_only', 'is_owner', 'is_nsfw']
def wrap_callback(coro):
@functools.wraps(coro)

View File

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
@ -26,7 +27,7 @@ DEALINGS IN THE SOFTWARE.
from discord.errors import DiscordException
__all__ = [ 'CommandError', 'MissingRequiredArgument', 'BadArgument',
__all__ = ['CommandError', 'MissingRequiredArgument', 'BadArgument',
'NoPrivateMessage', 'CheckFailure', 'CommandNotFound',
'DisabledCommand', 'CommandInvokeError', 'TooManyArguments',
'UserInputError', 'CommandOnCooldown', 'NotOwner',

View File

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)

View File

@ -40,8 +40,8 @@ import struct
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."""
@ -684,5 +684,3 @@ class DiscordVoiceWebSocket(websockets.client.WebSocketClientProtocol):
self._keep_alive.stop()
await super().close_connection(*args, **kwargs)

View File

@ -339,8 +339,7 @@ class HTTPClient:
return self.request(r, data=form)
async def ack_message(self, channel_id, message_id):
r = Route('POST', '/channels/{channel_id}/messages/{message_id}/ack', channel_id=channel_id,
message_id=message_id)
r = Route('POST', '/channels/{channel_id}/messages/{message_id}/ack', channel_id=channel_id, message_id=message_id)
data = await self.request(r, json={'token': self._ack_token})
self._ack_token = data['token']
@ -348,8 +347,7 @@ class HTTPClient:
return self.request(Route('POST', '/guilds/{guild_id}/ack', guild_id=guild_id))
def delete_message(self, channel_id, message_id, *, reason=None):
r = Route('DELETE', '/channels/{channel_id}/messages/{message_id}', channel_id=channel_id,
message_id=message_id)
r = Route('DELETE', '/channels/{channel_id}/messages/{message_id}', channel_id=channel_id, message_id=message_id)
return self.request(r, reason=reason)
def delete_messages(self, channel_id, message_ids, *, reason=None):
@ -361,8 +359,7 @@ class HTTPClient:
return self.request(r, json=payload, reason=reason)
def edit_message(self, message_id, channel_id, **fields):
r = Route('PATCH', '/channels/{channel_id}/messages/{message_id}', channel_id=channel_id,
message_id=message_id)
r = Route('PATCH', '/channels/{channel_id}/messages/{message_id}', channel_id=channel_id, message_id=message_id)
return self.request(r, json=fields)
def add_reaction(self, message_id, channel_id, emoji):
@ -584,7 +581,7 @@ class HTTPClient:
return self.request(Route('GET', '/guilds/{guild_id}/vanity-url', guild_id=guild_id))
def change_vanity_code(self, guild_id, code, *, reason=None):
payload = { 'code': code }
payload = {'code': code}
return self.request(Route('PATCH', '/guilds/{guild_id}/vanity-url', guild_id=guild_id), json=payload, reason=reason)
def prune_members(self, guild_id, days, *, reason=None):
@ -622,7 +619,7 @@ class HTTPClient:
return self.request(r, json=payload, reason=reason)
def get_audit_logs(self, guild_id, limit=100, before=None, after=None, user_id=None, action_type=None):
params = { 'limit': limit }
params = {'limit': limit}
if before:
params['before'] = before
if after:

View File

@ -78,8 +78,8 @@ class Invite(Hashable):
"""
__slots__ = ( 'max_age', 'code', 'guild', 'revoked', 'created_at', 'uses',
'temporary', 'max_uses', 'inviter', 'channel', '_state' )
__slots__ = ('max_age', 'code', 'guild', 'revoked', 'created_at', 'uses',
'temporary', 'max_uses', 'inviter', 'channel', '_state')
def __init__(self, *, state, data):
self._state = state

View File

@ -57,8 +57,8 @@ class VoiceState:
is not currently in a voice channel.
"""
__slots__ = ( 'session_id', 'deaf', 'mute', 'self_mute',
'self_deaf', 'afk', 'channel' )
__slots__ = ('session_id', 'deaf', 'mute', 'self_mute',
'self_deaf', 'afk', 'channel')
def __init__(self, *, data, channel=None):
self.session_id = data.get('session_id')

View File

@ -194,13 +194,13 @@ class Message:
- ``cover_image``: A string representing the embed's image asset ID.
"""
__slots__ = ( '_edited_timestamp', 'tts', 'content', 'channel', 'webhook_id',
__slots__ = ('_edited_timestamp', 'tts', 'content', 'channel', 'webhook_id',
'mention_everyone', 'embeds', 'id', 'mentions', 'author',
'_cs_channel_mentions', '_cs_raw_mentions', 'attachments',
'_cs_clean_content', '_cs_raw_channel_mentions', 'nonce', 'pinned',
'role_mentions', '_cs_raw_role_mentions', 'type', 'call',
'_cs_system_content', '_cs_guild', '_state', 'reactions',
'application', 'activity' )
'application', 'activity')
def __init__(self, *, state, channel, data):
self._state = state

View File

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)

View File

@ -493,7 +493,7 @@ class Permissions:
# after these 32 bits, there's 21 more unused ones technically
def augment_from_permissions(cls):
cls.VALID_NAMES = { name for name in dir(Permissions) if isinstance(getattr(Permissions, name), property) }
cls.VALID_NAMES = {name for name in dir(Permissions) if isinstance(getattr(Permissions, name), property)}
# make descriptors for all the valid names
for name in cls.VALID_NAMES:

View File

@ -36,7 +36,7 @@ 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.

View File

@ -64,7 +64,7 @@ class RawBulkMessageDeleteEvent:
__slots__ = ('message_ids', 'channel_id', 'guild_id')
def __init__(self, data):
self.message_ids = { int(x) for x in data.get('ids', []) }
self.message_ids = {int(x) for x in data.get('ids', [])}
self.channel_id = int(data['channel_id'])
try:

View File

@ -92,7 +92,7 @@ class Role(Hashable):
"""
__slots__ = ('id', 'name', 'permissions', 'color', 'colour', 'position',
'managed', 'mentionable', 'hoist', 'guild', '_state' )
'managed', 'mentionable', 'hoist', 'guild', '_state')
def __init__(self, *, guild, state, data):
self.guild = guild

View File

@ -76,10 +76,8 @@ class Shard:
await self.ws.poll_event()
except ResumeWebSocket:
log.info('Got a request to RESUME the websocket at Shard ID %s.', self.id)
coro = DiscordWebSocket.from_client(self._client, resume=True,
shard_id=self.id,
session=self.ws.session_id,
sequence=self.ws.sequence)
coro = DiscordWebSocket.from_client(self._client, resume=True, shard_id=self.id,
session=self.ws.session_id, sequence=self.ws.sequence)
self.ws = await asyncio.wait_for(coro, timeout=180.0, loop=self.loop)
def get_future(self):

View File

@ -222,7 +222,7 @@ class RequestsWebhookAdapter(WebhookAdapter):
data = utils.to_json(payload)
if multipart is not None:
data = { 'payload_json': multipart.pop('payload_json') }
data = {'payload_json': multipart.pop('payload_json')}
for tries in range(5):
r = self.session.request(verb, url, headers=headers, data=data, files=multipart)