diff options
author | Hugo van Kemenade <hugovk@users.noreply.github.com> | 2020-11-17 23:52:11 +0200 |
---|---|---|
committer | Hugo van Kemenade <hugovk@users.noreply.github.com> | 2020-11-17 23:52:11 +0200 |
commit | 8d7f660309c8be0fb0b50439c335b89d5b31878d (patch) | |
tree | 5ae01d1c41e601d987c21df8128ca3429c2657fa /scripts/make_errors.py | |
parent | d956eaa3b1842a14895685be0d6d5e380fd029fc (diff) | |
download | psycopg2-8d7f660309c8be0fb0b50439c335b89d5b31878d.tar.gz |
Upgrade f-strings with flynt
Diffstat (limited to 'scripts/make_errors.py')
-rwxr-xr-x | scripts/make_errors.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/scripts/make_errors.py b/scripts/make_errors.py index e36d00a..0b795fa 100755 --- a/scripts/make_errors.py +++ b/scripts/make_errors.py @@ -68,7 +68,7 @@ def parse_errors_txt(url): continue # We don't expect anything else - raise ValueError("unexpected line:\n%s" % line) + raise ValueError(f"unexpected line:\n{line}") return classes, errors @@ -85,9 +85,7 @@ def fetch_errors(versions): for version in versions: print(version, file=sys.stderr) tver = tuple(map(int, version.split()[0].split('.'))) - tag = '{}{}_STABLE'.format( - (tver[0] >= 10 and 'REL_' or 'REL'), - version.replace('.', '_')) + tag = f"{tver[0] >= 10 and 'REL_' or 'REL'}{version.replace('.', '_')}_STABLE" c1, e1 = parse_errors_txt(errors_txt_url % tag) classes.update(c1) @@ -118,7 +116,7 @@ def generate_module_data(classes, errors): # success and warning - never raised continue - yield "\n/* %s */" % clslabel + yield f"\n/* {clslabel} */" for errcode, errlabel in sorted(errors[clscode].items()): if errcode in specific: @@ -126,7 +124,7 @@ def generate_module_data(classes, errors): else: clsname = errlabel.title().replace('_', '') if clsname in seen: - raise Exception("class already existing: %s" % clsname) + raise Exception(f"class already existing: {clsname}") seen.add(clsname) yield tmpl % { |