diff options
| author | Rapptz <[email protected]> | 2021-04-04 04:40:19 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2021-04-04 07:03:53 -0400 |
| commit | 9d39b135f4f84239787b0901d06a4f370a82d4bb (patch) | |
| tree | 8826845cfd47eafa5c9d2ef1fcbedd36382714f4 /discord/colour.py | |
| parent | Bump minimum Python version to 3.8 (diff) | |
| download | discord.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/colour.py')
| -rw-r--r-- | discord/colour.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/discord/colour.py b/discord/colour.py index fbf9aaef..3296afb7 100644 --- a/discord/colour.py +++ b/discord/colour.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """ The MIT License (MIT) @@ -61,7 +59,7 @@ class Colour: def __init__(self, value): if not isinstance(value, int): - raise TypeError('Expected int parameter, received %s instead.' % value.__class__.__name__) + raise TypeError(f'Expected int parameter, received {value.__class__.__name__} instead.') self.value = value @@ -75,10 +73,10 @@ class Colour: return not self.__eq__(other) def __str__(self): - return '#{:0>6x}'.format(self.value) + return f'#{self.value:0>6x}' def __repr__(self): - return '<Colour value=%s>' % self.value + return f'<Colour value={self.value}>' def __hash__(self): return hash(self.value) @@ -132,7 +130,7 @@ class Colour: Parameters ------------ seed: Optional[Union[:class:`int`, :class:`str`, :class:`float`, :class:`bytes`, :class:`bytearray`]] - The seed to initialize the RNG with. If ``None`` is passed the default RNG is used. + The seed to initialize the RNG with. If ``None`` is passed the default RNG is used. .. versionadded:: 1.7 """ |