MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / _env_flag

Function _env_flag

deeplabcut/core/debug/_debug_utils.py:21–39  ·  view source on GitHub ↗

Parse a boolean environment variable. Accepted truthy values: 1, true, yes, on Accepted falsy values: 0, false, no, off

(name: str, default: bool = False)

Source from the content-addressed store, hash-verified

19
20
21def _env_flag(name: str, default: bool = False) -> bool:
22 """Parse a boolean environment variable.
23
24 Accepted truthy values:
25 1, true, yes, on
26
27 Accepted falsy values:
28 0, false, no, off
29 """
30 value = os.getenv(name)
31 if value is None:
32 return default
33
34 value = value.strip().lower()
35 if value in {"1", "true", "yes", "on"}:
36 return True
37 if value in {"0", "false", "no", "off"}:
38 return False
39 return default
40
41
42def _env_optional_float(name: str, default: float | None = None) -> float | None:

Callers 2

debug_logger.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected