(data: Mapping[str, Any], key: str, path: str, *, default: bool | None = None)
| 249 | |
| 250 | |
| 251 | def 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 | |
| 261 | def optional_dict(data: Mapping[str, Any], key: str, path: str) -> Dict[str, Any] | None: |