MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / dump_yaml

Function dump_yaml

tools/export_design_template.py:199–208  ·  view source on GitHub ↗
(data: Mapping[str, Any], path: Path)

Source from the content-addressed store, hash-verified

197
198
199def dump_yaml(data: Mapping[str, Any], path: Path) -> None:
200 class _Dumper(yaml.SafeDumper):
201 pass
202
203 def _represent_ordered_dict(dumper: yaml.SafeDumper, value: OrderedDict) -> yaml.nodes.MappingNode: # type: ignore
204 return dumper.represent_dict(value.items())
205
206 _Dumper.add_representer(OrderedDict, _represent_ordered_dict)
207 with path.open("w", encoding="utf-8") as handle:
208 yaml.dump(data, handle, Dumper=_Dumper, sort_keys=False, allow_unicode=True)
209
210
211def parse_args(argv: Sequence[str] | None = None) -> argparse.Namespace:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected