shroud
shroud copied to clipboard
changed fstrings to work with older versions of python3
This is a quick fix of the python f-strings for older versions of python3. Prior to python 3.12 f-strings could not contain backslashes. As a result I was getting errors like this.
File "/Users/janibal/.pyenv/versions/3.9.12/lib/python3.9/unittest/loader.py", line 220, in <listcomp>
suites = [self.loadTestsFromName(name, module) for name in names]
File "/Users/janibal/.pyenv/versions/3.9.12/lib/python3.9/unittest/loader.py", line 154, in loadTestsFromName
module = __import__(module_name)
File "/Users/janibal/repos/shroud/tests/__init__.py", line 13, in <module>
from . import (test_ast, test_declast, test_format, test_generate,
File "/Users/janibal/repos/shroud/tests/test_ast.py", line 8, in <module>
from shroud import ast, declast, generate, typemap #
File "/Users/janibal/repos/shroud/shroud/__init__.py", line 9, in <module>
from .main import create_wrapper
File "/Users/janibal/repos/shroud/shroud/main.py", line 19, in <module>
from . import (ast, declast, fcfmt, generate, metaattrs, metadata, splicer,
File "/Users/janibal/repos/shroud/shroud/wrapf.py", line 990
iface.append(f"import :: {',\t '.join(sorted(imports.keys()))}")
^
SyntaxError: f-string expression part cannot include a backslash
make: *** [test] Error 1
To fix that I just broke up the lines with f-strings and backslashes into two lines.