MCPcopy Create free account
hub / github.com/dot-agent/nextpy / _replace_secrets

Function _replace_secrets

nextpy/ai/utils/serializable.py:99–117  ·  view source on GitHub ↗
(
    root: Dict[Any, Any], secrets_map: Dict[str, str]
)

Source from the content-addressed store, hash-verified

97
98
99def _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
120def to_json_not_implemented(obj: object) -> SerializedNotImplemented:

Callers 1

to_jsonMethod · 0.85

Calls 3

itemsMethod · 0.80
splitMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected