MCPcopy Index your code
hub / github.com/huggingface/diffusers / parse_flag_from_env

Function parse_flag_from_env

tests/others/test_utils.py:282–295  ·  view source on GitHub ↗
(key, default=False)

Source from the content-addressed store, hash-verified

280
281
282def parse_flag_from_env(key, default=False):
283 try:
284 value = os.environ[key]
285 except KeyError:
286 # KEY isn't set, default to `default`.
287 _value = default
288 else:
289 # KEY is set, convert it to True or False.
290 try:
291 _value = str_to_bool(value)
292 except ValueError:
293 # More values are supported, but let's keep the message simple.
294 raise ValueError(f"If set, {key} must be yes or no.")
295 return _value
296
297
298_run_staging = parse_flag_from_env("HUGGINGFACE_CO_STAGING", default=False)

Callers 1

test_utils.pyFile · 0.70

Calls 1

str_to_boolFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…