From 24596fc968eceaccc4d982fd1126c5ba50642e9d Mon Sep 17 00:00:00 2001 From: UltralyticsAssistant Date: Thu, 5 Sep 2024 16:16:02 +0000 Subject: [PATCH] Auto-format by https://ultralytics.com/actions --- utils/clean_images.py | 2 +- utils/multithread_example.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/clean_images.py b/utils/clean_images.py index 0cd0772..426cd6b 100644 --- a/utils/clean_images.py +++ b/utils/clean_images.py @@ -105,7 +105,7 @@ def scan_one_file(f): if remove and os.path.exists(f[j]): os.remove(f[j]) print(f"Duplicate images {f[i]} {[f[j] for j in duplicates]}") - print("Found %g duplicates." % len(removed)) + print(f"Found {len(removed):g} duplicates.") if __name__ == "__main__": diff --git a/utils/multithread_example.py b/utils/multithread_example.py index dc61014..bbf1635 100644 --- a/utils/multithread_example.py +++ b/utils/multithread_example.py @@ -31,7 +31,7 @@ def fetch_url(url): results = ThreadPool(8).imap_unordered(fetch_url, urls) # 8 threads pbar = tqdm(enumerate(results), total=len(urls)) for i, (url, resp) in pbar: - pbar.desc = "%g %r %s" % (i, url, resp) + pbar.desc = f"{i:g} {url!r} {resp}" print("Done multi-thread (%.2fs)\n" % (timer() - t)) # Single-thread @@ -39,5 +39,5 @@ def fetch_url(url): pbar = tqdm(range(len(urls))) for i in pbar: url, resp = fetch_url(urls[i]) - pbar.desc = "%g %r %s" % (i, url, resp) + pbar.desc = f"{i:g} {url!r} {resp}" print("Done single-thread (%.2fs)\n" % (timer() - t))