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

@@ -77,13 +77,12 @@ class WikiartArtistExtractor(WikiartExtractor):
self.artist = None
def metadata(self):
url = "{}/{}/{}?json=2".format(self.root, self.lang, self.artist_name)
url = f"{self.root}/{self.lang}/{self.artist_name}?json=2"
self.artist = self.request(url).json()
return {"artist": self.artist}
def paintings(self):
url = "{}/{}/{}/mode/all-paintings".format(
self.root, self.lang, self.artist_name)
url = f"{self.root}/{self.lang}/{self.artist_name}/mode/all-paintings"
return self._pagination(url)
@@ -101,10 +100,8 @@ class WikiartImageExtractor(WikiartArtistExtractor):
title, sep, year = self.title.rpartition("-")
if not sep or not year.isdecimal():
title = self.title
url = "{}/{}/Search/{} {}".format(
self.root, self.lang,
self.artist.get("artistName") or self.artist_name, title,
)
url = (f"{self.root}/{self.lang}/Search/"
f"{self.artist.get('artistName') or self.artist_name} {title}")
return self._pagination(url, stop=True)
@@ -124,8 +121,7 @@ class WikiartArtworksExtractor(WikiartExtractor):
return {"group": self.group, "type": self.type}
def paintings(self):
url = "{}/{}/paintings-by-{}/{}".format(
self.root, self.lang, self.group, self.type)
url = f"{self.root}/{self.lang}/paintings-by-{self.group}/{self.type}"
return self._pagination(url)
@@ -141,8 +137,7 @@ class WikiartArtistsExtractor(WikiartExtractor):
self.type = match[3]
def items(self):
url = "{}/{}/App/Search/Artists-by-{}".format(
self.root, self.lang, self.group)
url = f"{self.root}/{self.lang}/App/Search/Artists-by-{self.group}"
params = {"json": "3", "searchterm": self.type}
for artist in self._pagination(url, params, "Artists"):