INNER CODE UNIT · Python
normalize_float
racenis/tram-sdk · devtools/codegen.py:239
def normalize_float(x):
x = x.rstrip("fF")
if "." not in x:
return x + ".0"
if x.startswith("."):
return "0" + x
if x.endswith("."):
return x + "0"
return x
def parse_vector(value, n: int, default):
m = re.search(r"\{(.*)\}|\((.*)\)", value)
if not m:
return default
inside = m.group(1) or m.group(2)
parts = [p.strip() for p in inside.split(",")]
if len(parts) != n:
return default