From a691d1750a7aa54989b25e599ee5bdf4767f51ac Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 13 Dec 2024 12:34:34 -0800 Subject: [PATCH] style: Apply linter formatting --- scripts/my_models.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/scripts/my_models.py b/scripts/my_models.py index 444b03bbb..390153b9b 100755 --- a/scripts/my_models.py +++ b/scripts/my_models.py @@ -31,7 +31,7 @@ def format_text_table(model_stats): """Format model statistics as a text table.""" total_tokens = sum(model_stats.values()) lines = [] - + lines.append("\nModel Token Usage Summary:") lines.append("-" * 80) lines.append(f"{'Model Name':<40} {'Total Tokens':>15} {'Percent':>10}") @@ -43,14 +43,14 @@ def format_text_table(model_stats): lines.append("-" * 80) lines.append(f"{'TOTAL':<40} {total_tokens:>15,} {100:>9.1f}%") - + return "\n".join(lines) def format_html_table(model_stats): """Format model statistics as an HTML table.""" total_tokens = sum(model_stats.values()) - + html = [ "", "", @@ -65,9 +65,12 @@ def format_html_table(model_stats): "", "

Model Token Usage Summary

", "", - "" + ( + "Percent" + ), ] - + for model, tokens in sorted(model_stats.items(), key=lambda x: x[1], reverse=True): percentage = (tokens / total_tokens) * 100 if total_tokens > 0 else 0 html.append( @@ -75,13 +78,13 @@ def format_html_table(model_stats): f"" f"" ) - + html.append( - f"" + "" f"" - f"" + "" ) - + html.extend(["
Model NameTotal TokensPercent
Model NameTotal Tokens
{tokens:,}{percentage:.1f}%
TOTAL
TOTAL{total_tokens:,}100.0%
100.0%
", "", ""]) return "\n".join(html)