From db18ee37933671c61af59db6a408583b89b9bf33 Mon Sep 17 00:00:00 2001 From: Timo Ludwig Date: Tue, 28 Feb 2023 23:15:22 +0100 Subject: [PATCH] Use f-strings for management commands --- linkcheck/management/commands/checkexternal.py | 6 +++--- linkcheck/management/commands/checkinternal.py | 4 ++-- linkcheck/management/commands/checklinks.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/linkcheck/management/commands/checkexternal.py b/linkcheck/management/commands/checkexternal.py index a8c32f3..9ee1f25 100644 --- a/linkcheck/management/commands/checkexternal.py +++ b/linkcheck/management/commands/checkexternal.py @@ -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." diff --git a/linkcheck/management/commands/checkinternal.py b/linkcheck/management/commands/checkinternal.py index 551c31e..a6d0989 100644 --- a/linkcheck/management/commands/checkinternal.py +++ b/linkcheck/management/commands/checkinternal.py @@ -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." diff --git a/linkcheck/management/commands/checklinks.py b/linkcheck/management/commands/checklinks.py index c97f407..b7678e1 100644 --- a/linkcheck/management/commands/checklinks.py +++ b/linkcheck/management/commands/checklinks.py @@ -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."