chore(linter): update ruff rules

This commit is contained in:
MingxuanGame
2025-10-03 15:46:53 +00:00
parent b10425ad91
commit d490239f46
59 changed files with 393 additions and 425 deletions

View File

@@ -32,11 +32,9 @@ async def process_streak(
).first()
if not stats:
return False
if streak <= stats.daily_streak_best < next_streak:
return True
elif next_streak == 0 and stats.daily_streak_best >= streak:
return True
return False
return bool(
streak <= stats.daily_streak_best < next_streak or (next_streak == 0 and stats.daily_streak_best >= streak)
)
MEDALS = {

View File

@@ -68,9 +68,7 @@ async def to_the_core(
if ("Nightcore" not in beatmap.beatmapset.title) and "Nightcore" not in beatmap.beatmapset.artist:
return False
mods_ = mod_to_save(score.mods)
if "DT" not in mods_ or "NC" not in mods_:
return False
return True
return not ("DT" not in mods_ or "NC" not in mods_)
async def wysi(
@@ -83,9 +81,7 @@ async def wysi(
return False
if str(round(score.accuracy, ndigits=4))[3:] != "727":
return False
if "xi" not in beatmap.beatmapset.artist:
return False
return True
return "xi" in beatmap.beatmapset.artist
async def prepared(
@@ -97,9 +93,7 @@ async def prepared(
if score.rank != Rank.X and score.rank != Rank.XH:
return False
mods_ = mod_to_save(score.mods)
if "NF" not in mods_:
return False
return True
return "NF" in mods_
async def reckless_adandon(
@@ -117,9 +111,7 @@ async def reckless_adandon(
redis = get_redis()
mods_ = score.mods.copy()
attribute = await calculate_beatmap_attributes(beatmap.id, score.gamemode, mods_, redis, fetcher)
if attribute.star_rating < 3:
return False
return True
return not attribute.star_rating < 3
async def lights_out(
@@ -413,11 +405,10 @@ async def by_the_skin_of_the_teeth(
return False
for mod in score.mods:
if mod.get("acronym") == "AC":
if "settings" in mod and "minimum_accuracy" in mod["settings"]:
target_accuracy = mod["settings"]["minimum_accuracy"]
if isinstance(target_accuracy, int | float):
return abs(score.accuracy - float(target_accuracy)) < 0.0001
if mod.get("acronym") == "AC" and "settings" in mod and "minimum_accuracy" in mod["settings"]:
target_accuracy = mod["settings"]["minimum_accuracy"]
if isinstance(target_accuracy, int | float):
return abs(score.accuracy - float(target_accuracy)) < 0.0001
return False

View File

@@ -19,9 +19,7 @@ async def process_mod(
return False
if not beatmap.beatmap_status.has_leaderboard():
return False
if len(score.mods) != 1 or score.mods[0]["acronym"] != mod:
return False
return True
return not (len(score.mods) != 1 or score.mods[0]["acronym"] != mod)
async def process_category_mod(

View File

@@ -22,11 +22,7 @@ async def process_combo(
return False
if next_combo != 0 and combo >= next_combo:
return False
if combo <= score.max_combo < next_combo:
return True
elif next_combo == 0 and score.max_combo >= combo:
return True
return False
return bool(combo <= score.max_combo < next_combo or (next_combo == 0 and score.max_combo >= combo))
MEDALS: Medals = {

View File

@@ -35,11 +35,7 @@ async def process_playcount(
).first()
if not stats:
return False
if pc <= stats.play_count < next_pc:
return True
elif next_pc == 0 and stats.play_count >= pc:
return True
return False
return bool(pc <= stats.play_count < next_pc or (next_pc == 0 and stats.play_count >= pc))
MEDALS: Medals = {

View File

@@ -47,9 +47,7 @@ async def process_skill(
attribute = await calculate_beatmap_attributes(beatmap.id, score.gamemode, mods_, redis, fetcher)
if attribute.star_rating < star or attribute.star_rating >= star + 1:
return False
if type == "fc" and not score.is_perfect_combo:
return False
return True
return not (type == "fc" and not score.is_perfect_combo)
MEDALS: Medals = {

View File

@@ -35,11 +35,7 @@ async def process_tth(
).first()
if not stats:
return False
if tth <= stats.total_hits < next_tth:
return True
elif next_tth == 0 and stats.play_count >= tth:
return True
return False
return bool(tth <= stats.total_hits < next_tth or (next_tth == 0 and stats.play_count >= tth))
MEDALS: Medals = {