MCPcopy Create free account
hub / github.com/celery/celery / _float_env

Function _float_env

celery/worker/state.py:43–54  ·  view source on GitHub ↗

Parse a float environment variable with proper error handling.

(name: str, default: float)

Source from the content-addressed store, hash-verified

41
42
43def _float_env(name: str, default: float) -> float:
44 """Parse a float environment variable with proper error handling."""
45 value = os.environ.get(name)
46 if value is None:
47 return float(default)
48
49 try:
50 return float(value)
51 except ValueError as exc:
52 raise ImproperlyConfigured(
53 f"Invalid value for {name}: expected float, got {value!r}"
54 ) from exc
55
56
57#: Worker software/platform information.

Callers 1

state.pyFile · 0.85

Calls 2

getMethod · 0.45

Tested by

no test coverage detected