Skip to content

Commit

Permalink
fix: cleanup dict creation
Browse files Browse the repository at this point in the history
  • Loading branch information
varshamenon4 committed Aug 27, 2024
1 parent b51d318 commit 063e2ad
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ def add_course_staff_from_csv(self, csv_file, batch_size, batch_delay):
users = {}

for i in range(0, len(reader), batch_size):
users_dict = {k: v for k, v in [(u.username, u) for (u, c) in [User.objects.get_or_create(username=row.get('username'), email=row.get('email')) for row in reader[i:i + batch_size]]]}
users_dict = dict([(u.username, u) for (u, c)
in [User.objects.get_or_create(username=row.get('username'), email=row.get('email'))
for row in reader[i:i + batch_size]]])
users.update(users_dict)
time.sleep(batch_delay)

Expand Down

0 comments on commit 063e2ad

Please sign in to comment.