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 30, 2024
1 parent 13ebb81 commit f85404b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/verify_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
Expand All @@ -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):
Expand All @@ -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())

Expand Down

0 comments on commit f85404b

Please sign in to comment.