| 197 | |
| 198 | |
| 199 | def 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 | |
| 211 | def parse_args(argv: Sequence[str] | None = None) -> argparse.Namespace: |