"""Reproduce editorial scores from coding-models-november-2026.json.
No external packages, model calls or API keys. Python 3 standard library.
Run: python coding-models-november-2026.py path/to/data.json
These are preference scores, not measured success rates. Read JSON caveats.
"""
import json, math, sys
from pathlib import Path
data=json.loads(Path(sys.argv[1] if len(sys.argv)>1 else "coding-models-november-2026.json").read_text())
def clip(x): return max(0,min(1,x))
for profile,weights in data["weights"].items():
    rows=[]
    for m in data["models"]:
        s=data["scenario"]
        request=(s["uncached_input_tokens"]*m["input"]+s["billable_output_tokens"]*m["output"])/1e6
        coding=.6*m["frontier"]+.4*m["terminal"]
        price=100*clip(math.log10(1/request)/3)
        context=100*clip(math.log2(m["context"]/32000)/5)
        score=sum(w*v for w,v in zip(weights,[coding,m["intelligence"],price,context]))
        rows.append((score,m["name"]))
    print("\n"+profile.upper())
    for rank,(score,name) in enumerate(sorted(rows,reverse=True),1):print(f"{rank:2} {score:8.4f} {name}")
