Make some dependency changes, support Python 3.10 and 3.11 (#5611)

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
Jakub Kuczys
2022-12-30 03:21:57 +01:00
committed by GitHub
parent d3308af0e2
commit 519acedf46
59 changed files with 324 additions and 373 deletions

View File

@@ -64,14 +64,20 @@ class RPC:
RPC server manager.
"""
app: web.Application
_rpc: RedRpc
_runner: web.AppRunner
def __init__(self):
self._site: Optional[web.TCPSite] = None
self._started = False
async def _pre_login(self) -> None:
self.app = web.Application()
self._rpc = RedRpc()
self.app.router.add_route("*", "/", self._rpc.handle_request)
self._runner = web.AppRunner(self.app)
self._site: Optional[web.TCPSite] = None
self._started = False
async def initialize(self, port: int):
"""
@@ -134,6 +140,9 @@ class RPCMixin:
self.rpc_handlers = {} # Uppercase cog name to method
async def _pre_login(self) -> None:
await self.rpc._pre_login()
def register_rpc_handler(self, method):
"""
Registers a method to act as an RPC handler if the internal RPC server is active.