aboutsummaryrefslogtreecommitdiff
path: root/discord/utils.py
diff options
context:
space:
mode:
authorNadir Chowdhury <[email protected]>2021-02-25 02:26:51 +0000
committerGitHub <[email protected]>2021-02-24 21:26:51 -0500
commit63ec23bac24ab62633bdb8fd19b93ecd3fddba7c (patch)
tree14ad9433dddf4c056c292a07e2c0e74b79942cdd /discord/utils.py
parentFix NameError with invoked_parents (diff)
downloaddiscord.py-63ec23bac24ab62633bdb8fd19b93ecd3fddba7c.tar.xz
discord.py-63ec23bac24ab62633bdb8fd19b93ecd3fddba7c.zip
Code optimisations and refactoring via Sourcery
Diffstat (limited to 'discord/utils.py')
-rw-r--r--discord/utils.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/discord/utils.py b/discord/utils.py
index 775907ff..24428c7a 100644
--- a/discord/utils.py
+++ b/discord/utils.py
@@ -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):
"""