Skip to content

Commit

Permalink
executors: make autoconfig use f-strings
Browse files Browse the repository at this point in the history
  • Loading branch information
quantum5 authored and kiritofeng committed Dec 25, 2023
1 parent 09325d4 commit 2cb926a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions dmoj/executors/autoconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def main():

if hasattr(Executor, 'autoconfig'):
if not args.silent:
print_ansi('%-43s%s' % ('Auto-configuring #ansi[%s](|underline):' % name, ''), end=' ', file=sys.stderr)
print_ansi(f'Auto-configuring #ansi[{name}](|underline):'.ljust(43), end=' ', file=sys.stderr)
sys.stdout.flush()

try:
Expand All @@ -59,8 +59,9 @@ def main():
else:
if not args.silent:
print_ansi(
['#ansi[%s](red|bold)', '#ansi[%s](green|bold)'][success]
% (feedback or ['Failed', 'Success'][success]),
f'#ansi[{feedback or "Success"}](green|bold)'
if success
else f'#ansi[{feedback or "Failed"}](red|bold)',
file=sys.stderr,
)

Expand Down Expand Up @@ -95,9 +96,7 @@ def main():
else:
print_ansi('#ansi[No runtimes configured.](red|bold)', file=sys.__stderr__)
if not args.verbose:
print_ansi(
'Run #ansi[%s -V](|underline) to see why this is the case.' % (parser.prog,), file=sys.__stderr__
)
print_ansi(f'Run #ansi[{parser.prog} -V](|underline) to see why this is the case.', file=sys.__stderr__)

print(yaml.safe_dump({'runtime': result}, default_flow_style=False).rstrip())

Expand Down

0 comments on commit 2cb926a

Please sign in to comment.