diff options
author | 2023-05-06 16:12:32 +0100 | |
---|---|---|
committer | 2023-05-09 15:41:50 +0100 | |
commit | 613840ebcf303e84048d48ace37fb001c1afe687 (patch) | |
tree | 9acaf0bae0527fe8389483a419b44e06997ca060 /bot/exts/utilities/twemoji.py | |
parent | Migrate to ruff (diff) |
Apply fixes for ruff linting
Co-authored-by: wookie184 <[email protected]>
Co-authored-by: Amrou Bellalouna <[email protected]>
Diffstat (limited to 'bot/exts/utilities/twemoji.py')
-rw-r--r-- | bot/exts/utilities/twemoji.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/bot/exts/utilities/twemoji.py b/bot/exts/utilities/twemoji.py index 25a03d25..a936f733 100644 --- a/bot/exts/utilities/twemoji.py +++ b/bot/exts/utilities/twemoji.py @@ -1,6 +1,6 @@ import logging import re -from typing import Literal, Optional +from typing import Literal import discord from discord.ext import commands @@ -57,7 +57,7 @@ class Twemoji(commands.Cog): return embed @staticmethod - def emoji(codepoint: Optional[str]) -> Optional[str]: + def emoji(codepoint: str | None) -> str | None: """ Returns the emoji corresponding to a given `codepoint`, or `None` if no emoji was found. @@ -66,9 +66,10 @@ class Twemoji(commands.Cog): """ if code := Twemoji.trim_code(codepoint): return chr(int(code, 16)) + return None @staticmethod - def codepoint(emoji: Optional[str]) -> Optional[str]: + def codepoint(emoji: str | None) -> str | None: """ Returns the codepoint, in a trimmed format, of a single emoji. @@ -82,7 +83,7 @@ class Twemoji(commands.Cog): return hex(ord(emoji)).removeprefix("0x") @staticmethod - def trim_code(codepoint: Optional[str]) -> Optional[str]: + def trim_code(codepoint: str | None) -> str | None: """ Returns the meaningful information from the given `codepoint`. @@ -98,6 +99,7 @@ class Twemoji(commands.Cog): """ if code := CODEPOINT_REGEX.search(codepoint or ""): return code.group() + return None @staticmethod def codepoint_from_input(raw_emoji: tuple[str, ...]) -> str: |