mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 18:27:59 -05:00
Major dependency update (#1974)
* [V3] Stop `tmp` dir showing up * [V3] Remove requirements.txt and declare in install_requires * Remove requirements.txt from tox.ini * Update and pin all dependencies and sub-dependencies * Update for breaking changes * Reformat * Update docs/requirements.txt and tox.ini requirements * Add 3.7 to identifiers and travis/tox builds * Attempt at fixing the travis build matrix * Attempt #2 * Attempt 3 * aiohttp.ClientSession.close() -> detach() in sync code * Add raven-aiohttp to requirements * Fix stuff in setup.py - Added discord.py back into requirements list - Fix typo in alabaster extra requirement Also in the Pipfile: - Removed allow_prereleases and explicitly pinned black, since this is the only dep we want a prerelease for. * Update to Rapptz/discord.py@8ccb98d395 * Add proper 3.7 build in Travis See travis-ci/travis-ci#9815 * Which version of 3.6 does Xenial install then? * Maybe we should stop pipenv installing useless stuff * Nevermind, back to specific minor version * Remove lots of WET dependency stuff * Fix egg fragment for dependency link
This commit is contained in:
@@ -2,7 +2,7 @@ import asyncio
|
||||
|
||||
from aiohttp import web
|
||||
from aiohttp_json_rpc import JsonRpc
|
||||
from aiohttp_json_rpc.rpc import unpack_request_args
|
||||
from aiohttp_json_rpc.rpc import JsonRpcMethod
|
||||
|
||||
import logging
|
||||
|
||||
@@ -11,7 +11,7 @@ log = logging.getLogger("red.rpc")
|
||||
__all__ = ["RPC", "RPCMixin", "get_name"]
|
||||
|
||||
|
||||
def get_name(func, prefix=None):
|
||||
def get_name(func, prefix=""):
|
||||
class_name = prefix or func.__self__.__class__.__name__.lower()
|
||||
func_name = func.__name__.strip("_")
|
||||
if class_name == "redrpc":
|
||||
@@ -24,13 +24,13 @@ class RedRpc(JsonRpc):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.add_methods(("", self.get_method_info))
|
||||
|
||||
def _add_method(self, method, prefix=""):
|
||||
def _add_method(self, method, name="", prefix=""):
|
||||
if not asyncio.iscoroutinefunction(method):
|
||||
return
|
||||
|
||||
name = get_name(method, prefix)
|
||||
name = name or get_name(method, prefix)
|
||||
|
||||
self.methods[name] = method
|
||||
self.methods[name] = JsonRpcMethod(method)
|
||||
|
||||
def remove_method(self, method):
|
||||
meth_name = get_name(method)
|
||||
@@ -90,7 +90,7 @@ class RPC:
|
||||
if not asyncio.iscoroutinefunction(method):
|
||||
raise TypeError("RPC methods must be coroutines.")
|
||||
|
||||
self._rpc.add_methods((prefix, unpack_request_args(method)))
|
||||
self._rpc.add_methods((prefix, method))
|
||||
|
||||
def add_multi_method(self, *methods, prefix: str = None):
|
||||
if not all(asyncio.iscoroutinefunction(m) for m in methods):
|
||||
|
||||
Reference in New Issue
Block a user