replace old %-formatted and .format(…) strings with f-strings (#7671)

mostly using flynt
https://github.com/ikamensh/flynt
This commit is contained in:
Mike Fährmann
2025-06-28 19:36:16 +02:00
parent f77e98b57d
commit 9dbe33b6de
167 changed files with 756 additions and 891 deletions

View File

@@ -46,8 +46,8 @@ class YiffverseExtractor(BooruExtractor):
post_id = post["id"]
root = self.root_cdn if files[fmt][0] else self.root
post["file_url"] = url = "{}/posts/{}/{}/{}.{}".format(
root, post_id // 1000, post_id, post_id, extension)
post["file_url"] = url = \
f"{root}/posts/{post_id // 1000}/{post_id}/{post_id}.{extension}"
post["format_id"] = fmt
post["format"] = extension.partition(".")[0]
@@ -73,11 +73,11 @@ class YiffverseExtractor(BooruExtractor):
post["tags_" + types[type]] = values
def _fetch_post(self, post_id):
url = "{}/api/v2/post/{}".format(self.root, post_id)
url = f"{self.root}/api/v2/post/{post_id}"
return self.request(url).json()
def _pagination(self, endpoint, params=None):
url = "{}/api{}".format(self.root, endpoint)
url = f"{self.root}/api{endpoint}"
if params is None:
params = {}