MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / extract_entities

Function extract_entities

scripts/compare_backend_snapshots.py:173–185  ·  view source on GitHub ↗
(obj: Any, path: str = "$", out: Set[str] | None = None)

Source from the content-addressed store, hash-verified

171
172
173def extract_entities(obj: Any, path: str = "$", out: Set[str] | None = None) -> Set[str]:
174 if out is None:
175 out = set()
176
177 if isinstance(obj, dict):
178 for k in sorted(obj.keys()):
179 extract_entities(obj[k], f"{path}.{k}", out)
180 elif isinstance(obj, list):
181 for item in obj:
182 out.add(f"{path}[]::{canonical_json(normalize_json(item))}")
183 else:
184 out.add(f"{path}={canonical_json(obj)}")
185 return out
186
187
188@dataclass

Callers 1

mainFunction · 0.85

Calls 4

canonical_jsonFunction · 0.85
normalize_jsonFunction · 0.85
keysMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected