Make json conversion functions private

This commit is contained in:
Rapptz
2021-08-22 02:35:58 -04:00
parent ea2d972666
commit 4a72201617
5 changed files with 17 additions and 17 deletions

View File

@ -430,7 +430,7 @@ class DiscordWebSocket:
msg = self._zlib.decompress(self._buffer)
msg = msg.decode('utf-8')
self._buffer = bytearray()
msg = utils.from_json(msg)
msg = utils._from_json(msg)
_log.debug('For Shard ID %s: WebSocket Event: %s', self.shard_id, msg)
event = msg.get('t')
@ -595,7 +595,7 @@ class DiscordWebSocket:
async def send_as_json(self, data):
try:
await self.send(utils.to_json(data))
await self.send(utils._to_json(data))
except RuntimeError as exc:
if not self._can_handle_close():
raise ConnectionClosed(self.socket, shard_id=self.shard_id) from exc
@ -603,7 +603,7 @@ class DiscordWebSocket:
async def send_heartbeat(self, data):
# This bypasses the rate limit handling code since it has a higher priority
try:
await self.socket.send_str(utils.to_json(data))
await self.socket.send_str(utils._to_json(data))
except RuntimeError as exc:
if not self._can_handle_close():
raise ConnectionClosed(self.socket, shard_id=self.shard_id) from exc
@ -629,7 +629,7 @@ class DiscordWebSocket:
}
}
sent = utils.to_json(payload)
sent = utils._to_json(payload)
_log.debug('Sending "%s" to change status', sent)
await self.send(sent)
@ -735,7 +735,7 @@ class DiscordVoiceWebSocket:
async def send_as_json(self, data):
_log.debug('Sending voice websocket frame: %s.', data)
await self.ws.send_str(utils.to_json(data))
await self.ws.send_str(utils._to_json(data))
send_heartbeat = send_as_json
@ -895,7 +895,7 @@ class DiscordVoiceWebSocket:
# This exception is handled up the chain
msg = await asyncio.wait_for(self.ws.receive(), timeout=30.0)
if msg.type is aiohttp.WSMsgType.TEXT:
await self.received_message(utils.from_json(msg.data))
await self.received_message(utils._from_json(msg.data))
elif msg.type is aiohttp.WSMsgType.ERROR:
_log.debug('Received %s', msg)
raise ConnectionClosed(self.ws, shard_id=None) from msg.data