Improved sanatization of props when converting them to Cdefs

This commit is contained in:
Sleepy Monax 2024-01-21 16:32:31 +01:00
parent aa6a55f717
commit 07932d134a

View file

@ -112,7 +112,10 @@ def _computeCdef(scope: TargetScope) -> str:
res = set()
def sanatize(s: str) -> str:
return s.lower().replace(" ", "_").replace("-", "_").replace(".", "_")
TO_REPLACE = [" ", "-", "."] # -> "_"
for r in TO_REPLACE:
s = s.replace(r, "_")
return "".join(filter(lambda c: c.isalnum() or c == "_", s))
for k, v in scope.target.props.items():
if isinstance(v, bool):