MCPcopy Create free account
hub / github.com/BUPT-GAMMA/MASFactory / dump

Method dump

masfactory/core/message/paragraph.py:65–86  ·  view source on GitHub ↗

Serialize key-value dictionary to paragraph text.

(self, message: dict)

Source from the content-addressed store, hash-verified

63 return result
64
65 def dump(self, message: dict) -> str:
66 """Serialize key-value dictionary to paragraph text."""
67
68 if isinstance(message, str):
69 return message
70
71 def _indent_block(text: str) -> str:
72 if not text:
73 return ""
74 return "\n".join(f" {line}" for line in text.splitlines())
75
76 result_lines: list[str] = []
77 for key, value in message.items():
78 result_lines.append(f"{key}:")
79 if value is not None:
80 if isinstance(value, str):
81 rendered = value
82 else:
83 rendered = _indent_block(self.render_value(value))
84 result_lines.append(rendered)
85
86 return "\n".join(result_lines).strip()

Callers

nothing calls this directly

Calls 2

render_valueMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected