From f3731d65b043c208b34b32c708387e3139616146 Mon Sep 17 00:00:00 2001 From: Stonedestroyer <1307729+Stonedestroyer@users.noreply.github.com> Date: Wed, 26 Feb 2020 11:38:07 +0100 Subject: [PATCH 1/8] Alternative solution --- redbot/__init__.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/redbot/__init__.py b/redbot/__init__.py index 5e930bf5241..625562e69ef 100644 --- a/redbot/__init__.py +++ b/redbot/__init__.py @@ -196,5 +196,25 @@ def _update_event_loop_policy(): # Filter fuzzywuzzy slow sequence matcher warning _warnings.filterwarnings("ignore", module=r"fuzzywuzzy.*") +# Show DeprecationWarning in debug mode # Show DeprecationWarning -_warnings.filterwarnings("default", category=DeprecationWarning) +if "--debug" in _sys.argv: + _warnings.filterwarnings("default", category=DeprecationWarning) +else: + _warnings.filterwarnings("default", category=DeprecationWarning) + # DEP-WARN + # 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) + # DEP-WARN + # 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) + # DEP-WARN + # 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) + # DEP-WARN + # DeprecationWarning: rename klass to create_protocol + # warnings.warn("rename klass to create_protocol", DeprecationWarning) + _warnings.filterwarnings("ignore", category=DeprecationWarning, module="websockets", lineno=407) From e0fd2b90356ebf2952c971a74c010ef0732f5257 Mon Sep 17 00:00:00 2001 From: Stonedestroyer <1307729+Stonedestroyer@users.noreply.github.com> Date: Wed, 26 Feb 2020 11:43:15 +0100 Subject: [PATCH 2/8] BLACK --- redbot/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/redbot/__init__.py b/redbot/__init__.py index 625562e69ef..c242ea3d5fd 100644 --- a/redbot/__init__.py +++ b/redbot/__init__.py @@ -217,4 +217,6 @@ def _update_event_loop_policy(): # DEP-WARN # DeprecationWarning: rename klass to create_protocol # warnings.warn("rename klass to create_protocol", DeprecationWarning) - _warnings.filterwarnings("ignore", category=DeprecationWarning, module="websockets", lineno=407) + _warnings.filterwarnings( + "ignore", category=DeprecationWarning, module="websockets", lineno=407 + ) From 291da88a2af5223ba19538b4735a12f504559268 Mon Sep 17 00:00:00 2001 From: Stonedestroyer <1307729+Stonedestroyer@users.noreply.github.com> Date: Wed, 26 Feb 2020 11:46:10 +0100 Subject: [PATCH 3/8] Args --- redbot/__init__.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/redbot/__init__.py b/redbot/__init__.py index c242ea3d5fd..0ed37cde2f6 100644 --- a/redbot/__init__.py +++ b/redbot/__init__.py @@ -196,11 +196,9 @@ def _update_event_loop_policy(): # Filter fuzzywuzzy slow sequence matcher warning _warnings.filterwarnings("ignore", module=r"fuzzywuzzy.*") -# Show DeprecationWarning in debug mode # Show DeprecationWarning -if "--debug" in _sys.argv: - _warnings.filterwarnings("default", category=DeprecationWarning) -else: +_warnings.filterwarnings("default", category=DeprecationWarning) +if "--debug" not in _sys.argv: _warnings.filterwarnings("default", category=DeprecationWarning) # DEP-WARN # DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead From 4007edf91e2e7f2d67603067e71e37ddb44ec6fa Mon Sep 17 00:00:00 2001 From: Stonedestroyer <1307729+Stonedestroyer@users.noreply.github.com> Date: Wed, 26 Feb 2020 16:17:24 +0100 Subject: [PATCH 4/8] Changes --- redbot/__init__.py | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/redbot/__init__.py b/redbot/__init__.py index 0ed37cde2f6..4858b2f34b2 100644 --- a/redbot/__init__.py +++ b/redbot/__init__.py @@ -198,23 +198,29 @@ def _update_event_loop_policy(): _warnings.filterwarnings("ignore", module=r"fuzzywuzzy.*") # Show DeprecationWarning _warnings.filterwarnings("default", category=DeprecationWarning) -if "--debug" not in _sys.argv: - _warnings.filterwarnings("default", category=DeprecationWarning) - # DEP-WARN - # 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) - # DEP-WARN - # 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) - # DEP-WARN - # 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) - # DEP-WARN - # DeprecationWarning: rename klass to create_protocol - # warnings.warn("rename klass to create_protocol", DeprecationWarning) - _warnings.filterwarnings( - "ignore", category=DeprecationWarning, module="websockets", lineno=407 - ) + +# Individual warnings - tracked in https://github.com/Cog-Creators/Red-DiscordBot/issues/3529 +# DEP-WARN +# 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) +# DEP-WARN +# 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) +# DEP-WARN +# 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) +# DEP-WARN +# 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) +# DEP-WARN +# 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 +) From d25b84a6ae06dae0eaf2afad42288371b2fdead7 Mon Sep 17 00:00:00 2001 From: Stonedestroyer <1307729+Stonedestroyer@users.noreply.github.com> Date: Wed, 26 Feb 2020 16:17:35 +0100 Subject: [PATCH 5/8] style --- redbot/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/redbot/__init__.py b/redbot/__init__.py index 4858b2f34b2..2935b935f97 100644 --- a/redbot/__init__.py +++ b/redbot/__init__.py @@ -221,6 +221,4 @@ def _update_event_loop_policy(): # # 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 -) +_warnings.filterwarnings("ignore", category=DeprecationWarning, module="websockets", lineno=407) From abcf4ccbe2122d58c09a60504f569dfbe1d1d364 Mon Sep 17 00:00:00 2001 From: Stonedestroyer <1307729+Stonedestroyer@users.noreply.github.com> Date: Wed, 26 Feb 2020 16:23:04 +0100 Subject: [PATCH 6/8] Ordering --- redbot/__init__.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/redbot/__init__.py b/redbot/__init__.py index 2935b935f97..22428600cdb 100644 --- a/redbot/__init__.py +++ b/redbot/__init__.py @@ -199,23 +199,19 @@ def _update_event_loop_policy(): # Show DeprecationWarning _warnings.filterwarnings("default", category=DeprecationWarning) -# Individual warnings - tracked in https://github.com/Cog-Creators/Red-DiscordBot/issues/3529 # 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) -# DEP-WARN # 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) -# DEP-WARN # 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) -# DEP-WARN # 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) -# DEP-WARN # DeprecationWarning: rename klass to create_protocol # warnings.warn("rename klass to create_protocol", DeprecationWarning) # From e259f117301c3a11e5dad9b7344509c5409dc018 Mon Sep 17 00:00:00 2001 From: Stonedestroyer <1307729+Stonedestroyer@users.noreply.github.com> Date: Wed, 26 Feb 2020 16:28:25 +0100 Subject: [PATCH 7/8] Debug shows warnings --- redbot/__init__.py | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/redbot/__init__.py b/redbot/__init__.py index 22428600cdb..0b4acb5cbec 100644 --- a/redbot/__init__.py +++ b/redbot/__init__.py @@ -199,22 +199,23 @@ def _update_event_loop_policy(): # Show DeprecationWarning _warnings.filterwarnings("default", category=DeprecationWarning) -# 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) +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) \ No newline at end of file From 9f33ef6d87f53a5c2d040ec2dd6c81d099d68164 Mon Sep 17 00:00:00 2001 From: Stonedestroyer <1307729+Stonedestroyer@users.noreply.github.com> Date: Wed, 26 Feb 2020 16:28:36 +0100 Subject: [PATCH 8/8] style --- redbot/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/redbot/__init__.py b/redbot/__init__.py index 0b4acb5cbec..6df7a977af4 100644 --- a/redbot/__init__.py +++ b/redbot/__init__.py @@ -218,4 +218,6 @@ def _update_event_loop_policy(): # # 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) \ No newline at end of file + _warnings.filterwarnings( + "ignore", category=DeprecationWarning, module="websockets", lineno=407 + )