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

Function _edge_payload

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

Source from the content-addressed store, hash-verified

695 return getattr(ref, "element_id", None) or getattr(ref, "id", None)
696
697 def _edge_payload(value) -> Optional[Dict[str, Any]]:
698 # Neo4j: .start_node/.end_node/.type. FalkorDB: .src_node/.dest_node/
699 # .relation.
700 start = getattr(value, "start_node", None)
701 if start is None:
702 start = getattr(value, "src_node", None)
703 end = getattr(value, "end_node", None)
704 if end is None:
705 end = getattr(value, "dest_node", None)
706 if start is not None and end is not None:
707 return {
708 "source": _ident(_node_ref_id(start)),
709 "target": _ident(_node_ref_id(end)),
710 "type": getattr(value, "type", None) or getattr(value, "relation", "RELATED"),
711 }
712 if isinstance(value, dict):
713 return {
714 "source": _ident(_meta(value, "_src")),
715 "target": _ident(_meta(value, "_dst")),
716 "type": _meta(value, "_label", "RELATED"),
717 }
718 return None
719
720 with db_manager.get_driver().session() as session:
721 for record in session.run(query):

Callers 1

Calls 3

_identFunction · 0.85
_node_ref_idFunction · 0.85
_metaFunction · 0.85

Tested by

no test coverage detected