def get_school(name): # Should lawschooltransparency ever change their formatting, this has to change too. data = get_school_data(name) print(name) a = float(pop_last(str(data[2].get_text()))) b = float(pop_last(str(data[4].get_text()))) c = float(pop_last(str(data[5].get_text()))) d = float(pop_last(str(data[7].get_text()))) e = float(pop_last(str(data[6].get_text()))) f = float(pop_last(str(data[3].get_text()))) g = float(pop_first(str(data[9].get_text()))) h = float(pop_last(str(data[8].get_text()))) i = get_prestige(name) j = float(str(data[12])) if (data[12] != "") else 0 g = float(str(data[13])) if (data[13] != "") else 0 #FIXME: Get full name from somewhere return school.School(name, name, a, b, c, d, e, f, g, h, i, j, g)
def setUpClass(cls): # called one time, at beginning print('setUpClass()') cls.school = school.School().get() name_1 = 'Yangyi Li' name_2 = 'Jerry' name_3 = 'Grass' gender_a = 'male' gender_b = 'male' gender_c = 'female' cls.student1 = student.Student(name_1, gender_a, 'yli43') cls.student2 = student.Student(name_2, gender_b, 'j777') cls.student3 = student.Student(name_3, gender_c, 'g690') cls.cs201 = course.Course("cs201", "Jason Hibbeler") cls.cs205 = course.Course("cs205", "Jason Hibbeler") cls.cs011 = course.Course("cs011", "teacher") cls.school.add_course(cls.cs201) cls.school.add_course(cls.cs205) cls.school.add_student(cls.student1) cls.school.add_student(cls.student2) cls.school.add_student(cls.student3)
def create_school(self): # find the name of the school school_name_raw = self.dom.xpath( '//*[@id="main"]/table[3]/tbody/tr[1]/td[1]//text()') # not every school name is formatted the same way, # name might be in different parts of school_name_raw[] if len(school_name_raw) == 3: adjusted = school_name_raw[2].replace('\n', '') adjusted = adjusted.replace(':', '').lstrip().rstrip()[:-1] else: adjusted = school_name_raw[3].replace('\n', '') adjusted = adjusted.replace(':', '').lstrip().rstrip()[:-1] school_name = adjusted # create School object self.currentSchool = school.School(school_name) if self.currentSchool.abbreviation in self.currentSemester.schools: self.currentSchool = self.currentSemester.schools[ self.currentSchool.abbreviation] else: self.currentSemester.schools[ self.currentSchool.abbreviation] = self.currentSchool
import school okul_sayisi = int(input("Kaç adet okul kaydedeceksin? : ")) dic = {} for i in range(0, okul_sayisi): okul = input("{}. Okul ismini gir : ".format((i + 1))) okul_year = input("Okul kaç yılında kuruldu : ") okul_fac_count = input("Fakülte sayısını gir : ") okul_dep_count = input("Kaç tane bölüm var : ") okul_lect_count = input("Kaç tane akademisyen çalışıyor : ") dic[str(i)] = [ okul, okul_year, okul_fac_count, okul_dep_count, okul_lect_count ] school_name = school.School(dic) school.School.saveSchool(school_name)
student2 = school.Student(mother2, father2, "Бойко", "Тимур", "Дмитриевич") student3 = school.Student(mother3, father3, "Остапенко", "Кирилл", "Тимофеевич") geo_subj = school.Subject("География") math_subj = school.Subject("Математика") rus_subj = school.Subject("Русский язык") math_teacher = school.Teacher(math_subj, "Васильева", "Наталья", "Борисовна") geo_teacher = school.Teacher(geo_subj, "Борисова", "Варвара", "Степановна") rus_teacher = school.Teacher(rus_subj, "Дмитриева", "Ольга", "Васильевна") class1 = school.Class(5, "A") class2 = school.Class(8, "a") class3 = school.Class(1, "В") class1.add_student(student1) class1.add_teacher(math_teacher, rus_teacher, geo_teacher) class2.add_student(student2) class2.add_teacher(math_teacher, rus_teacher, geo_teacher) class3.add_student(student3) class3.add_teacher(math_teacher, geo_teacher) school = school.School() school.add_class(class1, class2, class3) print("Классы школы: ", school._classes()) print(f"Ученики класса {class1.name} ", school.students(class1.name)) print(f"Предметы ученика {student2.full_name} ", school.subjects(student2.full_name)) print(f"Родители ученика {student2.full_name} ", school.parents(student2.full_name)) print(f"Учителя класса {class1.name} ", school.teachers(class1.name))
from flask_mysqldb import MySQL import school app = Flask(__name__) db = yaml.load(open('yuchundb.yaml')) app.config['JSON_AS_ASCII'] = False app.config['MYSQL_HOST'] = db['mysql_host'] app.config['MYSQL_USER'] = db['mysql_user'] app.config['MYSQL_PASSWORD'] = db['mysql_password'] app.config['MYSQL_DB'] = db['mysql_db'] mysql = MySQL(app) schools = school.School('./school/') REPEAT_CHECK_API = '/record' SCHOOL_API = '/school/' LANGUAGE_API = '/language/' @app.route('/', methods=['GET', 'POST']) def index(): if request.method == 'POST': userDetails = request.form name = userDetails['name'] ID = userDetails['ID'] email = userDetails['email'] password = userDetails['password'] year = userDetails['Year']
import names import school as xul from cars import Audi names.printName("Noordeen Malango") com = xul.School("College of Medicine", "Lilongwe", "Malawi", "1944") print(com.getName()) r8 = Audi("Beam 2000", 4, "1994", "black") print(r8.getEngine())
import school schoolData = school.getSchool(name="성광중", region="dge")[0] print(school.School(code=schoolData, region="dge").getMeal())