Ejemplo n.º 1
0
def testStudentClass():
    print(BOLD + "Testing student class." + END)
    s = Student("name", "surname", "email@", 9.50, "county")
    custom_assert("Student contains correct given name.", s.getName() == "name")
    custom_assert("Student contains correct given surname.", s.getSurname() == "surname")
    custom_assert("Student contains correct given e-mail.", s.getEmail() == "email@")
    custom_assert("Student contains correct given grade.", s.getGrade() == 9.5)
    custom_assert("Student contains correct given county.", s.getCounty() == "county")
    try:
        s = Student("name123", "surname", "email@", 9.50, "county")
        custom_assert("Testing for raising exception for invalid name.", False)
    except ValueError:
        custom_assert("Testing for raising exception for invalid name.", True)
    try:
        s = Student("name", "surname123", "email@", 9.50, "county")
        custom_assert("Testing for raising exception for invalid surname.", False)
    except ValueError:
        custom_assert("Testing for raising exception for invalid surname.", True)
    try:
        s = Student("name", "surname", "email", 9.50, "county")
        custom_assert("Testing for raising exception for invalid email.", False)
    except ValueError:
        custom_assert("Testing for raising exception for invalid email.", True)
    try:
        s = Student("name", "surname", "email@", "9asd.50", "county")
        custom_assert("Testing for raising exception for invalid grade.", False)
    except ValueError:
        custom_assert("Testing for raising exception for invalid grade.", True)
Ejemplo n.º 2
0
 def store(self, name, age, gpa, grade):
     student = Student()
     student.name = name
     student.age = age
     student.gpa = gpa
     student.grade = grade
     self.students.append(student)
Ejemplo n.º 3
0
def addStudent():
    studict = []
    class_id = classed.pop()
    while True:
        sID = raw_input("ID:")
        if sID == "#":
            break 
        sName = raw_input("name:")
        banji = class_id
        dorm = input("dorm:")
        sex = raw_input("sex:")
        age = input("age:")
        stuClass = Student(sID,sName,banji,dorm,sex,age)
        studict.append(stuClass.getStudentArray())
        print stuClass.getStudentArray()          
    sqlVar = datafun()    
    sqlVar.Insertdata("student_infor", studict)
    
    rData = sqlVar.getOnedata("student_infor", 'id', studict[0][0])
    print rData['id']    
    if rData['id'] == studict[0][0]:        
        return True
    else:
        print rData['name']
        return False
Ejemplo n.º 4
0
 def get(self):
     name = self.request.get('name')
     school = self.request.get('school')
     student = Student(name=name, university=school)
     student.put()
     message = '<ul><li>%s, %s</li></ul>' % (name, school)
     self.response.write(message)
def main():
    outFile = open("students.dat", "wb")
    course1 = Course("CSC 157-050", "B", 4)
    course2 = Course("EGL 101-001", "C", 3)
    course3 = Course("PHY 201-0C1", "A", 5)
    course4 = Course("MAT 251-002", "B", 5)
    
    pickle.dump(course1, outFile)
    pickle.dump(course2, outFile)
    pickle.dump(course3, outFile)
    pickle.dump(course4, outFile)

    student1 = Student("Jim Bob")
    student1.addCourse(course1)
    student1.addCourse(course2)
    student1.addCourse(course3)
    student1.addCourse(course4)
    print(student1)
    
    pickle.dump(student1, outFile)
    print("Student data was written to students.dat")
    outFile.close()
    
    end_of_file = False
    inFile = open("students.dat", "rb")
    student_info = []
    print("\nNow reading students.dat")
    while not end_of_file:
        try:
            info = pickle.load(inFile)
            #add info to a list
            student_info.append(str(info))  #use the str method to convert the course into a string
        except EOFError:
            end_of_file = True
    
    inFile.close() 
    print(student_info)
    #add objects to a list
    dict_courses = {"First": course1, "Second": course2, "Third": course3, "Fourth": course4}
    for label, c in dict_courses.items():
        print(label, c)
        
    not_found = True
    checks = [False, False, False, False]
    while not_found:
        for label, c in dict_courses.items():
            if label == "First":
                checks[0] = "First"
            elif label == "Second":
                 checks[1] = "Second"
            elif label == "Third":
                 checks[2] = "Third"
            elif label == "Fourth":
                 checks[3] = "Fourth"          
        if checks[0] != False and checks[1] != False and checks[2] != False and checks[3] != False:
            print(dict_courses[checks[0]])
            print(dict_courses[checks[1]])
            print(dict_courses[checks[2]])
            print(dict_courses[checks[3]])
            not_found = False
