@@ -37,9 +37,9 @@ def analyze_stats(output: str) -> None:
3737 """Parse mypy stats output and calculate TypeForm parsing efficiency."""
3838
3939 # Extract the three counters
40- total_match = re .search (r' type_expression_parse_count:\s*(\d+)' , output )
41- success_match = re .search (r' type_expression_full_parse_success_count:\s*(\d+)' , output )
42- failure_match = re .search (r' type_expression_full_parse_failure_count:\s*(\d+)' , output )
40+ total_match = re .search (r" type_expression_parse_count:\s*(\d+)" , output )
41+ success_match = re .search (r" type_expression_full_parse_success_count:\s*(\d+)" , output )
42+ failure_match = re .search (r" type_expression_full_parse_failure_count:\s*(\d+)" , output )
4343
4444 if not (total_match and success_match and failure_match ):
4545 print ("Error: Could not find all required counters in output" )
@@ -51,23 +51,25 @@ def analyze_stats(output: str) -> None:
5151
5252 full_parses = successes + failures
5353
54- print (f "TypeForm Expression Parsing Statistics:" )
55- print (f "="* 50 )
54+ print ("TypeForm Expression Parsing Statistics:" )
55+ print ("=" * 50 )
5656 print (f"Total calls to SA.try_parse_as_type_expression: { total :,} " )
5757 print (f"Quick rejections (no full parse): { total - full_parses :,} " )
5858 print (f"Full parses attempted: { full_parses :,} " )
5959 print (f" - Successful: { successes :,} " )
6060 print (f" - Failed: { failures :,} " )
6161 if total > 0 :
6262 print ()
63- print (f "Efficiency Metrics:" )
63+ print ("Efficiency Metrics:" )
6464 print (f" - Quick rejection rate: { ((total - full_parses ) / total * 100 ):.1f} %" )
6565 print (f" - Full parse rate: { (full_parses / total * 100 ):.1f} %" )
6666 print (f" - Full parse success rate: { (successes / full_parses * 100 ):.1f} %" )
6767 print (f" - Overall success rate: { (successes / total * 100 ):.1f} %" )
6868 print ()
69- print (f"Performance Implications:" )
70- print (f" - Expensive failed full parses: { failures :,} ({ (failures / total * 100 ):.1f} % of all calls)" )
69+ print ("Performance Implications:" )
70+ print (
71+ f" - Expensive failed full parses: { failures :,} ({ (failures / total * 100 ):.1f} % of all calls)"
72+ )
7173
7274
7375if __name__ == "__main__" :
@@ -80,7 +82,9 @@ def analyze_stats(output: str) -> None:
8082 else :
8183 print ("Usage: python3 analyze_typeform_stats.py [mypy_output_with_stats]" )
8284 print ("Examples:" )
83- print (" python3 -m mypy --dump-build-stats file.py 2>&1 | python3 analyze_typeform_stats.py" )
85+ print (
86+ " python3 -m mypy --dump-build-stats file.py 2>&1 | python3 analyze_typeform_stats.py"
87+ )
8488 print (" python3 analyze_typeform_stats.py 'output_string'" )
8589 sys .exit (1 )
8690
0 commit comments