コード例 #1
0
ファイル: fix_data.py プロジェクト: timm3/classTable
def add_time_nums(collection):
    #bulk = collection.initialize_unordered_bulk_op()
    for start in collection.distinct('start'):
        if start != 'ARRANGED' and start is not None:
            collection.update({'start': start}, {'$set': {'start_num': XMLReader.parse_time(start)}})
    for end in collection.distinct('end'):
        if end != 'ARRANGED' and end is not None:
            collection.update({'end': end}, {'$set': {'end_num': XMLReader.parse_time(end)}})
コード例 #2
0
    def test_extract_class_ids(self):

        file = open("test_data/spring2013aas.xml")

        extract_result = XMLReader.extract_class_ids(file.read())

        self.assertEqual(16, len(extract_result))
コード例 #3
0
    def test_extract_subjects_data(self):

        file = open("test_data/spring2013.xml")

        extract_result = XMLReader.extract_subjects_data(file.read())

        self.assertEqual(187, len(extract_result))
コード例 #4
0
    def test_extract_terms_data(self):

        file = open("test_data/2014.xml")

        extract_result = XMLReader.extract_terms_data(file.read())

        self.assertEqual(3, len(extract_result))
コード例 #5
0
    def test_extract_class_general_data(self):

        file = open("test_data/spring2012aas100.xml")

        extract_result = XMLReader.extract_class_general_data(file.read())

        self.assertEqual("2012", extract_result.year)
        self.assertEqual("spring", extract_result.term)
        self.assertEqual("AAS", extract_result.code)
        self.assertEqual("100", extract_result.course_id)
        self.assertEqual("Asian American Studies", extract_result.subject)
        self.assertEqual("Intro Asian American Studies", extract_result.title)
コード例 #6
0
ファイル: Subject.py プロジェクト: timm3/classTable
 def get_children(self):
     
     classes = []
     for course_id in self.course_ids:
         url_info = URLInfo(self.year, self.term, self.code, course_id, None)
        
         class_data = MyIllinoisXMLRequest.get_data(url_info)
         if class_data == None:
             continue
         
         parsed_class_data = XMLReader.extract_class_general_data(class_data)
         class_general = ClassGeneral(parsed_class_data)
         classes.append(class_general)
         
     return classes
コード例 #7
0
ファイル: CalendarYear.py プロジェクト: timm3/classTable
 def get_children(self):
     
     terms = []
     url_info = URLInfo(self.year, None, None, None, None)
     
     term_data = MyIllinoisXMLRequest.get_data(url_info)
     if term_data == None:
         return None
     
     parsed_term_data = XMLReader.extract_terms_data(term_data)
     if parsed_term_data != None:
         for t in parsed_term_data:
             term = Term(t)
             terms.append(term)
     
     return terms
コード例 #8
0
ファイル: Term.py プロジェクト: uiuc-cs428-urs/classTable
    def get_children(self):

        subjects = []

        url_info = URLInfo(self.year, self.term, None, None, None)
        subject_data = MyIllinoisXMLRequest.get_data(url_info)

        if subject_data == None:
            return None

        parsed_subject_data = XMLReader.extract_subjects_data(subject_data)

        for s in parsed_subject_data:
            subject = Subject(s)
            subjects.append(subject)

        return subjects
コード例 #9
0
    def get_children(self):

        URLInfo = namedtuple("URLInfo", "year term code course_id crn")
        sections = []

        for crn in self.crns:
            url_info = URLInfo(self.year, self.term, self.code, self.course_id, crn)

            section_data = MyIllinoisXMLRequest.get_data(url_info)
            if section_data == None:
                continue

            parsed_section_data = XMLReader.extract_section_data(section_data)
            class_section = ClassSection(parsed_section_data)

            sections.append(class_section)

        return sections