Fix all deprecation warnings for 3.8

This commit is contained in:
Rapptz
2019-11-20 02:30:19 -05:00
parent 924398c1ac
commit a6f61dcbde
9 changed files with 43 additions and 43 deletions

View File

@ -91,7 +91,7 @@ class HTTPClient:
self.connector = connector
self.__session = None # filled in static_login
self._locks = weakref.WeakValueDictionary()
self._global_over = asyncio.Event(loop=self.loop)
self._global_over = asyncio.Event()
self._global_over.set()
self.token = None
self.bot_token = False
@ -104,7 +104,7 @@ class HTTPClient:
def recreate(self):
if self.__session.closed:
self.__session = aiohttp.ClientSession(connector=self.connector, loop=self.loop)
self.__session = aiohttp.ClientSession(connector=self.connector)
async def request(self, route, *, files=None, **kwargs):
bucket = route.bucket
@ -195,7 +195,7 @@ class HTTPClient:
log.warning('Global rate limit has been hit. Retrying in %.2f seconds.', retry_after)
self._global_over.clear()
await asyncio.sleep(retry_after, loop=self.loop)
await asyncio.sleep(retry_after)
log.debug('Done sleeping for the rate limit. Retrying...')
# release the global lock now that the
@ -208,7 +208,7 @@ class HTTPClient:
# we've received a 500 or 502, unconditional retry
if r.status in {500, 502}:
await asyncio.sleep(1 + tries * 2, loop=self.loop)
await asyncio.sleep(1 + tries * 2)
continue
# the usual error cases
@ -248,7 +248,7 @@ class HTTPClient:
async def static_login(self, token, *, bot):
# Necessary to get aiohttp to stop complaining about session creation
self.__session = aiohttp.ClientSession(connector=self.connector, loop=self.loop)
self.__session = aiohttp.ClientSession(connector=self.connector)
old_token, old_bot = self.token, self.bot_token
self._token(token, bot=bot)