Spaces:
Sleeping
Sleeping
Download venv/lib/python3.14/site-packages/backoff/_jitter.py from HSR-DeepThink/Perhance: direct link, hf CLI and curl.
- Browser
- Download file 782 Bytes
-
https://huggingface.co/spaces/HSR-DeepThink/Perhance/resolve/main/venv/lib/python3.14/site-packages/backoff/_jitter.py
- Command line
-
hf download hf://spaces/HSR-DeepThink/Perhance/venv/lib/python3.14/site-packages/backoff/_jitter.py
-
curl -L -o _jitter.py https://huggingface.co/spaces/HSR-DeepThink/Perhance/resolve/main/venv/lib/python3.14/site-packages/backoff/_jitter.py
782 Bytes
| # coding:utf-8 | |
| import random | |
| def random_jitter(value: float) -> float: | |
| """Jitter the value a random number of milliseconds. | |
| This adds up to 1 second of additional time to the original value. | |
| Prior to backoff version 1.2 this was the default jitter behavior. | |
| Args: | |
| value: The unadulterated backoff value. | |
| """ | |
| return value + random.random() | |
| def full_jitter(value: float) -> float: | |
| """Jitter the value across the full range (0 to value). | |
| This corresponds to the "Full Jitter" algorithm specified in the | |
| AWS blog's post on the performance of various jitter algorithms. | |
| (http://www.awsarchitectureblog.com/2015/03/backoff.html) | |
| Args: | |
| value: The unadulterated backoff value. | |
| """ | |
| return random.uniform(0, value) | |