Skip to content

Commit 55d60e8

Browse files
style: apply ruff lint fixes and update ruff config
- Add RUF067 to ignore list for __init__.py implementation pattern - Fix line formatting in generate_docs_json.py - Rename _topic to topic in get_forum_topics.py - Fix parentheses formatting in parser utils - Remove duplicate List export in __all__
1 parent b98708f commit 55d60e8

5 files changed

Lines changed: 8 additions & 6 deletions

File tree

dev_tools/generate_docs_json.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ async def get_object_data(it_type: str, it_name: str, doc_dict: dict[str, dict])
113113
params_xp = params_link_xp[0].getparent().getnext().xpath("./tbody[1]")
114114
if params_xp:
115115
params = {
116-
x.getchildren()[0].text_content().strip(): x.getchildren()[2]
116+
x.getchildren()[0].text_content().strip(): x
117+
.getchildren()[2]
117118
.text_content()
118119
.strip()
119120
for x in params_xp[0].xpath("./tr")

hydrogram/methods/chats/get_forum_topics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@ async def get_forum_topics(
6767

6868
r = await self.invoke(rpc, sleep_threshold=-1)
6969

70-
for _topic in r.topics:
71-
yield types.ForumTopic._parse(_topic)
70+
for topic in r.topics:
71+
yield types.ForumTopic._parse(topic)

hydrogram/parser/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
def add_surrogates(text):
2828
# Replace each SMP code point with a surrogate pair
2929
return SMP_RE.sub(
30-
lambda match: # Split SMP in two surrogates
31-
"".join(chr(i) for i in unpack("<HH", match.group().encode("utf-16le"))),
30+
lambda match: ( # Split SMP in two surrogates
31+
"".join(chr(i) for i in unpack("<HH", match.group().encode("utf-16le")))
32+
),
3233
text,
3334
)
3435

hydrogram/types/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@
334334
"InviteLinkImporter",
335335
"KeyboardButton",
336336
"List",
337-
"List",
338337
"Listener",
339338
"ListenerTypes",
340339
"Location",

ruff.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ ignore = [
2525
"RUF001",
2626
"RUF002",
2727
"RUF003",
28+
"RUF067", # Allow implementation code in __init__.py files (library design pattern)
2829
"E203",
2930
"PERF203",
3031
"PLR09",

0 commit comments

Comments
 (0)