Update dependencies and copyright year (#2436)

- aiohttp 3.5
- websockets 7
- Rapptz/discord.py@700dbb5
- A few others

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
This commit is contained in:
Toby Harradine
2019-02-13 10:49:11 +11:00
committed by GitHub
parent c87286d3c6
commit 9869f95bd6
54 changed files with 439 additions and 294 deletions

View File

@@ -1,5 +1,6 @@
import re as _re
import sys as _sys
import warnings as _warnings
from math import inf as _inf
from typing import (
Any as _Any,
@@ -157,3 +158,6 @@ class VersionInfo:
__version__ = "3.0.0"
version_info = VersionInfo.from_str(__version__)
# Filter fuzzywuzzy slow sequence matcher warning
_warnings.filterwarnings("ignore", module=r"fuzzywuzzy.*")

View File

@@ -183,7 +183,7 @@ def main():
gathered = asyncio.gather(*pending, loop=red.loop, return_exceptions=True)
gathered.cancel()
try:
red.rpc.server.close()
loop.run_until_complete(red.rpc.close())
except AttributeError:
pass

View File

@@ -1,4 +1,5 @@
import asyncio
from typing import Optional
from aiohttp import web
from aiohttp_json_rpc import JsonRpc
@@ -63,25 +64,26 @@ class RPC:
def __init__(self):
self.app = web.Application()
self._rpc = RedRpc()
self.app.router.add_route("*", "/", self._rpc)
self.app.router.add_route("*", "/", self._rpc.handle_request)
self.app_handler = self.app.make_handler()
self.server = None
self._runner = web.AppRunner(self.app)
self._site: Optional[web.TCPSite] = None
async def initialize(self):
"""
Finalizes the initialization of the RPC server and allows it to begin
accepting queries.
"""
self.server = await self.app.loop.create_server(self.app_handler, "127.0.0.1", 6133)
await self._runner.setup()
self._site = web.TCPSite(self._runner, host="127.0.0.1", port=6133)
await self._site.start()
log.debug("Created RPC server listener.")
def close(self):
async def close(self):
"""
Closes the RPC server.
"""
self.server.close()
await self._runner.cleanup()
def add_method(self, method, prefix: str = None):
if prefix is None:
@@ -117,7 +119,8 @@ class RPCMixin:
"""
Registers a method to act as an RPC handler if the internal RPC server is active.
When calling this method through the RPC server, use the naming scheme "cogname__methodname".
When calling this method through the RPC server, use the naming scheme
"cogname__methodname".
.. important::