From d3e52590f936100aed90bd47f7e32eddee5d9b67 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Tue, 30 Jan 2024 16:35:44 +0100 Subject: [PATCH] refactor: Use f-string instead of `.format()` (#32) It's nicer to read and as such also recommended to use over `.format()` --- tools/verify_versions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/verify_versions.py b/tools/verify_versions.py index b905e8c..c10bc8a 100644 --- a/tools/verify_versions.py +++ b/tools/verify_versions.py @@ -16,11 +16,11 @@ def verify_all_mod_versions(): manifesto = json.load(f) for mod in manifesto: - print('Verifying "{}":'.format(mod)) + print(f'Verifying "{mod}":') # Build GitHub API link words = manifesto[mod]['Repository'].split('/') - tags_url = "https://api.github.com/repos/{}/{}/tags".format(words[-2], words[-1]) + tags_url = f"https://api.github.com/repos/{words[-2]}/{words[-1]}/tags" # Check all mod versions one-by-one for version in manifesto[mod]['Versions']: @@ -29,9 +29,9 @@ def verify_all_mod_versions(): # Compare manifesto commit hash with repository hash if local_hash == distant_version['commit']['sha']: - print('\t✔️ v{}'.format(version['Version'])) + print(f"\t✔️ v{version['Version']}") else: - sys.exit('\t❌ v{} (hash comparison failed)'.format(version['Version'])) + sys.exit(f"\t❌ v{version['Version']} (hash comparison failed)") def retrieve_tag_info(tag_name, repository_url): @@ -50,7 +50,7 @@ def retrieve_tag_info(tag_name, repository_url): i = 1 while True: - url = '{}?page={}'.format(repository_url, i) + url = f'{repository_url}?page={i}' response = urlopen(url) tags_data = json.loads(response.read())