MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / optional_bool

Function optional_bool

entity/configs/base.py:251–258  ·  view source on GitHub ↗
(data: Mapping[str, Any], key: str, path: str, *, default: bool | None = None)

Source from the content-addressed store, hash-verified

249
250
251def optional_bool(data: Mapping[str, Any], key: str, path: str, *, default: bool | None = None) -> bool | None:
252 if key not in data:
253 return default
254 value = data[key]
255 key_path = f"{path}.{key}" if path else key
256 if not isinstance(value, bool):
257 raise ConfigError("expected boolean", key_path)
258 return value
259
260
261def optional_dict(data: Mapping[str, Any], key: str, path: str) -> Dict[str, Any] | None:

Callers 10

from_dictMethod · 0.90
from_dictMethod · 0.90
from_dictMethod · 0.90
from_dictMethod · 0.90
from_dictMethod · 0.90
from_dictMethod · 0.90
from_dictMethod · 0.90
from_dictMethod · 0.90
from_dictMethod · 0.90
from_dictMethod · 0.85

Calls 1

ConfigErrorClass · 0.85

Tested by

no test coverage detected