From c547ba59906bdd0ccebe5d4592739227dd0c73eb Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Sat, 28 May 2022 12:15:54 +1000 Subject: Convert from python "...".format() to f"..." --- backend/data/downloadImgsForReview.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'backend/data/downloadImgsForReview.py') 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) -- cgit v1.2.3