mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-10-23 00:42:56 +00:00
Code optimisations and refactoring via Sourcery
This commit is contained in:
@@ -419,11 +419,8 @@ def _string_width(string, *, _IS_ASCII=_IS_ASCII):
|
||||
return match.endpos
|
||||
|
||||
UNICODE_WIDE_CHAR_TYPE = 'WFA'
|
||||
width = 0
|
||||
func = unicodedata.east_asian_width
|
||||
for char in string:
|
||||
width += 2 if func(char) in UNICODE_WIDE_CHAR_TYPE else 1
|
||||
return width
|
||||
return sum(2 if func(char) in UNICODE_WIDE_CHAR_TYPE else 1 for char in string)
|
||||
|
||||
def resolve_invite(invite):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user