Skip to content

Commit e4a0b92

Browse files
committed
adjusted val cols
1 parent 0dc904b commit e4a0b92

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/webapp/validation.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ def __init__(
4343

4444

4545
def normalize_col(name: str) -> str:
46-
return re.sub(r"[^a-zA-Z0-9_]", "_", name.strip().lower())
46+
name = name.strip().lower() # Lowercase and trim whitespace
47+
name = re.sub(r"[^a-z0-9_]", "_", name) # Replace non-alphanum with underscore
48+
name = re.sub(r"_+", "_", name) # Collapse multiple underscores
49+
name = name.strip("_") # Remove leading/trailing underscores
50+
return name
4751

4852

4953
def load_json(path: str) -> Any:

0 commit comments

Comments
 (0)