(data, fmt: str)
| 32 | |
| 33 | |
| 34 | def format_output(data, fmt: str) -> str: |
| 35 | if fmt == "json": |
| 36 | return json.dumps(data, indent=2, ensure_ascii=False) |
| 37 | elif fmt == "text": |
| 38 | return _format_text(data) |
| 39 | return json.dumps(data, indent=2, ensure_ascii=False) |
| 40 | |
| 41 | |
| 42 | def _format_text(data, indent: int = 0) -> str: |
no test coverage detected