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

Function relation_label

graphify/callflow_html.py:540–568  ·  view source on GitHub ↗

Map graph edge relation names to short diagram labels.

(relation: str, lang: str)

Source from the content-addressed store, hash-verified

538
539
540def relation_label(relation: str, lang: str) -> str:
541 """Map graph edge relation names to short diagram labels."""
542 relation = str(relation or "").strip()
543 zh = {
544 "calls": "调用",
545 "uses": "使用",
546 "imports": "导入",
547 "imports_from": "导入",
548 "method": "方法",
549 "contains": "包含",
550 "rationale_for": "说明",
551 "conceptually_related_to": "相关",
552 "participate_in": "参与",
553 "form": "组成",
554 }
555 en = {
556 "calls": "calls",
557 "uses": "uses",
558 "imports": "imports",
559 "imports_from": "imports",
560 "method": "method",
561 "contains": "contains",
562 "rationale_for": "explains",
563 "conceptually_related_to": "relates",
564 "participate_in": "joins",
565 "form": "forms",
566 }
567 mapped = (zh if is_zh(lang) else en).get(relation, relation.replace("_", " "))
568 return safe_mermaid_text(mapped)
569
570
571def preferred_edges(edges: list, allow_structure: bool = False) -> list:

Callers 3

generate_overview_graphFunction · 0.85
generate_section_cardsFunction · 0.85

Calls 3

is_zhFunction · 0.85
safe_mermaid_textFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected