Created
April 1, 2015 02:47
-
-
Save qguv/5f30076b72e0e69aac16 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"import pennant.backend as pb\n", | |
"with open(\"results.html\") as f:\n", | |
" results = f.read()\n", | |
"courses = pb.parseToCourseList(pb.parseHtml(results))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"taking = []\n", | |
"def take(*crns):\n", | |
" existingCrns = [ c.crn for c in taking ]\n", | |
" toAdd = [ c for c in courses\n", | |
" if c.crn in crns\n", | |
" and c.crn not in existingCrns ]\n", | |
" print(\"Adding:\")\n", | |
" for course in toAdd:\n", | |
" if course.crn in existingCrns: continue\n", | |
" print(course.oneline())\n", | |
" taking.append(course)\n", | |
" existingCrns.append(course.crn)\n", | |
" print(\"\\nNow taking:\")\n", | |
" for course in taking:\n", | |
" print(course.oneline())\n", | |
" print(\"\\n{} credits total\\n\".format(sum([\n", | |
" pb.numeric(c.creditHours)\n", | |
" for c in taking])))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"0: Computer Organization w/ Prof. Li\n", | |
" OPEN (CSCI 304-01, CRN 10452); 41 seats left\n", | |
" Tuesday, Thursday from 02:00 PM to 03:20 PM\n", | |
" fulfills no GERs\n", | |
" 3 credits\n", | |
"\n", | |
"1: Operating Systems w/ Prof. Kearns\n", | |
" OPEN (CSCI 444-01, CRN 12664); 17 seats left\n", | |
" Tuesday, Thursday from 08:00 AM to 09:20 AM\n", | |
" fulfills no GERs\n", | |
" 3 credits: IN\n", | |
"\n", | |
"2: Introduction to Game Design w/ Prof. Peers\n", | |
" CLOSED (CSCI 420-01, CRN 13363); no seats left\n", | |
" Tuesday, Thursday from 02:00 PM to 03:20 PM\n", | |
" fulfills no GERs\n", | |
" 3 credits\n", | |
"\n", | |
"3: Finite Automata w/ Prof. Mao\n", | |
" CLOSED (CSCI 423-01, CRN 12345); 8 seats left\n", | |
" Tuesday, Thursday from 09:30 AM to 10:50 AM\n", | |
" fulfills no GERs\n", | |
" 3 credits\n", | |
"\n", | |
"4: Finite Automata w/ Prof. Mao\n", | |
" CLOSED (CSCI 423W-01, CRN 12346); -1 seats left\n", | |
" meeting times TBA\n", | |
" fulfills no GERs\n", | |
" 0 credits\n", | |
"\n", | |
"5: Simulation w/ Prof. Smirni\n", | |
" CLOSED (CSCI 426-01, CRN 12085); 10 seats left\n", | |
" Monday, Wednesday from 02:00 PM to 03:20 PM\n", | |
" fulfills no GERs\n", | |
" 3 credits: MATC\n", | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"# CS Courses\n", | |
"\n", | |
"def taken(course):\n", | |
" level = pb.numeric(course.level)\n", | |
" return level in (141, 241, 243, 301, 303, 312)\n", | |
"\n", | |
"def avoid(course):\n", | |
" level = pb.numeric(course.level)\n", | |
" return level > 499 or level < 200\n", | |
"\n", | |
"cs_courses = [ course for course in courses\n", | |
" if course.department == \"CSCI\"\n", | |
" and not taken(course)\n", | |
" and not avoid(course)]\n", | |
"cs_courses.sort(key=lambda c: c.isOpen, reverse=True)\n", | |
"\n", | |
"for i, course in enumerate(cs_courses):\n", | |
" print(\"{}:\".format(i), end=' ')\n", | |
" print(course.fullinfo())" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Adding:\n", | |
"OPEN: Computer Organization w/ Prof. Li (CSCI 304-01, CRN 10452)\n", | |
"OPEN: Operating Systems w/ Prof. Kearns (CSCI 444-01, CRN 12664)\n", | |
"\n", | |
"Now taking:\n", | |
"OPEN: Computer Organization w/ Prof. Li (CSCI 304-01, CRN 10452)\n", | |
"OPEN: Operating Systems w/ Prof. Kearns (CSCI 444-01, CRN 12664)\n", | |
"\n", | |
"6 credits total\n", | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"take(10452, 12664)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"0: History of English Language w/ Prof. Osiapem\n", | |
" OPEN (LING 303-01, CRN 13533); 22 seats left\n", | |
" Monday, Wednesday from 02:00 PM to 03:20 PM\n", | |
" fulfills no GERs\n", | |
" 3 credits: ENGL\n", | |
"\n", | |
"1: Language and Culture w/ Prof. Cochrane\n", | |
" OPEN (LING 308-01, CRN 12683); 24 seats left\n", | |
" Monday, Wednesday, Friday from 11:00 AM to 11:50 AM\n", | |
" fulfills no GERs\n", | |
" 3 credits\n", | |
"\n", | |
"2: First Language Acquisition w/ Prof. Skordos\n", | |
" OPEN (LING 358-01, CRN 14259); 20 seats left\n", | |
" Monday, Wednesday from 03:30 PM to 04:50 PM\n", | |
" fulfills no GERs\n", | |
" 3 credits\n", | |
"\n", | |
"3: Linguistic Field Methods w/ Prof. Martin\n", | |
" OPEN (LING 405-01, CRN 12699); 4 seats left\n", | |
" Tuesday, Thursday from 11:00 AM to 12:20 PM\n", | |
" fulfills GER 3\n", | |
" 4 credits: CSI\n", | |
"\n", | |
"4: Linguistic Field Methods w/ Prof. Martin\n", | |
" OPEN (LING 405-01, CRN 12699); 4 seats left\n", | |
" Tuesday from 05:00 PM to 05:50 PM\n", | |
" fulfills GER 3\n", | |
" 4 credits: CSI\n", | |
"\n", | |
"5: Language Attitudes w/ Prof. Charity Hudley\n", | |
" OPEN (LING 410-01, CRN 14260); 13 seats left\n", | |
" Tuesday from 03:30 PM to 06:20 PM\n", | |
" fulfills no GERs\n", | |
" 4 credits: IN\n", | |
"\n", | |
"6: Linguistic Anthropology w/ Prof. Taylor\n", | |
" OPEN (LING 415-01, CRN 14261); 7 seats left\n", | |
" Tuesday, Thursday from 09:30 AM to 10:50 AM\n", | |
" fulfills GER 3\n", | |
" 3 credits: CSI, ENGL\n", | |
"\n", | |
"7: Concept Acquisition w/ Prof. Skordos\n", | |
" OPEN (LING 464-02, CRN 12709); 1 seat left\n", | |
" Tuesday, Thursday from 03:30 PM to 04:50 PM\n", | |
" fulfills no GERs\n", | |
" 3 credits\n", | |
"\n", | |
"8: Language and Gender w/ Prof. Cochrane\n", | |
" OPEN (LING 474-01, CRN 13535); 11 seats left\n", | |
" Thursday from 03:30 PM to 06:20 PM\n", | |
" fulfills no GERs\n", | |
" 4 credits: ENGL\n", | |
"\n", | |
"9: Independent Study w/ Prof. STAFF\n", | |
" OPEN (LING 481-01, CRN 13960); 1 seat left\n", | |
" meeting times TBA\n", | |
" fulfills no GERs\n", | |
" 2 credits: IN\n", | |
"\n", | |
"10: Independent Study w/ Prof. STAFF\n", | |
" OPEN (LING 481-02, CRN 13993); 1 seat left\n", | |
" meeting times TBA\n", | |
" fulfills no GERs\n", | |
" 3 credits\n", | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"# LING Courses\n", | |
"\n", | |
"def taken(course):\n", | |
" level = pb.numeric(course.level)\n", | |
" return level in (220, 304, 418)\n", | |
"\n", | |
"def avoid(course):\n", | |
" level = pb.numeric(course.level)\n", | |
" return level > 499 or level < 200\n", | |
"\n", | |
"ling_courses = [ course for course in courses\n", | |
" if course.department == \"LING\"\n", | |
" and not taken(course)\n", | |
" and not avoid(course)]\n", | |
"ling_courses.sort(key=lambda c: c.isOpen, reverse=True)\n", | |
"\n", | |
"for i, course in enumerate(ling_courses):\n", | |
" print(\"{}:\".format(i), end=' ')\n", | |
" print(course.fullinfo())" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Adding:\n", | |
"OPEN: Linguistic Field Methods w/ Prof. Martin (LING 405-01, CRN 12699)\n", | |
"OPEN: Linguistic Anthropology w/ Prof. Taylor (LING 415-01, CRN 14261)\n", | |
"\n", | |
"Now taking:\n", | |
"OPEN: Computer Organization w/ Prof. Li (CSCI 304-01, CRN 10452)\n", | |
"OPEN: Operating Systems w/ Prof. Kearns (CSCI 444-01, CRN 12664)\n", | |
"OPEN: Linguistic Field Methods w/ Prof. Martin (LING 405-01, CRN 12699)\n", | |
"OPEN: Linguistic Anthropology w/ Prof. Taylor (LING 415-01, CRN 14261)\n", | |
"\n", | |
"13 credits total\n", | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"take(12699, 14261)" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.4.3" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment