aboutsummaryrefslogtreecommitdiff
path: root/discord/ext/commands/cog.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-04-04 04:40:19 -0400
committerRapptz <[email protected]>2021-04-04 07:03:53 -0400
commit9d39b135f4f84239787b0901d06a4f370a82d4bb (patch)
tree8826845cfd47eafa5c9d2ef1fcbedd36382714f4 /discord/ext/commands/cog.py
parentBump minimum Python version to 3.8 (diff)
downloaddiscord.py-9d39b135f4f84239787b0901d06a4f370a82d4bb.tar.xz
discord.py-9d39b135f4f84239787b0901d06a4f370a82d4bb.zip
Modernize code to use f-strings
This also removes the encoding on the top, since Python 3 does it by default. It also changes some methods to use `yield from`.
Diffstat (limited to 'discord/ext/commands/cog.py')
-rw-r--r--discord/ext/commands/cog.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/discord/ext/commands/cog.py b/discord/ext/commands/cog.py
index 8cb3e4d2..dcaa9cdc 100644
--- a/discord/ext/commands/cog.py
+++ b/discord/ext/commands/cog.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
"""
The MIT License (MIT)
@@ -120,7 +118,7 @@ class CogMeta(type):
value = value.__func__
if isinstance(value, _BaseCommand):
if is_static_method:
- raise TypeError('Command in method {0}.{1!r} must not be staticmethod.'.format(base, elem))
+ raise TypeError(f'Command in method {base}.{elem!r} must not be staticmethod.')
if elem.startswith(('cog_', 'bot_')):
raise TypeError(no_bot_cog.format(base, elem))
commands[elem] = value
@@ -275,7 +273,7 @@ class Cog(metaclass=CogMeta):
"""
if name is not None and not isinstance(name, str):
- raise TypeError('Cog.listener expected str but received {0.__class__.__name__!r} instead.'.format(name))
+ raise TypeError(f'Cog.listener expected str but received {name.__class__.__name__!r} instead.')
def decorator(func):
actual = func