mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-06 09:56:09 +00:00
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:
@ -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
|
||||
"""
|
||||
|
Reference in New Issue
Block a user