aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHornwitser <[email protected]>2018-06-22 14:47:56 +0200
committerRapptz <[email protected]>2018-08-22 21:43:51 -0400
commit119c5a0618c82b7f425a59e2e6a8c5ce35c48a37 (patch)
tree5dcb485ece928adbc2886c0eebd5fcde7be8093b
parent[lint] Remove unused imports (diff)
downloaddiscord.py-119c5a0618c82b7f425a59e2e6a8c5ce35c48a37.tar.xz
discord.py-119c5a0618c82b7f425a59e2e6a8c5ce35c48a37.zip
[lint] Remove unused variables
Left over from various refactoring and rewrites.
-rw-r--r--discord/abc.py2
-rw-r--r--discord/client.py2
-rw-r--r--discord/ext/commands/core.py2
-rw-r--r--discord/shard.py6
-rw-r--r--discord/state.py4
-rw-r--r--discord/utils.py2
-rw-r--r--discord/voice_client.py1
7 files changed, 9 insertions, 10 deletions
diff --git a/discord/abc.py b/discord/abc.py
index 60867049..002980a4 100644
--- a/discord/abc.py
+++ b/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):
diff --git a/discord/client.py b/discord/client.py
index 9c1fdac2..440b5be3 100644
--- a/discord/client.py
+++ b/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,
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index b79f5b97..56c4baff 100644
--- a/discord/ext/commands/core.py
+++ b/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
diff --git a/discord/shard.py b/discord/shard.py
index 8e04b9c5..c06e6398 100644
--- a/discord/shard.py
+++ b/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()
diff --git a/discord/state.py b/discord/state.py
index 779a4a9d..f0275532 100644
--- a/discord/state.py
+++ b/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)
diff --git a/discord/utils.py b/discord/utils.py
index 5c939922..b4a79d67 100644
--- a/discord/utils.py
+++ b/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()
diff --git a/discord/voice_client.py b/discord/voice_client.py
index 6f88856e..f92cc24e 100644
--- a/discord/voice_client.py
+++ b/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)