Ejemplo n.º 6
0
def new_registration():
    obj=Student()
    obj.createbasicstudent(request.vars)
    obj.insertstudent(db)
    obj_academicdetails=Academicdetails()
    obj_academicdetails.insertacademicdetails(request.vars.emailid,request.vars.rollno,db)
    return dict(redirect(URL('student','login')))
Ejemplo n.º 7
0
def home():
    checkstudentvalidlogin()
    obj_student=Student()
    #obj_student.getstudentbasicdetails("*****@*****.**",db)
    obj_student.getstudentbasicdetails(session.emailid,db)
    images1 = db().select(db.notice_details.ALL)
    images2 = db().select(db.event_details.ALL)
    return dict(images1=images1,images2=images2)
Ejemplo n.º 8
0
    def action1(self, name):
        if name in Student._all_students:
            self.read_email(Student.email_student(name))
        else:
            emails_back = Student.email_all_students()
            for email in emails_back:
                if email:
                    self.read_email(email)

        return NEXT_ROUND
Ejemplo n.º 9
0
def main():



    p = Person("Charlotte Smith", 45, 55555555)
    s = Student("Kyle Smith", 24, 7777777, 12345641464, ['CS-332L', 'CS-312', 'CS-386'])
    print(p.get_name())
    print(s.get_name())

    print(isinstance(s, Person))
Ejemplo n.º 10
0
 def test_general(self):
     stu = Student('david')
     stu.enrol_course('CSC148')
     self.assertTrue(stu.is_takingcourse('CSC148'))
     stu.drop_course('CSC148')
     self.assertFalse(stu.is_takingcourse('CSC148'))
     stu.drop_course('CSC148')
Ejemplo n.º 11
0
def saveprofile():
    checkstudentvalidlogin()
    obj_student=Student()
    obj_student.createstudent(request.vars)
    #obj_student.getstudentbasicdetails("*****@*****.**",db)
    obj_student.updatestudent(session.emailid,db)
    obj_academicdetails=Academicdetails()
    obj_academicdetails.createacademicdetails(request.vars)
    obj_academicdetails.updateacademicdetails(session.emailid,db)
 
    return dict()
Ejemplo n.º 12
0
    def add_stu(self, stu_num, stu_psw):
        user_list = self.list

        new_stu = Student(stu_num, stu_psw)
        new_stu.set_number(stu_num)
        new_stu.set_password(stu_psw)
        user_list[stu_num] = new_stu

        self.set_user_list(user_list)

        print "Success!"
Ejemplo n.º 13
0
def decode_object(json_dict):
	if "__student__" in json_dict:
		new_student = Student(json_dict["name"])
		json_dict.pop("__student__")
		for course, info in json_dict["work"].items():
			new_student.add_course(course)
			for type, progress in info.items():
				progress_obj = Progress(type)
				for lg, attempts in progress.items():
					progress_obj.add_lg(lg)
					for attempt in attempts:
						progress_obj.add_attempt(attempt["lg"], \
							Attempt(attempt["score"], attempt["outof"], \
							attempt["date"], attempt["lg"], attempt["comment"]))
				new_student.add_progress(course, type, progress_obj)
Ejemplo n.º 14
0
    def get(self):
        if isStudent(self):
            self.finish(success=False,notification='权限不足,无法修改数据')
            return

        idc = self.get_argument('idc','')
        name = self.get_argument('name','')

        stu = Student.instance()

        if name == '' :
            stu.logger.warning('request param name is empty')
            self.finish(success=False)
            return
        if idc == '' :
            stu.logger.warning('request param idc is empty')
            self.finish(success=False)
            return
        sid = stu.getStuIdOnName(name)
        ret = self.searchAndDelRI(sid,idc)
        if ret == 0 :
            stu.logger.info('Delete reward info done')
            self.finish(success=True)
            return

        self.finish(success=False)
        return
 def generate_local(cls):
     students = Student.create_by_csv("data/students.csv")
     mentors = Mentor.create_by_csv("data/mentors.csv")
     year = 2016
     location = "Budapest"
     local_class = CodecoolClass(location, year, students, mentors)
     return local_class
Ejemplo n.º 16
0
    def get(self):
        stu = Student.instance()
        try:
            cname = self.get_argument('class','').strip()
            bdate = self.get_argument('begin','').strip()
            edate = self.get_argument('end','').strip()
            name = self.get_argument('name','').strip()

            #rinfos = stu.getAllRewardInfo()
            ris = []
            if name != '':
                sid = stu.getStuIdOnName(name)
                if sid != '':
                    ris = stu.getRewardInfo2(sid)
            else:
                ris = stu.getAllRewardInfo2()

            stu.logger.info(ris)
            ris = self.filterRewardInfoBetween(ris,bdate,edate)
            stu.logger.info(ris)
            if cname != '':
                ris = filter(lambda ri: ri['class']==cname,ris)
            stu.logger.info(ris)

            total = len(ris)
            ris = doPage(self,ris)

            self.finish('data',ris,total=total)
        except Exception,e:
            stu.logger.error(e)
Ejemplo n.º 17
0
    def post(self):
        try:
            if isStudent(self):
                self.finish(success=False,notification='权限不足,无法修改数据')
                return

            stu = Student.instance()
            stu.logger.info('set attend info')
            ris = json.loads(self.request.body)['data']
            if type(ris) == type({}):
                ris= [ris]
            for ri in ris :
                #day = ri['date']
                name = ri['student']
                sid = stu.getStuIdOnName(name)
                if sid == '':
                    stu.logger.error('cant find stu id of '+name)
                    self.finish(success=False,notification='姓名错误')
                    return

                stu.logger.info(ri['idc'])
                if ri.has_key('idc') and ri['idc'].startswith('reward_'):
                    stu.logger.info('modify reward info,first delete')
                    self.searchAndDelRI(sid,ri['idc'])
                else:
                    stu.logger.info('a new reward info')
                    ri['idc'] = 'reward_' + stu.getuuid()

                ret = stu.setRewardInfo(sid,ri)

        except Exception,e:
            stu.logger.error(e)
Ejemplo n.º 18
0
    def getAttendInfoBetween(self,begin,end):
        stu = Student.instance()
        try:
            if type(begin) != type(datetime) :
                begin = datetime.strptime(begin,'%Y/%m/%d')

            if type(end) != type(datetime) :
                end = datetime.strptime(end,'%Y/%m/%d')
            stu.logger.info(begin)
            stu.logger.info(end)
            if end < begin :
                return []

            days = (end-begin).days
            stu.logger.info(days)
            rets=[]
            for n in range(0,days+1):
                day = begin + timedelta(n)
                day = day.strftime('%Y/%m/%d')
                stu.logger.info(day)
                ret = stu.getAttendInfo(day)
                stu.logger.info(ret)
                for info in ret:
                    info = json.loads(info)
                    rets.append(info)

            return rets
        except Exception,e:
            stu.logger.error(e)
Ejemplo n.º 19
0
    def get(self):
        if isStudent(self):
            self.finish(success=False,notification='权限不足,无法修改数据')
            return


        day = self.get_argument('date','')
        idc = self.get_argument('idc','')

        stu = Student.instance()

        if day == '':
            stu.logger.warning('request param day is empty')
            self.finish(success=False)
            return
        if idc == '' :
            stu.logger.warning('request param idc is empty')
            self.finish(success=False)
            return
        ret = self.searchAndDelAI(day,idc)
        if ret == 0 :
            stu.logger.info('Delete attend info done')
            self.finish(success=True)
            return
        self.finish(success=False)
        return
Ejemplo n.º 20
0
    def get(self):
        stu = Student.instance()
        begin = self.get_argument('begin','0')
        stu.logger.info(begin)
        end = self.get_argument('end','0')
        stu.logger.info(end)
        name = self.get_argument('name','').strip()
        if begin=='0' and end=='0':
            stu.logger.info('begin =0 and end =0,so return the lastest 7 days quaninfo')
            #get the last week quan info
            end = datetime.today()
            begin = end - timedelta(6)
        else:
            begin = datetime.strptime(begin,'%Y/%m/%d')
            end = datetime.strptime(end,'%Y/%m/%d')

        ret = getQuanInfoBetween(begin,end)

        #generate xls
        r = genxls(r'/opt/simp/static/downloads/quaninfo.xls',cquaninfo,ret)
        if r:
            stu.logger.info('generate xls file success')
        else:
            stu.logger.error('generate xls file failed')


        total = len(ret)
        ret = doPage(self,ret)
        #stu.logger.info(ret)
        #stu.logger.info(name)
        #ret = self.filterStuName()
        if name != '' :
            ret = filter(lambda info: info.has_key('student') and info['student']==name ,ret)

        self.finish('quan',ret,total=total)
Ejemplo n.º 21
0
    def get(self):
        try:
            if isStudent(self):
                self.finish(success=False,notification='权限不足,无法修改数据')
                return


            stu = Student.instance()
            quanidc = self.get_argument('idc','')
            cname = self.get_argument('cname','')
            if quanidc == '':
                stu.logger.warning('request param idc is empty')
                self.finish(success=False)
                return
            if cname == '':
                stu.logger.warning('request param cname is empty')
                self.finish(success=False)
                return

            cid = stu.getClassIDbyName(cname)
            ret = self.searchAndDelQI(cid,quanidc)
            if ret == 0:
                stu.logger.info('delete qi done')
                self.finish(success=True)
                return
            self.finish(success=False)
            return
        except Exception,e:
            stu.logger.error(e)
            self.finish(success=False)
            return
Ejemplo n.º 22
0
    def get(self):
        try:
            if isStudent(self):
                self.finish(success=False,notification='权限不足,无法修改数据')
                return

            stu = Student.instance()
            noticeidc = self.get_argument('noticeidc','')
            if noticeidc=='':
                stu.logger.warning('notice idc is empty')
                return

            news = stu.getNotices()
            ret=[]
            for new in news:
                tmp = stu.str2dict(new)
                if tmp['idc'] == noticeidc:
                    stu.logger.info('find the  notice of idc :%s , that is %s' % (noticeidc,new))
                    ret = stu.deleteNotice(new)
                    if ret>0:
                        stu.logger.info('delete notice of idc :%s done' % noticeidc)
                        self.finish()
                        return
                    else:
                        stu.logger.warning('delete notice idc: %s failed' % noticeidc)
                        self.finish(success=False)
                        return
            self.finish(success=False)
            return
        except Exception,e:
            stu.logger.error(e)
            self.finish(success=False)
            return
Ejemplo n.º 23
0
    def get(self):
        stu = None
        try:
            stu = Student.instance()
            classid = self.get_argument('classid','')
            stu.logger.info("classid="+classid)
            if classid == '':
                stu.logger.warning('the request param classid is empty')
                self.finish(success=False)
                return
            if not classid.isdigit() :
                classid = stu.getClassIdOnName(classid)
            stu.logger.info('the request class id is %s' % classid)
            #classid = stu.getClassIdOnName(classid)
            #stu.logger.info("############classname="+str(classid))
            stuids = stu.getStuIdsofClass(classid)

            stu.logger.info(stuids)
            stuInfo = []
            for stuid in stuids:
                si = stu.getStuInfo(stuid)
                if si == None:
                    continue
                name = si['name']
                if name == "":
                    stu.logger.info(stuid+" is not fond in db")
                else:
                    stuInfo.append({"name":name,"id":stuid})
            stuInfo = stuInfo + [{'id':'0','name':'所有学生'}]
            self.finish("stunameids",stuInfo)
        except Exception ,e :
            stu.logger.warning(e)
            raise tornado.web.HTTPError(404)
Ejemplo n.º 24
0
    def get(self):
        try:
            if isStudent(self):
                self.finish(success=False,notification='权限不足,无法修改数据')
                return

            user = self.get_argument('user','')
            stu = Student.instance()
            if user == '':
                stu.logger.warning('request param user is empty')
                self.finish(success=False)
                return
            ret = stu.deleteUserInfo(user)
            if ret == 0:
                stu.logger.error('delete user failed ,user:%s is not in db' % user)
                self.finish(success=False)
                return

            self.finish(success=True)
            return

        except Exception,e:
            stu.logger.error(e)
            self.finish(success=False)
            return
Ejemplo n.º 25
0
    def post(self):
        try:
            if isStudent(self):
                self.finish(success=False,notification='权限不足,无法修改数据')
                return
            stu = Student.instance()
            stuinfo = json.loads(self.request.body)
            if type(stuinfo)==type({}) and stuinfo.has_key('data') :
                sis = stuinfo['data']
                if type(sis)==type({}):
                    sis = [sis]
                for si in sis:
                    ret = stu.getStuInfo(si['stuid'])
                    if si.has_key('idc') and not si['idc'].startswith('stu_'):
                        si['idc'] = u'stu_' +stu.getuuid()
                    if not si.has_key('idc'):
                        si['idc'] = u'stu_' +stu.getuuid()

                    if si.has_key('class') and not si['class'].isdigit() :
                        si['class'] = stu.getClassIdOnName(si['class'])
                    stu.setStuIdOnName(si['name'],si['stuid'])
                    stu.logger.info('set stu id(%s) on name(%s) ' % (si['stuid'],si['name']))
                    stu.setStuIDofClass(si['stuid'],si['class'])
                    stu.logger.info('set stu id(%s) on class id (%s) ' % (si['stuid'],si['class']))

                    stu.logger.info('set stu info %s' % str(si))
                    stu.setStuInfo(si)
        except Exception,e:
            stu.logger.error(e)
            self.finish(success=False)
            return
Ejemplo n.º 26
0
    def get(self):
        try:
            stu = Student.instance()
            begin = self.get_argument('begin','')
            end = self.get_argument('end','')
            today = datetime.today()
            if begin == '':
                begin = today - timedelta(365*10)
            else:
                begin = datetime.strptime(begin,'%Y/%m/%d')
            if end == '':
                end = today
            else:
                end = datetime.strptime(end,'%Y/%m/%d')

            news = stu.getNotices()
            ret=[]
            for new in news:
                new = stu.str2dict(new)
                date = datetime.strptime(new['date'],'%Y/%m/%d')
                if date>= begin and date <=end :
                    ret.append(new)

            total = len(ret)
            ret = doPage(self,ret)

            self.finish("data",ret,total=total)
            return
        except Exception,e:
            stu.logger.error(e)
Ejemplo n.º 27
0
    def get(self):
        user = users.get_current_user()
        q = Student.query(Student.email == user.email())
        p = q.get()

        settings_params = {"name": user.nickname(), "graduationProgress": 70}
        render_template(self, "settings.html", settings_params)
Ejemplo n.º 28
0
class EditBox(StudentBox):
    """编辑学生信息 - 继承StudentBox"""

    def __init__(self, student, callback):
        super(EditBox, self).__init__()
        self.callback = callback

        self.setTitle("修改信息...")
        self.setMsg("")
        self.setButton("修改")

        self.indexEdit.setText(student.index)
        self.nameEdit.setText(student.name)
        self.setSex(student.sex)
        self.birthEdit.setText(student.birth)
        self.majorEdit.setText(student.major)
        self.gradeEdit.setText(student.grade)
        self.classEdit.setText(student.classname)

        self._student = Student()

    def onFinished(self):
        self.applyToStudent(self._student)
        check, info = self._student.checkInfo()
        if check:
            self.callback(self._student)
        else:
            self.setMsg(info)
        return check
Ejemplo n.º 29
0
def get_student_list():
    s_list = []

    import os

    print os.getcwd()

    print "Reading roster ..."
    f = open('roster_101/data/roster.txt', 'r')

    for line in f:
        stu = Student(line)
        stu.grade()
        s_list.append(stu)

    return s_list
Ejemplo n.º 30
0
    def post(self):
        try:
            if isStudent(self):
                self.finish(success=False,notification='权限不足,无法修改数据')
                return


            stu = Student.instance()
            news = json.loads(self.request.body)
            news = news['data']
            if type(news)==type({}) :
                news = [news]
            all_news = stu.getNotices()
            for n in news:
                if n['author'] == '':
                    n['author'] == unicode('轶名')
                if n.has_key('content'):
                    n['content'] = n['content'].replace('\n','</p><p>')
                    n['content'] = '<p>' +n['content']
                    n['content'] = n['content'] + '</p>'
                if n.has_key('idc') and n['idc'].startswith('news_') :
                    #modify and first del it
                    stu.logger.info('modify the news')
                    for ns in all_news:
                        tmp = stu.str2dict(ns)
                        if tmp['idc'] == n['idc']:
                            stu.deleteNotice(ns)
                            stu.logger.info('delete the news : %s' % ns)
                            break
                n['idc'] = 'news_'+ stu.getuuid()
                stu.setNotice(n)
        except Exception,e:
            stu.logger.error(e)
            self.finish(success=False)
Ejemplo n.º 31
0
 def setUp(self):
     self.EPSILON = 0.01
     sub1 = Subject("ZTI", [[4, 5, 5], [0, 1, 1, 1, 1]])
     sub2 = Subject("PITE", [[4.5, 5, 5, 4], [1, 1, 1, 1, 1]])
     self.subjects = [sub1, sub2]
     self.student = Student("Adam Abacki", self.subjects)
Ejemplo n.º 32
0
def student():
    from student import Student

    stud = Student('Luka Zauber')
    yield stud
    del stud
Ejemplo n.º 33
0
from student import Student

student1 = Student("Jim", "Business", 3.1, False)
student2 = Student("Carol", "Criminology", 3.5, True)

print(student1.name)
print(student1.major)
print(student1.is_on_probation)
print(student2.name)
Ejemplo n.º 34
0
from student import Student

s1 = Student()

s1.type()
s1.see()
Ejemplo n.º 35
0
 def dodaj_studenta(self, imie, nazwisko):
     id = self._generuj_id()
     s = Student(imie, nazwisko, id)
     self._uczniowie.append(s)
# JTSK-350112
# a3 1.py
# Wossen Hailemariam
# [email protected]

from student import Student

Ob1 = Student("katy", 2)  #by changing the inputs we can check
Student.setScore(Ob1, 1, 100)
Student.setScore(Ob1, 2, 90)

Ob2 = Student("katy", 2)
Student.setScore(Ob2, 1, 80)
Student.setScore(Ob2, 2, 90)

print(Ob1)
print(Ob2)

print(Ob1 == Ob2)
print(Ob1 != Ob2)

print(Ob1 < Ob2)
print(Ob1 <= Ob2)
print(Ob1 > Ob2)
print(Ob1 >= Ob2)
Ejemplo n.º 37
0
def test_get_student():
	student = Student('Karlo',37)
	assert student.get_age_formatted == "37 years old"
Ejemplo n.º 38
0
from student import Student
print(Student.getcount())

s1 = Student('mehul', 'm', 10, 90.5) # 3002
name, roll = s1.getnameroll() # dereferencing

'''name = nr[0]
roll = nr[1]'''
print(name)
print(roll)
'''
1 - memory is reserved in the RAM object : 3002
2 - Student.__init__(3002, 'mehul', 'm', 10, 90.5)
'''

'''s1.name = 'mehul'
s1.gender = 'm'
s1.roll = 10
s1.marks = 90.5'''


s2 = Student('jane', 'f', 11, 45) # 3004
'''
1 - memory is reserved in the RAM object : 3004
2 - Student.__init__(3004, 'mehul', 'm', 10, 90.5)
'''

'''s2.name = 'jane'
s2.gender = 'f'
s2.roll = 11
s2.marks = 89'''
Ejemplo n.º 39
0
 def test___repr__return_correct_values(self, mock_stdout):
     mock_student = Student("Jordan", "Jenkins", "A45687563", True, 89, 91, 85)
     expected = "Jordan Jenkins A45687563 True 89 91 85\n"
     print(repr(mock_student))
     self.assertEqual(expected, mock_stdout.getvalue())
Ejemplo n.º 40
0
from cs50 import get_string
from student import Student

# Space for students
students = []

# Prompt for students' names and dorms
for i in range(3):
    name = get_string("name: ")
    dorm = get_string("dorm: ")
    students.append(Student(name, dorm))

# Print students' names and dorms
for student in students:
    print(f"{student.name} is in {student.dorm}.")
Ejemplo n.º 41
0
# grade center file works for this.
roster = LogFile(logPath + rosterName)

# Get all names
firstNames = roster.raw_data['First Name'].array
lastNames = roster.raw_data['Last Name'].array

# Make a student object for every name. Store students
# in studentList
studentList = []

# For every row in roster, create a student with the first and last 
# name of that row. 
for first, last in zip(firstNames, lastNames):

    studentList.append( Student( first, last ) )

# Import attendance and chat log files. (Only uses chat files if participation
# is calculated.) The 2 types of log file come from Zoom. Note that chat files 
# must contain date in their name in the format ddmmyyyy (e.g. Jan 1, 2020 
# would 01012020)
filenames = glob.glob(logPath + '*')
logFiles = []

for file in filenames:

    logObject = LogFile( file, startTime, duration )
    if logObject != None:
      logFiles.append( logObject )

# Use the log files to compute each student's grade
Ejemplo n.º 42
0
from abc import ABCMeta, abstractmethod
from student import Student
from class_teacher import ClassTeacher
from chief_teacher import ChiefTeacher
from staff_meeting import StaffMeeting
from question import Question
from level import Level

if __name__ == '__main__':
    nakagawa = Student("中川雄介")
    rookie = ClassTeacher("新人先生")
    veteran = ChiefTeacher("ベテラン先生")
    staffMeeting = StaffMeeting("職員会議")
    nakagawa.setNext(rookie).setNext(veteran).setNext(staffMeeting)
    nakagawa.putQuestion(Question("おやつはいくらまで?", Level(1)))
    nakagawa.putQuestion(Question("携帯電話持って行ってよい?", Level(3)))
Ejemplo n.º 43
0
import os
from flask import Flask, request, jsonify, render_template, Response
from student import Student

# Initialization
app = Flask(__name__)
app.debug = True

students = {s.id: s for s in [
    Student("Patricio Lopez", "MrPatiwi", True),
    Student("Jaime Castro", "jecastro1", False),
    Student("Belen Saldias", "bcsaldias", False)
]}


def param_to_bool(data):
    return data is not None and data.lower() == 'true'


# Controllers
@app.route("/")
def index():
    return render_template('index.html')


@app.route("/students", methods=['GET', 'POST'])
def students_index():
    if request.method == 'GET':
        items = [s.serialize() for (identifier, s) in students.items()]
        return jsonify(students=items)
Ejemplo n.º 44
0
"""
    350112
    a3 1.py
    MICHAEL MAGAISA
    [email protected]
"""

from student import Student


name1=input("Enter the first student's name: ")
name2=input("Enter the second student's name: ")
s1=Student(name1,2)
s2=Student(name2,3)
print("Checking for not being equal")

if s1!=s2:
    print("The students names are not equal")
else s1==s2:
    print("The students names are the same")

if s1<s2:
    print("Student 1's name is smaller than Student 2's name")
elif s1>s2:
    print("Student 1's name is larger than Student 2's name")
Ejemplo n.º 45
0
# Antonio Garcia
# Project 4a
# Due Date: May 19
# Submission Date: May 17

#test1.py

from student import Student

# Initializes the Student class
s = Student("1111", "Carter", "Marilyn", "312/473-4837", 1)
# Prints the student with the str method
print(s)
# Prints the student with the repr method
print(repr(s))

# Prints the username instance vriable
print(s.username)
# Prints the first_name instance vriable
print(s.first_name)
# Prints the last_name instance vriable
print(s.last_name)
# Prints the phone instance vriable
print(s.phone)
# Prints the year instance vriable
print(s.year)

# Updates the year, then prints the new value
s.update_year()
print(s.year)
Ejemplo n.º 46
0
from student import Student

stud1 = Student("John", 22, "Male", 80, 86, 74, 78, 74)

stud2 = Student("Mary", 20, "female", 78, 90, 86, 70, 78)

# stud1.total()  - we've already called it in our constructor
print(stud1.total)
print(stud1.average)

print(stud2.total)
print(stud2.average)
"""
Gross
nssf
paye


nhif

basic salary
"""
Ejemplo n.º 47
0
from student import Student

student1 = Student("Oscar", "Accounting", 3.1)
student2 = Student("Phyllis", "Business", 3.8)

print(student1.on_honor_roll())
Ejemplo n.º 48
0
from student import Student
from teacher import Teacher
from library import Library

student_1 = Student('Alexander Schiller', 0)
student_1.print_info()

teacher1 = Teacher('Nick', 0)
teacher1.print_info()

library = Library()
library.__dict__ = {'Chuk Palahniuk': 'Fight club'}
library.print_info()
Ejemplo n.º 49
0
from instructor import Instructor
from student import Student

#Create 4 Exercises
student_exercises = Exercise("Student Exercises", "Python")
react_nutshell = Exercise("React Nutshell", "React")
celeb_tribute = Exercise("Celebrity Tribute", "HTML")
petting_zoo = Exercise("Critters and Croquettes", "Python")

#Create 3 Cohorts
c40 = Cohort("Cohort 40")
c50 = Cohort("Cohort 50")
c9001 = Cohort("Cohort 9001")

#Create 4 students
eli_lavoie = Student("Eli", "Lavoie", "elijah-lavoie", "Cohort 40")
ryuji = Student("Ryuji", "Sakamoto", "for-realsies", "Cohort 40")
samo = Student("Sam", "Thomas", "sam-tha-wize", "Cohort 50")
goku = Student("Son", "Goku", "over9k", "Cohort 9001")

#Assign students to cohorts
c40.students.append(eli_lavoie)
c40.students.append(ryuji)
c50.students.append(samo)
c9001.students.append(goku)

#Create 3 instructors
igor = Instructor("Igor", "???", "velvetroom", "Cohort 40", "rehabilitation")
bobby = Instructor("Robert", "Pierson", "warped-thinker", "Cohort 50", "good music")
aug = Instructor("Augusto", "Iverson", "doctor-lifehacks", "Cohort 9001", "being toxic")
Ejemplo n.º 50
0
from student import Student

if __name__ == '__main__':
    chulsu = Student('김철수', 24, '서울', '남성')
    print(chulsu)
    chulsu.city = '대전'  #setter
    chulsu.age = 34  #setter

    print(chulsu.name)  #getter
    print(chulsu.gender)  #getter
    print(chulsu)

    # jimin = Student('한지민', 22, '부산', '여성')
    # print(jimin)
Ejemplo n.º 51
0
from flask import Flask, render_template, url_for, redirect, request
from flask_modus import Modus
from student import Student

app = Flask(__name__)
modus = Modus(app)

eiPhyoThein = Student(name="Ei Phyo Thein")
mayThuHnin = Student(name="May Thu Hnin")
thiriSan = Student(name="Thiri San")

students = [eiPhyoThein, mayThuHnin, thiriSan]


@app.route('/')
@app.route('/students/')
@app.route('/students', methods=["GET", "POST"])
def index():
    return render_template("index.html", students=students)


@app.route('/students/new')
def new():
    return render_template("new.html")


@app.route('/students/<int:id>', methods=["GET"])
def show(id):
    found_student = ""
    for student in students:
        if student.id == id:
Ejemplo n.º 52
0
from rds import Admin
from student import Student

Anik = Student(1410542042, "120120")
Anik.login(1410542042, '120120')
Ejemplo n.º 53
0
        if opt == '-e':
            episode_length = int(arg)
            print(episode_length)
        if opt == '-t':
            train_length = int(arg)
            print(train_length)
        if opt == '-g':
            gamma = float(arg)
            print(gamma)
        if opt == '-b':
            batch_size = int(arg)
            print(batch_size)

    dataset = torchvision.datasets.MNIST('/tmp',
                                         download=True,
                                         transform=transforms.ToTensor())
    teacher = Teacher(dataset[0][0].shape,
                      valid_size,
                      10,
                      device,
                      gamma=gamma,
                      output_size=batch_size)
    student = Student(dataset[0][0].shape, device)

    train_teacher(teacher,
                  student,
                  dataset,
                  valid_size,
                  episode_length=episode_length,
                  train_length=train_length)
Ejemplo n.º 54
0
Archivo: main.py Proyecto: meg991/OOP
from student import Student
from course import Course


devops = Course("DevOps", 35)
meg = Student("Meg", 991)
jack = Student("Jack", 992)

meg.enrol("DevOps")
jack.enrol("Python")

print("Course:", vars(devops))
print("Student:", vars(meg))
print("Student:", vars(jack))

# department_1 = Department("Developer", 1)
# department_1.add_course("Build")
# print(vars(department_1))
#
# department_2 = Department("Operation", 2)
# department_2.add_course("Monitor")
# print(vars(department_2))
#
# course_1 = Course("IT", 123, 105, "Dev")
# course_1.add_course("")
# print(vars(course_1))



Ejemplo n.º 55
0
def test_set_student_age():
	student = Student('Karlo',37)
	student.age = 38
	assert student.get_age_formatted == "38 years old"
Ejemplo n.º 56
0
from flask import Flask, render_template, url_for, redirect, request
from flask_modus import Modus
from student import Student

app = Flask(__name__)
modus = Modus(app)

eiPhyoThein = Student("Ei Phyo", "Thein")
mayThuHnin = Student("May Thu", "Hnin")
thiriSan = Student("Thiri", "San")

students = [eiPhyoThein, mayThuHnin, thiriSan]


def find_student(student_id):
    return [student for student in students if student.id == student_id][0]


@app.route('/')
def root():
    return redirect(url_for('index'))


@app.route('/students', methods=["GET", "POST"])
def index():
    if request.method == "POST":
        new_student = Student(request.form['first_name'],
                              request.form['last_name'])
        students.append(new_student)
        return redirect(url_for('index'))
    return render_template("index.html", students=students)
Ejemplo n.º 57
0
from student import Student

student1 = Student("Kevin", 7, 7.5, True)

print(student1.name)
print(student1.rollno)
print(student1.gpa)
print(student1.is_male)
Ejemplo n.º 58
0
from student import Student
from teacher import Teacher
from utils.field_validator import FieldValidator

command = ''
student_list = []
teacher_list = []

student_list.append(Student('Petya', 'NSK', 5554433, 5))
student_list.append(Student('Natasha', 'SPB', 5557733, 4))

teacher_list.append(Teacher('Masha', 'MSK', 124567, 1000.5))
teacher_list.append(Teacher('Vanya', 'KZN', 124533, 1100.5))

print('''
list of commands
all students - print list of all students
all teachers - print list of all teachers
add student - add new student
year income - show yearly income of chosen teacher
exit - for exit
''')

while command != 'exit':
    command = input('input command: ')

    if command == 'all students':
        for e in student_list:
            e.show_info()

    elif command == 'all teachers':
Ejemplo n.º 59
0
 def test___repr__return_type(self):
     mock_student = Student("Jordan", "Jenkins", "A45687563", True, 89, 91, 85)
     self.assertIsInstance(repr(mock_student), str)
Ejemplo n.º 60
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import requests
import time
import sys

from student import Student

if __name__ == '__main__':
    if len(sys.argv) != 4:
        exit(u'用法:' + sys.argv[0] + u' 学号 教务密码 选课序号')

    student = Student(sys.argv[1], sys.argv[2])
    print(u'学生姓名:' + student.name)
    student.printCourseInfo(sys.argv[3])

    while 1:
        try:
            if student.selectCourse(sys.argv[3]):
                exit(u'选课成功')
            else:
                print(u'选课失败')
                time.sleep(1)
        except requests.exceptions.RequestException:
            print(u'网络连接失败')
            time.sleep(3)