Drop support for Python 3.4 and make minimum version 3.5.2.

This commit is contained in:
Rapptz
2018-06-10 18:09:14 -04:00
parent 7eb918b19e
commit f25091efe1
35 changed files with 626 additions and 1069 deletions

View File

@ -40,18 +40,17 @@ class Typing:
self.loop = messageable._state.loop
self.messageable = messageable
@asyncio.coroutine
def do_typing(self):
async def do_typing(self):
try:
channel = self._channel
except AttributeError:
channel = yield from self.messageable._get_channel()
channel = await self.messageable._get_channel()
typing = channel._state.http.send_typing
while True:
yield from typing(channel.id)
yield from asyncio.sleep(5)
await typing(channel.id)
await asyncio.sleep(5)
def __enter__(self):
self.task = create_task(self.do_typing(), loop=self.loop)
@ -61,12 +60,10 @@ class Typing:
def __exit__(self, exc_type, exc, tb):
self.task.cancel()
@asyncio.coroutine
def __aenter__(self):
self._channel = channel = yield from self.messageable._get_channel()
yield from channel._state.http.send_typing(channel.id)
async def __aenter__(self):
self._channel = channel = await self.messageable._get_channel()
await channel._state.http.send_typing(channel.id)
return self.__enter__()
@asyncio.coroutine
def __aexit__(self, exc_type, exc, tb):
async def __aexit__(self, exc_type, exc, tb):
self.task.cancel()