Skip to content

Commit

Permalink
Use f-strings for management commands
Browse files Browse the repository at this point in the history
  • Loading branch information
timobrembeck authored and claudep committed Mar 19, 2023
1 parent 5899135 commit db18ee3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions linkcheck/management/commands/checkexternal.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def handle(self, *args, **options):
externalinterval = options['externalinterval'] or EXTERNAL_RECHECK_INTERVAL
limit = options.get('limit', None) or MAX_CHECKS_PER_RUN

self.stdout.write("Checking all external links that haven't been tested for %s minutes." % externalinterval)
self.stdout.write(f"Checking all external links that haven't been tested for {externalinterval} minutes.")
if limit != -1:
self.stdout.write("Will run maximum of %s checks this run." % limit)
self.stdout.write(f"Will run maximum of {limit} checks this run.")

check_count = check_links(external_recheck_interval=externalinterval, limit=limit, check_internal=False)
return "%s external URLs have been checked." % (check_count)
return f"{check_count} external URLs have been checked."
4 changes: 2 additions & 2 deletions linkcheck/management/commands/checkinternal.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def handle(self, *args, **options):

self.stdout.write("Checking all internal links.")
if limit != -1:
self.stdout.write("Will run maximum of %s checks this run." % limit)
self.stdout.write(f"Will run maximum of {limit} checks this run.")

check_count = check_links(limit=limit, check_external=False)
return "%s internal URLs have been checked." % (check_count)
return f"{check_count} internal URLs have been checked."
6 changes: 3 additions & 3 deletions linkcheck/management/commands/checklinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ def handle(self, *args, **options):
externalinterval = options['externalinterval'] or EXTERNAL_RECHECK_INTERVAL
limit = options['limit'] or MAX_CHECKS_PER_RUN

self.stdout.write("Checking all links that haven't been tested for %s minutes." % externalinterval)
self.stdout.write(f"Checking all links that haven't been tested for {externalinterval} minutes.")
if limit != -1:
self.stdout.write("Will run maximum of %s checks this run." % limit)
self.stdout.write(f"Will run maximum of {limit} checks this run.")

internal_checked = check_links(limit=limit, check_external=False)
external_checked = check_links(external_recheck_interval=externalinterval, limit=limit, check_internal=False)
return "%s internal URLs and %s external URLs have been checked." % (internal_checked, external_checked)
return f"{internal_checked} internal URLs and {external_checked} external URLs have been checked."

0 comments on commit db18ee3

Please sign in to comment.