Skip to content

Commit

Permalink
refactor: Use f-string instead of .format()
Browse files Browse the repository at this point in the history
It's nicer to read and as such also recommended to use over `.format()`
  • Loading branch information
GeckoEidechse committed Jan 29, 2024
1 parent 915d5b9 commit 766829d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/verify_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand All @@ -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()

0 comments on commit 766829d

Please sign in to comment.