(cfg: Any | None, key_path: str, default: Any)
| 90 | |
| 91 | |
| 92 | def _get_cfg_value(cfg: Any | None, key_path: str, default: Any) -> Any: |
| 93 | if cfg is None: |
| 94 | return default |
| 95 | node: Any = cfg |
| 96 | for key in key_path.split("."): |
| 97 | if isinstance(node, dict) and key in node: |
| 98 | node = node[key] |
| 99 | continue |
| 100 | if hasattr(node, key): |
| 101 | node = getattr(node, key) |
| 102 | continue |
| 103 | return default |
| 104 | return node |
| 105 | |
| 106 | |
| 107 | def _build_net_config(cfg: Any | None, stage: str, obs_dim: int, actions_num: int) -> dict[str, Any]: |
no outgoing calls
no test coverage detected