Browse Source

[lint] Remove unused variables

Left over from various refactoring and rewrites.
pull/1521/merge
Hornwitser 7 years ago
committed by Rapptz
parent
commit
119c5a0618
  1. 2
      discord/abc.py
  2. 2
      discord/client.py
  3. 2
      discord/ext/commands/core.py
  4. 6
      discord/shard.py
  5. 4
      discord/state.py
  6. 2
      discord/utils.py
  7. 1
      discord/voice_client.py

2
discord/abc.py

@ -955,7 +955,7 @@ class Connectable(metaclass=abc.ABCMeta):
:class:`VoiceClient`
A voice client that is fully connected to the voice server.
"""
key_id, key_name = self._get_voice_client_key()
key_id, _ = self._get_voice_client_key()
state = self._state
if state._get_voice_client(key_id):

2
discord/client.py

@ -367,7 +367,7 @@ class Client:
while True:
try:
await self.ws.poll_event()
except ResumeWebSocket as e:
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,

2
discord/ext/commands/core.py

@ -321,7 +321,7 @@ class Command:
try:
# first/second parameter is context
result.popitem(last=False)
except Exception as e:
except Exception:
raise ValueError('Missing context parameter') from None
return result

6
discord/shard.py

@ -74,7 +74,7 @@ class Shard:
async def poll(self):
try:
await self.ws.poll_event()
except ResumeWebSocket as e:
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,
@ -212,7 +212,7 @@ class AutoShardedClient(Client):
try:
coro = websockets.connect(gateway, loop=self.loop, klass=DiscordWebSocket, compression=None)
ws = await asyncio.wait_for(coro, loop=self.loop, timeout=180.0)
except Exception as e:
except Exception:
log.info('Failed to connect for shard_id: %s. Retrying...', shard_id)
await asyncio.sleep(5.0, loop=self.loop)
return (await self.launch_shard(gateway, shard_id))
@ -265,7 +265,7 @@ class AutoShardedClient(Client):
while True:
pollers = [shard.get_future() for shard in self.shards.values()]
done, pending = await asyncio.wait(pollers, loop=self.loop, return_when=asyncio.FIRST_COMPLETED)
done, _ = await asyncio.wait(pollers, loop=self.loop, return_when=asyncio.FIRST_COMPLETED)
for f in done:
# we wanna re-raise to the main Client.connect handler if applicable
f.result()

4
discord/state.py

@ -240,7 +240,7 @@ class ConnectionState:
return guild
def chunks_needed(self, guild):
for chunk in range(math.ceil(guild._member_count / 1000)):
for _ in range(math.ceil(guild._member_count / 1000)):
yield self.receive_chunk(guild.id)
def _get_guild_channel(self, data):
@ -423,7 +423,7 @@ class ConnectionState:
emoji = self._upgrade_partial_emoji(emoji)
try:
reaction = message._remove_reaction(data, emoji, raw.user_id)
except (AttributeError, ValueError) as e: # eventual consistency lol
except (AttributeError, ValueError): # eventual consistency lol
pass
else:
user = self._get_reaction_user(message.channel, raw.user_id)

2
discord/utils.py

@ -281,7 +281,7 @@ async def async_all(gen, *, check=_isawaitable):
return True
async def sane_wait_for(futures, *, timeout, loop):
done, pending = await asyncio.wait(futures, timeout=timeout, loop=loop)
_, pending = await asyncio.wait(futures, timeout=timeout, loop=loop)
if len(pending) != 0:
raise asyncio.TimeoutError()

1
discord/voice_client.py

@ -132,7 +132,6 @@ class VoiceClient:
async def start_handshake(self):
log.info('Starting voice handshake...')
key_id, key_name = self.channel._get_voice_client_key()
guild_id, channel_id = self.channel._get_voice_state_pair()
state = self._state
self.main_ws = ws = state._get_websocket(guild_id)

Loading…
Cancel
Save