Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 18, 2024
1 parent 28f102a commit 82eaf48
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions courses/management/commands/manage_program_certificates.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ def handle(self, *args, **options): # pylint: disable=too-many-locals # noqa:
# Handle revoke/un-revoke of a certificate
if revoke or unrevoke:
if not user:
raise CommandError("If you want to revoke/unrevoke a user argument is required")
raise CommandError(
"If you want to revoke/unrevoke a user argument is required"
)
revoke_status = manage_program_certificate_access(
user=user,
program=program,
Expand All @@ -131,7 +133,6 @@ def handle(self, *args, **options): # pylint: disable=too-many-locals # noqa:
# Handle the creation of the program certificate.
elif create:
if user:

# If -f or --force argument is provided, we'll forcefully generate the program certificate
certificate, created_cert = generate_program_certificate(
user=user, program=program, force_create=force_create
Expand All @@ -157,7 +158,6 @@ def handle(self, *args, **options): # pylint: disable=too-many-locals # noqa:
result_output = self.style.ERROR(result)
self.stdout.write(result_output)
else:

# generate certificates for all enrolled users
enrollments = ProgramEnrollment.objects.filter(program=program)
cert_count = 0
Expand All @@ -168,4 +168,6 @@ def handle(self, *args, **options): # pylint: disable=too-many-locals # noqa:
if created_cert:
cert_count += 1

self.stdout.write(f"Successfully created {cert_count} certificates for program {program.readable_id}")
self.stdout.write(
f"Successfully created {cert_count} certificates for program {program.readable_id}"
)

0 comments on commit 82eaf48

Please sign in to comment.