# -*- coding: utf-8 -*-
"""Print only requirement-relevant lines from program-requirements txt."""
import io, re, sys

KW = re.compile(r'(units?|quarter|exam|courses?|598|299|297|teaching|normative|maximum|grade|GPA|3\.0|3\.5|'
                r'candidacy|dissertation|thesis|proposal|rotation|seminar|core|elective|master|doctor|Ph\.D|M\.S)', re.I)

for f in sys.argv[1:]:
    t = io.open('_r375_txt/' + f, encoding='utf-8', errors='ignore').read()
    lines = [l.strip() for l in t.split('\n') if l.strip()]
    print('=====', f)
    for l in lines:
        if len(l) > 60 and KW.search(l):
            print('-', l[:600])
