Download utils/form_helpers.py from sdu-shift/app: direct link, hf CLI and curl.
- Browser
- Download file 248 Bytes
-
https://huggingface.co/spaces/sdu-shift/app/resolve/main/utils/form_helpers.py
- Command line
-
hf download hf://spaces/sdu-shift/app/utils/form_helpers.py
-
curl -L -o form_helpers.py https://huggingface.co/spaces/sdu-shift/app/resolve/main/utils/form_helpers.py
248 Bytes
| def safe_int(value, default=0) -> int: | |
| """フォーム入力値・設定値を int に変換する。空文字や不正な値は default を返す""" | |
| try: | |
| return int(value) | |
| except (TypeError, ValueError): | |
| return default | |