import re, os, sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
base = os.path.dirname(os.path.abspath(__file__))
html = open(os.path.join(base, 'index_main.html'), encoding='utf-8').read()
m = re.search(r'const PROGRAMS\s*=\s*\[(.*?)\];', html, re.S)
body = m.group(1)
blocks = dict(re.findall(r'\{id:"([^"]+)"([\s\S]*?)(?=\{id:"|$)', body))
def g(rest, key):
    mm = re.search(key+r':"([^"]*)"', rest); return mm.group(1) if mm else ''
have=[]
for tid, rest in blocks.items():
    if g(rest,'s')!='gatech': continue
    testm=re.search(r'test:\{cls:"([^"]*)"\}', rest); cls=testm.group(1) if testm else ''
    if cls and cls!='待补':
        have.append((tid, g(rest,'deg'), cls, g(rest,'n')))
print("gatech 已有 test.cls 条目:", len(have))
for tid,deg,cls,n in have:
    print(f"  {tid} | {deg} | cls={cls} | {n}")
