MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / add_node

Function add_node

graphify/extract.py:3538–3559  ·  view source on GitHub ↗
(nid: str, label: str, line: int, *, node_type: str | None = None,
                 metadata: dict | None = None)

Source from the content-addressed store, hash-verified

3536 swift_protocol_names, swift_class_names = _swift_pre_scan(root, source)
3537
3538 def add_node(nid: str, label: str, line: int, *, node_type: str | None = None,
3539 metadata: dict | None = None) -> None:
3540 if nid in seen_ids:
3541 return
3542 seen_ids.add(nid)
3543 merged = dict(metadata or {})
3544 if namespace_stack:
3545 merged.setdefault("namespace", ".".join(namespace_stack))
3546 if scope_stack and node_type != "namespace":
3547 merged.setdefault("scope_chain", list(scope_stack))
3548 node = {
3549 "id": nid,
3550 "label": label,
3551 "file_type": "code",
3552 "source_file": str_path,
3553 "source_location": f"L{line}",
3554 }
3555 if node_type:
3556 node["type"] = node_type
3557 if merged:
3558 node["metadata"] = sanitize_metadata(merged)
3559 nodes.append(node)
3560
3561 def add_edge(src: str, tgt: str, relation: str, line: int,
3562 confidence: str = "EXTRACTED", weight: float = 1.0,

Callers 15

_ruby_extra_walkFunction · 0.70
_extract_genericFunction · 0.70
walkFunction · 0.70
extract_apexFunction · 0.70
extract_dartFunction · 0.70
ensure_typeFunction · 0.70
extract_verilogFunction · 0.70
extract_juliaFunction · 0.70
_emit_importFunction · 0.70
extract_fortranFunction · 0.70
extract_goFunction · 0.70

Calls 1

sanitize_metadataFunction · 0.90

Tested by

no test coverage detected