ruff: Fix SIM113 Use enumerate() for index variable in for loop.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 53e80c41ea)
This commit is contained in:
Anders Kaseorg
2024-02-01 16:38:52 -08:00
committed by Tim Abbott
parent 3f9e4bd54b
commit 230574ebbf
6 changed files with 12 additions and 34 deletions

View File

@@ -786,12 +786,7 @@ def import_uploads(
bucket_name = settings.S3_AUTH_UPLOADS_BUCKET
bucket = get_bucket(bucket_name)
count = 0
for record in records:
count += 1
if count % 1000 == 0:
logging.info("Processed %s/%s uploads", count, len(records))
for count, record in enumerate(records, 1):
if processing_avatars:
# For avatars, we need to rehash the user ID with the
# new server's avatar salt
@@ -878,6 +873,9 @@ def import_uploads(
os.makedirs(os.path.dirname(file_path), exist_ok=True)
shutil.copy(orig_file_path, file_path)
if count % 1000 == 0:
logging.info("Processed %s/%s uploads", count, len(records))
if processing_avatars:
# Ensure that we have medium-size avatar images for every
# avatar. TODO: This implementation is hacky, both in that it