Skip to content

Commit

Permalink
chore: fix pre-commit linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGrace2282 authored and alanzhu0 committed Aug 11, 2024
1 parent 54f9c47 commit fb2d797
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions intranet/apps/auth/management/commands/grant_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ def add_arguments(self, parser):
parser.add_argument("admin_group")

def handle(self, *args, **options):
g = Group.objects.get_or_create(name="admin_%s" % options["admin_group"])[0]
g = Group.objects.get_or_create(name=f"admin_{options['admin_group']}")[0]
get_user_model().objects.get_or_create(username=options["username"])[0].groups.add(g)
self.stdout.write("Added %s to %s" % (options["username"], options["admin_group"]))
self.stdout.write(f"Added {options['username']} to {options['admin_group']}")
6 changes: 3 additions & 3 deletions intranet/apps/eighth/tests/admin/test_admin_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,23 +531,23 @@ def test_delete_empty_groups(self):
self.make_admin()

# Create users
users = get_user_model().objects.get_or_create(username="users")[0]
userA = get_user_model().objects.get_or_create(username="userA")[0]
userB = get_user_model().objects.get_or_create(username="userB")[0]

# Create groups
group_empty = Group.objects.get_or_create(name="Empty Group")[0]
group_not_empty = Group.objects.get_or_create(name="Not Empty Group")[0]

# Add users to group
group_not_empty.user_set.add(users)
group_not_empty.user_set.add(userA)
group_not_empty.user_set.add(userB)

response = self.client.post(reverse("eighth_admin_delete_empty_groups_view"))
self.assertEqual(response.status_code, 302)
self.assertNotIn(group_empty, Group.objects.all())

# Add user to other group
group_not_empty.user_set.remove(users)
group_not_empty.user_set.remove(userA)
group_not_empty.user_set.remove(userB)

response = self.client.post(reverse("eighth_admin_delete_empty_groups_view"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ class Command(BaseCommand):
def handle(self, *args, **options):
forwards = SeniorEmailForward.objects.filter(user__graduation_year=get_senior_graduation_year(), user__user_type="student")
for forward in forwards:
self.stdout.write("%s:\t\t%s" % (forward.user, forward.email))
self.stdout.write(f"{forward.user}:\t\t{forward.email}")
2 changes: 1 addition & 1 deletion intranet/apps/emerg/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def check_emerg():
bad_strings = [
"There are no emergency announcements at this time",
"There are no emergency messages at this time",
"There are no emeregency announcements at this time",
"There are no emeregency annoncements at this time", # codespell: ignore
"There are no major announcements at this time.",
"There are no major emergency announcements at this time.",
"There are no emergencies at this time.",
Expand Down
2 changes: 1 addition & 1 deletion intranet/apps/templatetags/form_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ def field_(self, name):
try:
field = self.fields[name]
except KeyError as e:
raise KeyError("Key %r not found in '%s'" % (name, self.__class__.__name__)) from e
raise KeyError(f"Key {name!r} not found in '{self.__class__.__name__}'") from e
return BoundField(self, field, name)
4 changes: 2 additions & 2 deletions intranet/apps/users/management/commands/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Command(BaseCommand):

def handle(self, *args, **options):
u = get_user_model().objects.get(username=args[0])
self.stdout.write("%s - %s - %s" % (u, u.user_locked, str(u.last_login)))
self.stdout.write(f"{u} - {u.user_locked} - {u.last_login}")
u.user_locked = True
u.save()
self.stdout.write("%s - %s" % (u, u.user_locked))
self.stdout.write(f"{u} - {u.user_locked}")

0 comments on commit fb2d797

Please sign in to comment.