From 79a49f91458159564ae5a7696797829c6a848a5d Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 24 Dec 2016 05:11:06 -0500 Subject: Absolute import some circular dependencies to appease Python 3.4. --- discord/gateway.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'discord/gateway.py') diff --git a/discord/gateway.py b/discord/gateway.py index 169d6fb1..8d1f7040 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -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 -- cgit v1.2.3