Absolute import some circular dependencies to appease Python 3.4.
This commit is contained in:
@ -28,7 +28,10 @@ import sys
|
||||
import websockets
|
||||
import asyncio
|
||||
import aiohttp
|
||||
from . import utils, compat
|
||||
|
||||
import discord.utils
|
||||
import discord.compat
|
||||
|
||||
from .enums import Status, try_enum
|
||||
from .game import Game
|
||||
from .errors import GatewayNotFound, ConnectionClosed, InvalidArgument
|
||||
@ -70,7 +73,7 @@ class KeepAliveHandler(threading.Thread):
|
||||
data = self.get_payload()
|
||||
log.debug(self.msg.format(data))
|
||||
coro = self.ws.send_as_json(data)
|
||||
f = compat.run_coroutine_threadsafe(coro, loop=self.ws.loop)
|
||||
f = discord.compat.run_coroutine_threadsafe(coro, loop=self.ws.loop)
|
||||
try:
|
||||
# block until sending is complete
|
||||
f.result()
|
||||
@ -400,7 +403,7 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol):
|
||||
@asyncio.coroutine
|
||||
def send_as_json(self, data):
|
||||
try:
|
||||
yield from super().send(utils.to_json(data))
|
||||
yield from super().send(discord.utils.to_json(data))
|
||||
except websockets.exceptions.ConnectionClosed as e:
|
||||
if not self._can_handle_close(e.code):
|
||||
raise ConnectionClosed(e) from e
|
||||
@ -428,7 +431,7 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol):
|
||||
}
|
||||
}
|
||||
|
||||
sent = utils.to_json(payload)
|
||||
sent = discord.utils.to_json(payload)
|
||||
log.debug('Sending "{}" to change status'.format(sent))
|
||||
yield from self.send(sent)
|
||||
|
||||
@ -510,7 +513,7 @@ class DiscordVoiceWebSocket(websockets.client.WebSocketClientProtocol):
|
||||
|
||||
@asyncio.coroutine
|
||||
def send_as_json(self, data):
|
||||
yield from self.send(utils.to_json(data))
|
||||
yield from self.send(discord.utils.to_json(data))
|
||||
|
||||
@classmethod
|
||||
@asyncio.coroutine
|
||||
|
Reference in New Issue
Block a user