From ad4a75bdc1aa2948e010a31f2ed543fc1c66efcc Mon Sep 17 00:00:00 2001 From: Stonedestroyer <1307729+Stonedestroyer@users.noreply.github.com> Date: Fri, 28 Feb 2020 02:22:50 +0100 Subject: [PATCH] Deprecation warning - alternative (#3615) * Alternative solution * BLACK * Args * Changes * style * Ordering * Debug shows warnings * style --- redbot/__init__.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/redbot/__init__.py b/redbot/__init__.py index 5e930bf52..6df7a977a 100644 --- a/redbot/__init__.py +++ b/redbot/__init__.py @@ -198,3 +198,26 @@ version_info = VersionInfo.from_str(__version__) _warnings.filterwarnings("ignore", module=r"fuzzywuzzy.*") # Show DeprecationWarning _warnings.filterwarnings("default", category=DeprecationWarning) + +if "--debug" not in _sys.argv: + # DEP-WARN + # Individual warnings - tracked in https://github.com/Cog-Creators/Red-DiscordBot/issues/3529 + # DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python. + _warnings.filterwarnings("ignore", category=DeprecationWarning, module="importlib", lineno=219) + # DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead + # def noop(*args, **kwargs): # type: ignore + _warnings.filterwarnings("ignore", category=DeprecationWarning, module="aiohttp", lineno=107) + # DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10. + # hosts = await asyncio.shield(self._resolve_host(.. + _warnings.filterwarnings("ignore", category=DeprecationWarning, module="aiohttp", lineno=964) + # DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10. + # self._event = asyncio.Event(loop=loop) + _warnings.filterwarnings("ignore", category=DeprecationWarning, module="aiohttp", lineno=21) + # DeprecationWarning: rename klass to create_protocol + # warnings.warn("rename klass to create_protocol", DeprecationWarning) + # + # discord.py is using deprecated kwarg name when making websockets connection + # https://github.com/Rapptz/discord.py/issues/2574 + _warnings.filterwarnings( + "ignore", category=DeprecationWarning, module="websockets", lineno=407 + )