aboutsummaryrefslogtreecommitdiff
path: root/backend/data/downloadImgsForReview.py
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2022-05-28 12:15:54 +1000
committerTerry Truong <terry06890@gmail.com>2022-05-28 12:15:54 +1000
commitc547ba59906bdd0ccebe5d4592739227dd0c73eb (patch)
tree99e35a5c0edd4c473b3b760a2d1cc75153572b6b /backend/data/downloadImgsForReview.py
parent9f0dcdea1049a59cd1fb4f0872edee1b7a87a4e6 (diff)
Convert from python "...".format() to f"..."
Diffstat (limited to 'backend/data/downloadImgsForReview.py')
-rwxr-xr-xbackend/data/downloadImgsForReview.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/backend/data/downloadImgsForReview.py b/backend/data/downloadImgsForReview.py
index 5556fce..d1191d7 100755
--- a/backend/data/downloadImgsForReview.py
+++ b/backend/data/downloadImgsForReview.py
@@ -56,7 +56,7 @@ def downloadImg(url, outFile):
file.write(data.content)
time.sleep(random.random() * (POST_DL_DELAY_MAX - POST_DL_DELAY_MIN) + POST_DL_DELAY_MIN)
except Exception as e:
- print("Error while downloading to {}: {}".format(outFile, str(e)), file=sys.stderr)
+ print(f"Error while downloading to {outFile}: {str(e)}", file=sys.stderr)
threadException = e
numThreads -= 1
# Create output directory if not present
@@ -113,7 +113,7 @@ for idx in range(nextIdx, len(eolIds)):
urlParts = urllib.parse.urlparse(url)
extension = os.path.splitext(urlParts.path)[1]
if len(extension) <= 1:
- print("WARNING: No filename extension found in URL {}".format(url), file=sys.stderr)
+ print(f"WARNING: No filename extension found in URL {url}", file=sys.stderr)
continue
outFiles.append(str(eolId) + " " + str(contentId) + extension)
urls.append(url)
@@ -132,7 +132,7 @@ for idx in range(nextIdx, len(eolIds)):
time.sleep(1)
exitLoop = True
break
- print("Downloading image to {}".format(outPath))
+ print("Downloading image to {outPath}")
# Perform download
numThreads += 1
thread = Thread(target=downloadImg, args=(urls[i], outPath), daemon=True)