MCPcopy Create free account
hub / github.com/BUPT-GAMMA/MASFactory / _keys_semantics

Function _keys_semantics

masfactory/visualizer/serialize.py:9–21  ·  view source on GitHub ↗
(value: object)

Source from the content-addressed store, hash-verified

7
8
9def _keys_semantics(value: object) -> dict[str, str] | None | str | None:
10 # Align to MASFactory Visualizer static parser semantics:
11 # - None -> null (inherit all keys)
12 # - {} -> "empty" (explicitly no keys)
13 # - {..} -> dict
14 if value is None:
15 return None
16 if isinstance(value, dict):
17 if len(value) == 0:
18 return "empty"
19 # keep as-is (usually key->description)
20 return {str(k): "" if v is None else str(v) for k, v in value.items()}
21 return None
22
23
24def _safe_obj(value: object) -> object:

Callers 1

ensure_nodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected