tessl install tessl/pypi-tabulate@0.9.0Pretty-print tabular data in Python with extensive formatting options and output format support.
Agent Success
Agent success rate when using this tile
69%
Improvement
Agent success rate improvement when using this tile compared to baseline
0.9x
Baseline
Agent success rate without this tile
77%
Build a report generation system that produces sales data reports in multiple output formats.
Your system should accept sales data containing product names, quantities sold, revenue, and profit margins. It should generate formatted reports in different styles depending on the target audience and platform.
Implement a ReportGenerator class with the following capabilities:
Format Selection: Generate reports in 4 different output formats:
'github' - GitHub Flavored Markdown tables'psql' - PostgreSQL-style console output'html' - HTML table markup'latex' - LaTeX tabular formatData Input: Accept sales data as a list of dictionaries where each dictionary has keys: product (string), quantity (int), revenue (float), margin (float)
Column Headers: Extract column headers from the dictionary keys
Return Value: The generate_report(data, format_type) method must return a formatted string representation of the table
@generates
class ReportGenerator:
"""
Generates formatted reports from sales data in multiple output formats.
"""
def generate_report(self, data, format_type):
"""
Generate a formatted report from sales data.
Args:
data: List of dictionaries containing product sales information.
Each dict has keys: product, quantity, revenue, margin
format_type: String indicating desired format
('markdown', 'psql', 'html', 'latex')
Returns:
String containing the formatted report
"""
passProvides table formatting support.