Python formatted strings are much better to read and supposedly faster than %-formatted strings. Our python code uses a bunch of %-formatted strings which could be replaced with f-string syntax.
Example
Current %-formatted syntax:
ability_ref = "%s.%s" % (game_entity_name, ability_name)
f-string syntax:
ability_ref = f"{game_entity_name}.{ability_name}"
I am on it, have done something similar in an equally big project successfully with flynt.
https://pypi.org/project/flynt/
Hopefully flynt can deal with some of the more messy code blocks :)
I will be reviewing everything, but it seams it does it perfectly 100% of the time, though I have reverted some changes, since I am not 100% sure (and not able to properly test). But yeah, I will have 95% converted, and will flag the rest, by the end of this week.
@TobiasFP If you want you can already make a PR and have me double-check the results from flynt. I will probably be able to spot most errors quickly.
Thansk.
Just finishing up now.
There might be some small issues, like in:
strings.py:
colorized = 'x1b[{colorcode}m{string}x1b[m'.format(
colorcode=colorcode, string=string)
I think the x1b is a problem for flynt, which is why I have reversed (hopefully) all these conversions.
99% of the conversion is fine though.
I'll now test for all games. If the converter runs through for them, there's not much breakage to worry about.
Edit: Works!
Most helpful comment
I will be reviewing everything, but it seams it does it perfectly 100% of the time, though I have reverted some changes, since I am not 100% sure (and not able to properly test). But yeah, I will have 95% converted, and will flag the rest, by the end of this week.