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`.
This commit is contained in:
Rapptz
2021-04-04 04:40:19 -04:00
parent 9fc2ab9c99
commit 9d39b135f4
67 changed files with 262 additions and 378 deletions

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
@ -103,8 +101,8 @@ class PartialEmoji(_EmojiTag):
if self.id is None:
return self.name
if self.animated:
return '<a:%s:%s>' % (self.name, self.id)
return '<:%s:%s>' % (self.name, self.id)
return f'<a:{self.name}:{self.id}>'
return f'<:{self.name}:{self.id}>'
def __repr__(self):
return '<{0.__class__.__name__} animated={0.animated} name={0.name!r} id={0.id}>'.format(self)
@ -134,7 +132,7 @@ class PartialEmoji(_EmojiTag):
def _as_reaction(self):
if self.id is None:
return self.name
return '%s:%s' % (self.name, self.id)
return f'{self.name}:{self.id}'
@property
def created_at(self):