simplify if statements by using walrus operators (#7671)

This commit is contained in:
Mike Fährmann
2025-07-22 18:34:38 +02:00
parent e8b2a496ba
commit a097a373a9
83 changed files with 239 additions and 466 deletions

View File

@@ -109,8 +109,7 @@ class InkbunnyPoolExtractor(InkbunnyExtractor):
def __init__(self, match):
InkbunnyExtractor.__init__(self, match)
pid = match[1]
if pid:
if pid := match[1]:
self.pool_id = pid
self.orderby = "pool_order"
else:
@@ -142,8 +141,7 @@ class InkbunnyFavoriteExtractor(InkbunnyExtractor):
def __init__(self, match):
InkbunnyExtractor.__init__(self, match)
uid = match[1]
if uid:
if uid := match[1]:
self.user_id = uid
self.orderby = self.config("orderby", "fav_datetime")
else:
@@ -218,8 +216,7 @@ class InkbunnySearchExtractor(InkbunnyExtractor):
params["dayslimit"] = pop("days", None)
params["username"] = pop("artist", None)
favsby = pop("favsby", None)
if favsby:
if favsby := pop("favsby", None):
# get user_id from user profile
url = f"{self.root}/{favsby}"
page = self.request(url).text