Skip to content

The best ChatGPT that $100 can buy.

Python

simplify redundant if/elif in bloat metrics

Andrej Karpathybe56d29b87bc
diff --git a/nanochat/report.py b/nanochat/report.py
index c0f8b2b..6773f0b 100644
--- a/nanochat/report.py
+++ b/nanochat/report.py
@@ -173,10 +173,7 @@ Generated: {timestamp}
if wc_output:
total_line = wc_output.strip().split('\n')[-1]
parts = total_line.split()
- if 'total' in parts:
- num_lines = int(parts[0])
- num_chars = int(parts[1])
- elif len(parts) >= 2:
+ if len(parts) >= 2:
num_lines = int(parts[0])
num_chars = int(parts[1])
num_tokens = num_chars // 4 # assume approximately 4 chars per token