Use f-strings in more places that were missed.

This commit is contained in:
Rapptz
2021-04-08 06:02:47 -04:00
parent c3e0b6e123
commit 99fc950510
34 changed files with 220 additions and 143 deletions

View File

@ -33,6 +33,7 @@ __all__ = (
'Role',
)
class RoleTags:
"""Represents tags on a role.
@ -52,7 +53,11 @@ class RoleTags:
The integration ID that manages the role.
"""
__slots__ = ('bot_id', 'integration_id', '_premium_subscriber',)
__slots__ = (
'bot_id',
'integration_id',
'_premium_subscriber',
)
def __init__(self, data):
self.bot_id = _get_as_snowflake(data, 'bot_id')
@ -76,8 +81,11 @@ class RoleTags:
return self.integration_id is not None
def __repr__(self):
return '<RoleTags bot_id={0.bot_id} integration_id={0.integration_id} ' \
'premium_subscriber={1}>'.format(self, self.is_premium_subscriber())
return (
f'<RoleTags bot_id={self.bot_id} integration_id={self.integration_id} '
f'premium_subscriber={self.is_premium_subscriber()}>'
)
class Role(Hashable):
"""Represents a Discord role in a :class:`Guild`.
@ -138,8 +146,19 @@ class Role(Hashable):
The role tags associated with this role.
"""
__slots__ = ('id', 'name', '_permissions', '_colour', 'position',
'managed', 'mentionable', 'hoist', 'guild', 'tags', '_state')
__slots__ = (
'id',
'name',
'_permissions',
'_colour',
'position',
'managed',
'mentionable',
'hoist',
'guild',
'tags',
'_state',
)
def __init__(self, *, guild, state, data):
self.guild = guild
@ -151,7 +170,7 @@ class Role(Hashable):
return self.name
def __repr__(self):
return '<Role id={0.id} name={0.name!r}>'.format(self)
return f'<Role id={self.id} name={self.name!r}>'
def __lt__(self, other):
if not isinstance(other, Role) or not isinstance(self, Role):
@ -346,7 +365,7 @@ class Role(Hashable):
'permissions': str(fields.get('permissions', self.permissions).value),
'color': colour.value,
'hoist': fields.get('hoist', self.hoist),
'mentionable': fields.get('mentionable', self.mentionable)
'mentionable': fields.get('mentionable', self.mentionable),
}
data = await self._state.http.edit_role(self.guild.id, self.id, reason=reason, **payload)