11import argparse
22import os
33import sys
4+
45from dataclasses import dataclass , field
56from typing import Iterable
67
@@ -182,6 +183,7 @@ def format_difference(compare: Iterable[Result], base: Iterable[Result]) -> str:
182183 else :
183184 return s
184185
186+
185187def report_larger_than_original (results_dir : str , python_versions : str , minifier_sha : str ) -> str :
186188 yield '''
187189## Larger than original
@@ -200,6 +202,7 @@ def report_larger_than_original(results_dir: str, python_versions: str, minifier
200202 for entry in larger_than_original :
201203 yield f'| { entry .corpus_entry } | { entry .original_size } | { entry .minified_size } ({ entry .minified_size - entry .original_size :+} ) |'
202204
205+
203206def report_unstable (results_dir : str , python_versions : str , minifier_sha : str ) -> str :
204207 yield '''
205208## Unstable
@@ -218,6 +221,7 @@ def report_unstable(results_dir: str, python_versions: str, minifier_sha: str) -
218221 for entry in unstable :
219222 yield f'| { entry .corpus_entry } | { python_version } | { entry .original_size } |'
220223
224+
221225def report_exceptions (results_dir : str , python_versions : str , minifier_sha : str ) -> str :
222226 yield '''
223227## Exceptions
@@ -242,6 +246,7 @@ def report_exceptions(results_dir: str, python_versions: str, minifier_sha: str)
242246 if not exceptions_found :
243247 yield ' None | | |'
244248
249+
245250def report_larger_than_base (results_dir : str , python_versions : str , minifier_sha : str , base_sha : str ) -> str :
246251 yield '''
247252## Top 10 Larger than base
@@ -271,6 +276,7 @@ def report_larger_than_base(results_dir: str, python_versions: str, minifier_sha
271276 if not there_are_some_larger_than_base :
272277 yield '| N/A | N/A | N/A |'
273278
279+
274280def report_slowest (results_dir : str , python_versions : str , minifier_sha : str ) -> str :
275281 yield '''
276282## Top 10 Slowest
@@ -287,6 +293,7 @@ def report_slowest(results_dir: str, python_versions: str, minifier_sha: str) ->
287293 for entry in sorted (summary .entries .values (), key = lambda entry : entry .time , reverse = True )[:10 ]:
288294 yield f'| { entry .corpus_entry } | { entry .original_size } | { entry .minified_size } | { entry .time :.3f} |'
289295
296+
290297def report (results_dir : str , minifier_ref : str , minifier_sha : str , base_ref : str , base_sha : str ) -> Iterable [str ]:
291298 """
292299 Generate a report comparing the results of two versions of python-minifier
0 commit comments