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

Function _node_payload

src/codegraphcontext/cli/cli_helpers.py:669–688  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

667 return isinstance(value, dict) and _has_meta(value, "_label") and not _has_meta(value, "_src")
668
669 def _node_payload(value) -> Dict[str, Any]:
670 if hasattr(value, "labels"):
671 # FalkorDB's Node keeps properties in `.properties` and is not
672 # itself iterable; Neo4j's Node supports dict() via Mapping.
673 props = dict(value.properties) if hasattr(value, "properties") else dict(value)
674 labels = list(getattr(value, "labels", []) or [])
675 label = labels[0] if labels else "Node"
676 node_id = getattr(value, "element_id", None) or getattr(value, "id", None)
677 else:
678 props, label = dict(value), _meta(value, "_label", "Node")
679 node_id = _meta(value, "_id")
680 if node_id is None:
681 node_id = props.get("path") or props.get("name")
682 return {
683 "id": _ident(node_id),
684 "label": label,
685 "name": props.get("name") or props.get("path") or "",
686 "file_path": props.get("path", ""),
687 "line_number": props.get("line_number"),
688 }
689
690 def _node_ref_id(ref) -> Any:
691 # Neo4j's start_node/end_node are full Node objects; FalkorDB's

Callers 1

Calls 3

_metaFunction · 0.85
_identFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected