示例#1
0
 def read_instructors(self, path):
     """ Reads the values in the path"""
     try:
         for cwid, name, dept in file_reading_gen(path,
                                                  3,
                                                  sep="\t",
                                                  header=True):
             self._instructors[cwid] = Instructor(cwid, name, dept)
     except ValueError as err:
         print(err)
示例#2
0
    def read_majors(self, dir_path):
        """ Reads majors in the path"""
        for major, flag, course in file_reading_gen(dir_path,
                                                    3,
                                                    sep='\t',
                                                    header=True):

            if major not in self._majors:
                self._majors[major] = Major(major)

            self._majors[major].update_major(flag, course)
示例#3
0
 def read_students(self, path):
     """ Reads the values in the path"""
     try:
         for cwid, name, major in file_reading_gen(path,
                                                   3,
                                                   sep="\t",
                                                   header=True):
             self._students[cwid] = Student(cwid, name, major,
                                            self._majors[major])
     except ValueError as err:
         print(err)
示例#4
0
    def read_grades(self, path):
        """ Reads the values in the path"""
        try:

            for student_cwid, course, grade, instructor_cwid in file_reading_gen(
                    path, 4, sep='\t', header=True):
                if student_cwid in self._students:

                    self._students[student_cwid].add_course(course, grade)

                if instructor_cwid in self._instructors:
                    self._instructors[instructor_cwid].add_course(course)

        except ValueError as erf:

            print(erf)