From 7a050f1e083eb59d7e73f48d4439cd7f4791c2c1 Mon Sep 17 00:00:00 2001 From: GeckoEidechse Date: Mon, 29 Jan 2024 16:26:28 +0100 Subject: [PATCH] refactor: Use f-string instead of `.format()` It's nicer to read and as such also recommended to use over `.format()` --- .github/verify_versions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/verify_versions.py b/.github/verify_versions.py index 4da2ea1..2debf73 100644 --- a/.github/verify_versions.py +++ b/.github/verify_versions.py @@ -8,11 +8,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 and fetch distant tags list 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" response = urlopen(tags_url) tags_data = json.loads(response.read()) @@ -23,14 +23,14 @@ def verify_all_mod_versions(): # There should be only one matching version if len(matching_distant_versions) != 1: - sys.exit(' ❌ v{} (unknown distant version)'.format(version['Version'])) + sys.exit(f' ❌ v{version['Version']} (unknown distant version)') # Compare manifesto commit hash with repository hash distant_version = matching_distant_versions[0] if local_hash == distant_version['commit']['sha']: - print(' ✔️ v{}'.format(version['Version'])) + print(f' ✔️ v{version['Version']}') else: - sys.exit(' ❌ v{} (hash comparison failed)'.format(version['Version'])) + sys.exit(f' ❌ v{version['Version']} (hash comparison failed)') if __name__ == "__main__": verify_all_mod_versions()