88def format_metrics_safe (metrics : Dict [str , Any ]) -> str :
99 """
1010 Safely format metrics dictionary for logging, handling both numeric and string values.
11-
11+
1212 Args:
1313 metrics: Dictionary of metric names to values
14-
14+
1515 Returns:
1616 Formatted string representation of metrics
1717 """
1818 if not metrics :
1919 return ""
20-
20+
2121 formatted_parts = []
2222 for name , value in metrics .items ():
2323 # Check if value is numeric (int, float)
@@ -31,24 +31,24 @@ def format_metrics_safe(metrics: Dict[str, Any]) -> str:
3131 else :
3232 # For non-numeric values (strings, etc.), just convert to string
3333 formatted_parts .append (f"{ name } ={ value } " )
34-
34+
3535 return ", " .join (formatted_parts )
3636
3737
3838def format_improvement_safe (parent_metrics : Dict [str , Any ], child_metrics : Dict [str , Any ]) -> str :
3939 """
4040 Safely format improvement metrics for logging.
41-
41+
4242 Args:
4343 parent_metrics: Parent program metrics
4444 child_metrics: Child program metrics
45-
45+
4646 Returns:
4747 Formatted string representation of improvements
4848 """
4949 if not parent_metrics or not child_metrics :
5050 return ""
51-
51+
5252 improvement_parts = []
5353 for metric , child_value in child_metrics .items ():
5454 if metric in parent_metrics :
@@ -61,5 +61,5 @@ def format_improvement_safe(parent_metrics: Dict[str, Any], child_metrics: Dict[
6161 except (ValueError , TypeError ):
6262 # Skip non-numeric comparisons
6363 continue
64-
64+
6565 return ", " .join (improvement_parts )
0 commit comments