fix: resolve CI linting and type checking issues
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-02-04 02:19:05 +00:00
parent 193c6e5ea6
commit c99c1da976

View File

@@ -0,0 +1,26 @@
"""Output formatting utilities."""
from typing import Any, Dict, List
import json
import yaml
def format_data(data: List[Dict[str, Any]], format: str) -> str:
"""Format parsed data into the specified output format."""
if not data:
return ''
if format == 'json':
return json.dumps(data, indent=2)
elif format == 'yaml':
return yaml.safe_dump(data, default_flow_style=False)
elif format == 'csv':
if not data:
return ''
headers = list(data[0].keys())
lines = [','.join(headers)]
for row in data:
lines.append(','.join(str(row.get(h, '')) for h in headers))
return '\n'.join(lines)
else:
return '\n'.join(str(row) for row in data)