Skip to content

Commit f02dfdc

Browse files
committed
😡Ruff it up x5
1 parent 7c81b2f commit f02dfdc

File tree

7 files changed

+16
-20
lines changed

7 files changed

+16
-20
lines changed

ext/alerts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ async def bans_timeouts(self, ban: twitchio.Ban) -> None:
158158

159159
@commands.Component.listener(name="subscription")
160160
async def subscription(self, subscribe: twitchio.ChannelSubscribe) -> None:
161-
"""Subscriptions"""
161+
"""Subscriptions."""
162162
await subscribe.broadcaster.send_message(
163163
sender=self.bot.bot_id,
164164
message=f"{subscribe.user.mention} just subscribed {const.STV.Donki} thanks",

ext/counters.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ async def first_counter(self, redemption: twitchio.ChannelPointsRedemptionAdd) -
132132
if count == 1:
133133
msg = f'@{redemption.user.display_name}, gratz on your very first "First!" {const.STV.gg}'
134134
else:
135-
msg = f"@{redemption.user.display_name}, Gratz! you've been first {count} times {const.STV.gg} {const.Global.EZ}"
135+
msg = (
136+
f"@{redemption.user.display_name}, Gratz! you've been first {count} times"
137+
f" {const.STV.gg} {const.Global.EZ}"
138+
)
136139

137140
await redemption.broadcaster.send_message(
138141
sender=self.bot.bot_id,

ext/dev.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import asyncio
44
import logging
5-
import os
65
from typing import TYPE_CHECKING, Annotated
76

87
from twitchio.ext import commands
@@ -54,9 +53,9 @@ async def reboot(self, ctx: commands.Context) -> None:
5453
await asyncio.sleep(3)
5554
try:
5655
# non systemctl users - sorry
57-
os.system("sudo systemctl restart luebot")
58-
except Exception as error:
59-
log.error(error, stack_info=True)
56+
await asyncio.create_subprocess_shell("sudo systemctl restart luebot") # `os.system`
57+
except Exception:
58+
log.exception("Failed to Restart the bot's process", stack_info=True)
6059
# it might not go off
6160
await ctx.send("Something went wrong.")
6261

ext/management.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,6 @@ async def title_history(self, ctx: commands.Context, number: int = 3) -> None:
181181
@commands.Component.listener(name="channel_update")
182182
async def channel_update(self, update: twitchio.ChannelUpdate) -> None:
183183
"""Channel Info (game, title, etc) got updated."""
184-
# payload: eventsub.ChannelUpdateData = event.data
185-
# channel_name = payload.broadcaster.name
186-
# assert channel_name
187-
# channel = self.bot.get_channel(channel_name)
188-
# assert channel
189-
190184
now = datetime.datetime.now(datetime.UTC)
191185
# time check is needed so we don't repeat notif that comes from !game !title commands.
192186

ext/simple_commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,7 @@ async def charinfo(self, ctx: commands.Context, *, characters: str) -> None:
308308

309309
def to_string(c: str) -> str:
310310
name = unicodedata.name(c, None)
311-
name = f"\\N{{{name}}}" if name else "Name not found."
312-
return name
311+
return f"\\N{{{name}}}" if name else "Name not found."
313312

314313
names = " ".join(to_string(c) for c in characters[:10])
315314
if len(characters) > 10:
@@ -318,6 +317,7 @@ def to_string(c: str) -> str:
318317

319318
@commands.command(aliases=["id", "twitchid"])
320319
async def twitch_id(self, ctx: commands.Context, *, user: twitchio.User) -> None:
320+
"""Get mentioned @user numeric twitch_id."""
321321
await ctx.send(f"Twitch ID for {user.mention}: {user.id}")
322322

323323

utils/dota/dota2client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def aluerie(self) -> PartialUser:
4747

4848
async def start_helpers(self) -> None:
4949
if not self.started:
50-
await self.steam_web_api.__aenter__()
51-
await self.stratz.__aenter__()
50+
await self.steam_web_api.__aenter__() # noqa: PLC2801
51+
await self.stratz.__aenter__() # noqa: PLC2801
5252
self.items.start()
5353

5454
@override

utils/dota/pulsefire_clients.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ async def get_real_time_stats(self, server_steam_id: int) -> steam_web_api.RealT
5252
5353
https://steamapi.xpaw.me/#IDOTA2MatchStats_570/GetRealtimeStats.
5454
"""
55-
queries = {"server_steam_id": server_steam_id} # noqa F481
56-
return await self.invoke("GET", "/IDOTA2MatchStats_570/GetRealtimeStats/v1/") # type: ignore
55+
queries = {"server_steam_id": server_steam_id} # noqa: F841
56+
return await self.invoke("GET", "/IDOTA2MatchStats_570/GetRealtimeStats/v1/") # pyright: ignore[reportReturnType]
5757

5858

5959
class DotaAPIsRateLimiter(BaseRateLimiter):
@@ -196,5 +196,5 @@ async def get_items(self) -> stratz.ItemsResponse:
196196
}
197197
}
198198
"""
199-
json = {"query": query} # noqa F481
200-
return await self.invoke("POST", "") # type: ignore
199+
json = {"query": query} # noqa: F841
200+
return await self.invoke("POST", "") # pyright: ignore[reportReturnType]

0 commit comments

Comments
 (0)