Spaces:
Sleeping

bell-backend / sanitize.py
brocode12's picture
Upload folder using huggingface_hub
a812c01 verified
Raw History Blame Contribute Delete
452 Bytes
"""Bolna substitutes absent %(param)s values as literal strings like "None" —
normalize those artifacts to real nulls before they reach storage."""
from typing import Optional
_NULL_ARTIFACTS = {"none", "null", "", "undefined", "not applicable", "n/a", "nil"}
def clean(value: Optional[str]) -> Optional[str]:
if value is None:
return None
if value.strip().lower() in _NULL_ARTIFACTS:
return None
return value.strip()