Spaces:
Sleeping
Sleeping
Download sanitize.py from brocode12/bell-backend: direct link, hf CLI and curl.
- Browser
- Download file 452 Bytes
-
https://huggingface.co/spaces/brocode12/bell-backend/resolve/main/sanitize.py
- Command line
-
hf download hf://spaces/brocode12/bell-backend/sanitize.py
-
curl -L -o sanitize.py https://huggingface.co/spaces/brocode12/bell-backend/resolve/main/sanitize.py
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() | |