Function
_replace_secrets
(
root: Dict[Any, Any], secrets_map: Dict[str, str]
)
Source from the content-addressed store, hash-verified
| 97 | |
| 98 | |
| 99 | def _replace_secrets( |
| 100 | root: Dict[Any, Any], secrets_map: Dict[str, str] |
| 101 | ) -> Dict[Any, Any]: |
| 102 | result = root.copy() |
| 103 | for path, secret_id in secrets_map.items(): |
| 104 | [*parts, last] = path.split(".") |
| 105 | current = result |
| 106 | for part in parts: |
| 107 | if part not in current: |
| 108 | break |
| 109 | current[part] = current[part].copy() |
| 110 | current = current[part] |
| 111 | if last in current: |
| 112 | current[last] = { |
| 113 | "lc": 1, |
| 114 | "type": "secret", |
| 115 | "id": [secret_id], |
| 116 | } |
| 117 | return result |
| 118 | |
| 119 | |
| 120 | def to_json_not_implemented(obj: object) -> SerializedNotImplemented: |
Tested by
no test coverage detected