Download live_probe/range_tools.py from Darochin/openskynet: direct link, hf CLI and curl.
- Browser
- Download file 288 Bytes
-
https://huggingface.co/Darochin/openskynet/resolve/main/live_probe/range_tools.py
- Command line
-
hf download hf://Darochin/openskynet/live_probe/range_tools.py
-
curl -L -o range_tools.py https://huggingface.co/Darochin/openskynet/resolve/main/live_probe/range_tools.py
288 Bytes
| def clamp(value, lower=0, upper=10): | |
| """ | |
| Clamp a value between lower and upper bounds. | |
| Returns which bound was exceeded, or None if within range. | |
| """ | |
| if value < lower: | |
| return 'lower' | |
| elif value > upper: | |
| return 'upper' | |
| else: | |
| return None | |