MCPcopy Index your code
hub / github.com/python/cpython / _format_output

Function _format_output

Tools/picklebench/memory_dos_impact.py:81–103  ·  view source on GitHub ↗

Format benchmark results according to requested format. Args: results: Benchmark results dictionary format_type: Output format ('text', 'markdown', or 'json') is_antagonistic: Whether these are antagonistic (DoS) test results Returns: Formatted output string

(results: Dict[str, Dict[str, Any]], format_type: str, is_antagonistic: bool)

Source from the content-addressed store, hash-verified

79
80
81def _format_output(results: Dict[str, Dict[str, Any]], format_type: str, is_antagonistic: bool) -> str:
82 """Format benchmark results according to requested format.
83
84 Args:
85 results: Benchmark results dictionary
86 format_type: Output format ('text', 'markdown', or 'json')
87 is_antagonistic: Whether these are antagonistic (DoS) test results
88
89 Returns:
90 Formatted output string
91 """
92 if format_type == 'json':
93 return Reporter.format_json(results)
94 elif is_antagonistic:
95 # Antagonistic mode uses specialized formatter for text/markdown
96 return Reporter.format_antagonistic(results)
97 elif format_type == 'text':
98 return Reporter.format_text(results)
99 elif format_type == 'markdown':
100 return Reporter.format_markdown(results)
101 else:
102 # Default to text format
103 return Reporter.format_text(results)
104
105
106class AntagonisticGenerator:

Callers 1

mainFunction · 0.85

Calls 4

format_jsonMethod · 0.80
format_antagonisticMethod · 0.80
format_textMethod · 0.80
format_markdownMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…