Skip to content

Commit 24c20c5

Browse files
chore: ruff lints
1 parent df2cb53 commit 24c20c5

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

eduu/plugins/misc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ async def rtcommand(c: Client, m: Message):
115115
rt_text = None
116116
rt_text = m.reply_to_message.caption if m.reply_to_message.media else m.reply_to_message.text
117117

118-
if rt_text is None or re.match("🔃 .* retweeted:\n\n👤 .*", rt_text):
118+
if rt_text is None or re.match(r"🔃 .* retweeted:\n\n👤 .*", rt_text):
119119
return
120120

121121
text = f"🔃 <b>{escape(m.from_user.first_name)}</b> retweeted:\n\n"
@@ -175,7 +175,7 @@ async def request_cmd(c: Client, m: Message):
175175
text = m.text.split(maxsplit=1)[1]
176176
url = text if re.match(r"^(https?)://", text) else f"http://{text}"
177177
req = await http.get(url)
178-
headers = f'<b>{req.extensions.get("http_version").decode()}</b> <code>{req.status_code} {req.extensions.get("reason_phrase", b"").decode()}</code>\n'
178+
headers = f"<b>{req.extensions.get('http_version').decode()}</b> <code>{req.status_code} {req.extensions.get('reason_phrase', b'').decode()}</code>\n"
179179

180180
headers += "\n".join(
181181
f"<b>{x.title()}:</b> <code>{escape(req.headers[x])}</code>" for x in req.headers

eduu/plugins/pypi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
def cleanhtml(raw_html):
16-
cleanr = re.compile("<.*?>")
16+
cleanr = re.compile(r"<.*?>")
1717
return re.sub(cleanr, "", raw_html)
1818

1919

eduu/plugins/sudos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async def sudos(c: Client, m: Message):
4646
@use_chat_lang
4747
async def run_cmd(c: Client, m: Message, s: Strings):
4848
cmd = m.text.split(maxsplit=1)[1]
49-
if re.match("(?i)poweroff|halt|shutdown|reboot", cmd):
49+
if re.match(r"(?i)poweroff|halt|shutdown|reboot", cmd):
5050
await m.reply_text(s("sudos_forbidden_command"))
5151
return
5252

eduu/plugins/youtube.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ async def ytdlcmd(c: Client, m: Message, s: Strings):
106106
[
107107
(
108108
s("ytdl_audio_button"),
109-
f'_aud.{yt["id"]}|{afsize}|{temp}|{m.chat.id}|{user}|{m.id}',
109+
f"_aud.{yt['id']}|{afsize}|{temp}|{m.chat.id}|{user}|{m.id}",
110110
),
111111
(
112112
s("ytdl_video_button"),
113-
f'_vid.{yt["id"]}|{vfsize}|{temp}|{m.chat.id}|{user}|{m.id}',
113+
f"_vid.{yt['id']}|{vfsize}|{temp}|{m.chat.id}|{user}|{m.id}",
114114
),
115115
]
116116
]

eduu/utils/localization.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ def get_locale_string(
8181
language: str,
8282
key: str,
8383
) -> str:
84-
if "@" in language and language.split("@")[0] in langdict:
84+
if "@" in language and language.split("@", 1)[0] in langdict:
8585
# if an @ (tone modifier) is present, try to get string from parent language if nullish
86-
string = langdict[language].get(key) or langdict[language.split("@")[0]].get(key)
86+
string = langdict[language].get(key) or langdict[language.split("@", 1)[0]].get(key)
8787
else:
8888
string = langdict[language].get(key)
8989

eduu/utils/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def pretty_size(size_bytes):
4545
if size_bytes == 0:
4646
return "0B"
4747
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
48-
i = int(math.floor(math.log(size_bytes, 1024)))
48+
i = math.floor(math.log(size_bytes, 1024))
4949
p = math.pow(1024, i)
5050
s = round(size_bytes / p, 2)
5151
return f"{s} {size_name[i]}"
@@ -242,7 +242,7 @@ def add_command(
242242
command: str,
243243
aliases: list | None = None,
244244
):
245-
description_key = f"inline_cmd_{command.split()[0]}_description"
245+
description_key = f"inline_cmd_{command.split(maxsplit=1)[0]}_description"
246246

247247
self.commands.append({
248248
"command": command,

0 commit comments

Comments
 (0)