def main(): print('\n_1_list_mentors: \n', Mentor._1_list_mentors()) print('\n_2_list_mentors_from_miskolc: \n', Mentor._2_list_mentors_from_miskolc()) print('\n_3_greatest_favourite_number: \n', Mentor._3_greatest_favourite_number()) print('\n_4_specific_applicant_by_first_name: \n', Applicant._4_specific_applicant_by_first_name()) print('\n_5_specific_applicant_by_email_domain: \n', Applicant._5_specific_applicant_by_email_domain()) print('\n_6_inserting_a_new_applicant: \n', Applicant._6_inserting_a_new_applicant()) print('\n_7_updating_data: \n', Applicant._7_updating_data()) print('\n_8_deleting_applicants: \n', Applicant._8_deleting_applicants())
def generate_local(cls): local_class = cls("Budapest", 2016) mentors = Mentor.create_by_csv("./data/mentors.csv") students = Student.create_by_csv("./data/students.csv") for mentor in mentors: local_class.mentors.append( Mentor(mentor[0], mentor[1], int(mentor[2]), mentor[3], mentor[4])) for student in students: local_class.students.append( Student(student[0], student[1], int(student[2]), student[3])) return local_class
def __init__(self, location, year, mentors, students): mentor = Mentor("leves", "Dani", "Daniel", 1234, "male", 10, 10) student = Student("leves", "Dani", "Daniel", 1234, "male", 10, 10) lista = mentor.create_by_csv() m = [] for i in range(len(lista)): m.append(lista[i].first_name + " " + lista[i].last_name) # m = lista[0].first_name + " " + lista[0].last_name lista = student.create_by_csv() s = [] for i in range(len(lista)): s.append(lista[i].first_name + " " + lista[i].last_name) self.location = location self.year = year self.mentors = m self.students = s
def generate_local(cls): print("***Generating local CodecoolClass...*** \n") local_object = CodecoolClass("Budapest", 2016) # print("Class Location: %s" % (cls.location)) # print("Year: %d" % ()) students_path = os.path.abspath("./data/students.csv") with open(students_path, newline='') as csvfile: reader = csv.reader(csvfile) for row in reader: instance = Student(int(row[6]), int(row[7]), row[0], row[1], int(row[2]), row[3], int(row[4]), row[5]) local_object.students.append(instance) mentors_path = os.path.abspath("./data/mentors.csv") with open(mentors_path, newline='') as csvfile: reader = csv.reader(csvfile) for row in reader: instance = Mentor(row[6], int(row[7]), row[0], row[1], int(row[2]), row[3], int(row[4]), row[5]) local_object.mentors.append(instance) EKI_path = os.path.abspath("./data/eki.csv") with open(EKI_path, newline='') as csvfile: reader = csv.reader(csvfile) for row in reader: instance = Eki(row[0], int(row[1]), row[2]) local_object.EKI_list.append(instance) # test # test = [local_object.students, local_object.mentors, local_object.EKI_list] # for test_subject in test: # print("List: %s" % (test_subject)) # for i in test_subject: # print(" Object name: %s. Object type: %s." % (i, type(i))) return local_object
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
def making_assignment(self): assignments_list = [ "Nincs kedvem assignment-et írni, keressetek mást.", "Zöldségek", "OOP - Orbitális Otthoni Palacsinta", "Vegyigyümi"] result = random.choice(assignments_list) print("\n" + str( Mentor.create_by_csv()[random.randint(0, 4)]) + " a következő Assignment-et írta: " + result)
def generate_local(cls): location = "Budapest" year = 2016 first_class = CodecoolClass(location, year) first_class.mentors = Mentor.create_by_csv("data/mentors.csv") first_class.students = Student.create_by_csv("data/students.csv") return first_class
def create_local_school(): ''' Creates a CodecoolClass object having some real-life data from the implementer students' real class ''' mentors = Mentor.create_by_csv('data/mentors.csv') students = Student.create_by_csv('data/students.csv') codecool_class = CodecoolClass("Krakow", 2016, mentors, students) return codecool_class
def generate_local(cls): local_class = cls("Budapest", 2016) mentors = Mentor.create_by_csv("./data/mentors.csv") students = Student.create_by_csv("./data/students.csv") for mentor in mentors: local_class.mentors.append(Mentor(mentor[0], mentor[1], int(mentor[2]), mentor[3], mentor[4])) for student in students: local_class.students.append(Student(student[0], student[1], int(student[2]), student[3])) return local_class
def create_local(cls): mentors = Mentor.create_by_csv("data/mentors.csv") students = Student.create_by_csv("data/students.csv") cc_object = CodecoolClass("Miskolc", 2017, mentors, students) print( colors['GREEN'] + "School @ Miskolc, in year 2017 is created, with {} mentors and {} students." .format(len(mentors), len(students)) + colors['END']) return cc_object
def generate_local(cls): mentors = Mentor.create_by_csv("data/mentors.csv") students = Student.create_by_csv("data/students.csv") events = Events.create_by_csv("data/events.csv") retrospectives = [] for student in students: retrospectives.append(student.retrospective_object) education = Education.create_by_csv("data/education.csv") local_codecool_class = cls("Budapest", 2016, mentors, students, retrospectives, events, education) return local_codecool_class
def generate_local(): year = date.today().year location = "Budapest" mentors = Mentor.create_by_csv("data/mentors.csv") students = Student.create_by_csv("data/students.csv") print("\nSchool at {} in {} has been created, with {} mentors and {} students.".format(location, year, len(mentors), len(students))) return CodecoolClass(location, year, mentors, students)
def generate_local(cls): cls.location = "Budapest" cls.year = 2016 cls.mentors = Mentor.create_by_csv("mentors.csv") cls.students = Student.create_by_csv("students.csv") cls.attendance = cls.ATTEND[random.randint(0, len(cls.ATTEND)-1)] cls.attention = False print("Codecool {} {} is generated with {} mentors and {} students.". format(cls.location, cls.year, len(cls.mentors), len(cls.students))) return cls
def generate_local(cls): # returning an instance with these parameters cls.location = "Budapest" cls.year = 2016 cls.mentors = Mentor.create_by_csv('data/mentors.csv') cls.students = Student.create_by_csv('data/students.csv') print("School @{0}, in year {1} is created, with {2} mentors and 58 students.".format( cls.location, cls.year, len(cls.mentors))) input() print("Let's not forget, that the other half of the floor was rented by Kovi") return CodecoolClass(cls.location, cls.year, cls.mentors, cls.students)
def generate_local(cls): cls.location = "Budapest" cls.year = 2016 cls.mentors = Mentor.create_by_csv("mentors.csv") cls.students = Student.create_by_csv("students.csv") cls.attendance = cls.ATTEND[random.randint(0, len(cls.ATTEND) - 1)] cls.attention = False print("Codecool {} {} is generated with {} mentors and {} students.". format(cls.location, cls.year, len(cls.mentors), len(cls.students))) return cls
def generate_local(cls): location = "Budapest" year = 2016 mentors = Mentor.create_by_csv("/data/mentors.csv") print("Mentors are initialised by CSV") students = Student.create_by_csv("/data/students.csv") print("Students are initialised by CSV\n") print( "School @ {} in year {} is created with {} mentors and {} students\n" .format(location, year, len(mentors), len(students))) codecool_object = CodecoolClass(location, year, mentors, students) return codecool_object
def generate_local(cls): # returning an instance with these parameters cls.location = "Budapest" cls.year = 2016 cls.mentors = Mentor.create_by_csv('data/mentors.csv') cls.students = Student.create_by_csv('data/students.csv') print( "School @{0}, in year {1} is created, with {2} mentors and 58 students." .format(cls.location, cls.year, len(cls.mentors))) input() print( "Let's not forget, that the other half of the floor was rented by Kovi" ) return CodecoolClass(cls.location, cls.year, cls.mentors, cls.students)
def import_mentors(cls): with open('./data/mentors.csv') as f: reader = csv.reader(f) for row in reader: temp_mentor = Mentor() temp_mentor.first_name = row[0] temp_mentor.last_name = row[1] temp_mentor.year_of_birth = row[2] temp_mentor.gender = row[3] temp_mentor.nick_name = row[4] CodecoolClass.MENTORS_LIST.append(temp_mentor)
def __init__(self): self.coffee_amount = 20 self.fridge_space = 200 self.mentor_in_kitchen = str(Mentor.create_by_csv()[random.randint( 0, 4)]) self.student_in_kitchen = str(Student.create_by_csv()[random.randint( 0, 28)]) self.phrases = [ "Jönnek az arabok? Akkor kéne ide egy falra szerelhető kecske lyuk!", "Basszunk beljebb!!!", "Rendeljünk egy zsíroskenyér kenésű csúszó űrtalicskát!", "Kéne ide egy bicikli hajtású majomkenyérfa!", "Készítsünk koszos zokni ízű sört!", "Mi van ma? Korhely Kedd?Csatak Csütörtök? Ja, hogy pusztulat Péntek!" ]
class CodecoolClass: location = "Miskolc" year = 2016 mentors = Mentor.create_by_csv() students = Student.create_by_csv() def __init__(self, location, year, mentors, students): self.location = str(location) self.year = int(year) self.mentors = mentors self.students = students @classmethod def generate_local(cls): print("\nMentors are initialized from CSV.") print("\nStudents are initialized from CSV.") print( "\nSchool @ {}, in year {} is created, with {} mentors and {} students." .format(cls.location, cls.year, len(cls.mentors), len(cls.students))) return CodecoolClass(cls.location, cls.year, cls.mentors, cls.students) def find_student_by_full_name(self, full_name): for i in range(len(self.students)): if self.students[i].last_name + " " + self.students[ i].first_name == full_name: print("\nIgen, '" + str(self.students[i]) + "' megtalálható a tanulók között.") return self.students[i] print("\n") print("'" + full_name + "'" + " nevű tanuló nincs nálunk.") def find_mentor_by_full_name(self, full_name): for i in range(len(self.mentors)): if self.mentors[i].last_name + " " + self.mentors[ i].first_name == full_name: print("\nIgen, '" + str(self.mentors[i]) + "' megtalálható a mentorok között.") return self.mentors[i] print("\n") print("'" + full_name + "'" + " nevű mentor nincs nálunk.")
def schedule(cls): """finds free interviews and assigns applicant and mentor with matching city""" a_notin_is = Applicant.select().join(cls, JOIN.LEFT_OUTER).where(cls.applicant_id==None) for a in a_notin_is: if a.school_cid is not None: try: mentor = Mentor.get(Mentor.school_id==a.school_cid) interview = Interview.get(Interview.location==a.school_cid) except Mentor.DoesNotExist: print('No available mentor.') break except Interview.DoesNotExist: print('No available interview time slot.') break cls.insert(applicant_id=a.aid, mentor_id=mentor.mid, interview_id=interview.iid).execute() interview.update_to_reserved() else: print('Assign closest school to applicants first.') break
def test_2_list_mentors_from_miskolc_list_type_returned(self): result = Mentor._2_list_mentors_from_miskolc() self.assertEqual(type(result).__name__, "list")
def test_2_list_mentors_from_miskolc_has_dictionaries(self): result = Mentor._2_list_mentors_from_miskolc() for mentor in result: self.assertEqual(type(mentor).__name__, "dict")
def test_1_list_mentors_values(self): result = Mentor._1_list_mentors() self.assertEqual(result[0], {'first_name': 'Attila', 'last_name': 'Molnár'}) self.assertEqual(result[4], {'first_name': 'Miklós', 'last_name': 'Beöthy'}) self.assertEqual(result[6], {'first_name': 'Mateusz', 'last_name': 'Ostafil'})
def generate_local(): cc_budapest = CodecoolClass("Budapest", 2016, Mentor.count_names(), Student.count_names()) print("School @ {}, in year {} is created, with {} mentors and {} students.".format(self.location, self.year, self.Mentor.count_names(), self.Student.count_names()))
def find_mentor_by_full_name(full_name): if full_name in Mentor.create_full_name_list(): print("{} was found between the mentors".format(full_name)) else: print("{} was not found between the mentors".format(full_name))
def create_mentor(cls): for m in cls.mentor_list: mentor = Mentor.create(name=m['name'], school_id=m['school_cid'])
from code_reviewer import CodeReviewer from curator import Curator from human import Human from mentor import Mentor from student import Student from weather_man import WeatherMan student = Student("Тимофей") curator = Curator("Марина") mentor = Mentor("Ира") reviewer = CodeReviewer("Евгений") friend = Human("Виталя") weather_man = WeatherMan("Игорь") # weather_man2 = WeatherMan("Игорь") print(student.ask_question(curator, 'мне грустненько, что делать?')) print(student.ask_question(friend, 'Как твое имя?')) print(student.ask_question(mentor, 'мне грустненько, что делать?')) print(student.ask_question(reviewer, 'когда каникулы?')) print(student.ask_question(reviewer, 'что не так с моим проектом?')) print(student.ask_question(friend, 'как устроиться на работу питонистом?')) print(student.ask_question(mentor, 'как устроиться работать питонистом?')) print(student.ask_question(mentor, 'как с погодой?')) print(student.ask_question(weather_man, 'как с погодой?')) print(student.ask_question(friend, 'Сколько у меня наследников?'))
def test_3_greatest_favourite_number_integer_type_returned(self): result = Mentor._3_greatest_favourite_number() self.assertEqual(type(result).__name__, "int")
def test_2_list_mentors_from_miskolc_values(self): result = Mentor._2_list_mentors_from_miskolc() self.assertEqual(result[0], {'nick_name': 'Atesz'}) self.assertEqual(result[1], {'nick_name': 'Pali'}) self.assertEqual(result[2], {'nick_name': 'Szodi'})
def test_2_list_mentors_from_miskolc_length(self): result = Mentor._2_list_mentors_from_miskolc() self.assertEqual(len(result), 3)
def test_1_list_mentors_has_dictionaries(self): result = Mentor._1_list_mentors() for mentor in result: self.assertEqual(type(mentor).__name__, "dict")
def test_1_list_mentors_list_type_returned(self): result = Mentor._1_list_mentors() self.assertEqual(type(result).__name__, "list")
def add_mentor(self, name, surname, age, gender, pesel, login, password, date_remove, status, date_when_added): Mentor.MENTOR_LIST.append( Mentor(name, surname, age, gender, pesel, login, password, date_remove, status, date_when_added))
def get_mentors(cls): from mentor import Mentor return [Mentor(raw_mentor) for raw_mentor in cls.mentors_data]
from codecool_class import CodecoolClass from mentor import Mentor from student import Student from events import Events import random student = Student("leves", "Laci", "Jocó", 1234, "male", 10, 10) mentor = Mentor("leves", "Dani", "Daniel", 1234, "male", 10, 10) codecool_bp = CodecoolClass("Budapest", 2016, student.create_by_csv(), mentor.create_by_csv()) events = Events("fds", "2re", 3) print("Codecool class generated") print("Venue: " + codecool_bp.location) print("Year: " + str(codecool_bp.year)) input("") # print("\n") # print(codecool_bp.mentors) for i in codecool_bp.mentors: print(i) print("Mentors are ready") input("") # print("\n") for i in codecool_bp.students: print(i) print("Students are ready") input("") # print("\n") print(codecool_bp.students[0] + " drank a coffee") input("") print("Energy of " + codecool_bp.students[0] + " increased from 30 to 55") input("")
def test_1_list_mentors_length(self): result = Mentor._1_list_mentors() self.assertEqual(len(result), 7)
def test_3_greatest_favourite_number_value(self): result = Mentor._3_greatest_favourite_number() self.assertEqual(result, 42)
for student in codecool_bp.students: if student.in_school: print('\033[93m%s\033[0m arrived: \033[93m%s\033[0m' % (student.first_name, student.in_school)) students_in_school.append(student) input() print('\033[93m%s\033[0m (\033[93m%s\033[0m) \033[92msenses low energy level \ among the students and initiates some exercises.\033[0m' % (codecool_bp.find_mentor_by_full_name('Miklós Beöthy').first_name, codecool_bp.find_mentor_by_full_name('Miklós Beöthy').nickname)) default_energy = [] for student in students_in_school: default_energy.append(student.energy_level) students_in_school, codecool_bp.mentors = Mentor.do_morning_gym(students_in_school, codecool_bp.mentors) for i, student in enumerate(students_in_school): print('The energy level of \033[93m%s\033[0m increased by \033[93m%d\033[0m due morning gym exercises.' % (student.first_name, student.energy_level - default_energy[i])) input() print("\033[92mWhen everybody is well energized, the mentors tell the daily agenda.\n\ If the students learned at home, they feel motivated, \n\ but if they were lazy they don't know what is going on.\033[0m") default_motivation = [] for student in students_in_school: default_motivation.append(student.motivation_level) students_in_school = Mentor.daily_agenda(students_in_school) for i, student in enumerate(students_in_school):
def viev_mentors( self): ## zwraca nam po prostu liste obiektów clasy mentor return Mentor.get_all()
def test_3_greatest_favourite_number_different_value(self): original_favourite_number_of_first_mentor = Database.mentors_data[0][-1] Database.mentors_data[0][-1] = 927 result = Mentor._3_greatest_favourite_number() self.assertEqual(result, 927) Database.mentors_data[0][-1] = original_favourite_number_of_first_mentor
def info(self): return f"The {self.name} cohort has {len(self.students)} students and {len(self.mentors)} mentors." people = [] mark = Person('Mark', 46, 'male') people.append(mark) jane = Person() people.append(jane) john = Student('John Doe', 20, 'male', 'BME') people.append(john) student = Student() people.append(student) gandhi = Mentor('Gandhi', 148, 'male', 'senior') people.append(gandhi) mentor = Mentor() people.append(mentor) sponsor = Sponsor() elon = Sponsor('Elon Musk', 46, 'male', 'SpaceX') people.append(elon) student.skip_days(3) for i in range(5): elon.hire() for i in range(3): sponsor.hire() for person in people:
# One week for day in days_of_the_week: # One day next_line = input("\nIt's " + day + ".\n") match_of_yesterday = random.choice(all_matches) was_it_expected = bool(match_of_yesterday.expected_result) print("Yesterday there was a match: " + match_of_yesterday.match_name) if match_of_yesterday.important == True: next_line = input("It was a really interesting match, a lot of students placed a bet on it.\n") else: next_line = input("Only the addicted players placed a bet on that.\n") for student in all_students: student.bet(match_of_yesterday, was_it_expected) next_line = input("\nA few students seems to have a bad day...") random.choice(all_mentors).slap(Mentor.check_energy(all_students)) next_line = input("They deserved it.\n") for student in all_students: dojo_to_solve = random.choice(all_dojos) dojo_to_solve.solved(student) next_line = input("\nSome students are so heavily affected by their lack of knowledge... and the hard time for them is just coming...") random.choice(all_mentors).slap(Mentor.check_energy(all_students)) next_line = input("Probably, they feel much better now.\n") for events in range(3): played_table_football_match = random.choice(table_football_matches) played_table_football_match.played(observed_class) actual_project = random.choice(all_projects) actual_project.worked_on(all_students) random.choice(all_mentors).teach(Mentor.check_knowledge(all_students)) if day != 'Friday': next_line = input("The day is over. A lot of students bet on the match of the day.")
def __init__(self, location, year, mentors_csv, students_csv): self.location = location self.year = year self.mentors = Mentor.generate_list(mentors_csv) self.students = Student.generate_list(students_csv)
}, '-c': { 'name': 'convergence', 'type': 'int', 'default': 5 }, '-g': { 'name': 'global_state', 'type': 'bool', 'default': False } } arg = ArgParser(sys.argv[2:], opt_pattern) opt = arg.read() fg = FactorGraph(opt) fg.load(sys.argv[1]) ms = MessageServer(opt) agents = {} for v in fg.variables: agent = Agent(v, fg, ms, opt) agents[v] = agent mentor = Mentor(agents, fg, ms, opt) mentor.initialize() mentor.run() mentor.terminate()
# One day next_line = input("\nIt's " + day + ".\n") match_of_yesterday = random.choice(all_matches) was_it_expected = bool(match_of_yesterday.expected_result) print("Yesterday there was a match: " + match_of_yesterday.match_name) if match_of_yesterday.important == True: next_line = input( "It was a really interesting match, a lot of students placed a bet on it.\n" ) else: next_line = input("Only the addicted players placed a bet on that.\n") for student in all_students: student.bet(match_of_yesterday, was_it_expected) next_line = input("\nA few students seems to have a bad day...") random.choice(all_mentors).slap(Mentor.check_energy(all_students)) next_line = input("They deserved it.\n") for student in all_students: dojo_to_solve = random.choice(all_dojos) dojo_to_solve.solved(student) next_line = input( "\nSome students are so heavily affected by their lack of knowledge... and the hard time for them is just coming..." ) random.choice(all_mentors).slap(Mentor.check_energy(all_students)) next_line = input("Probably, they feel much better now.\n") for events in range(3): played_table_football_match = random.choice(table_football_matches) played_table_football_match.played(observed_class) actual_project = random.choice(all_projects) actual_project.worked_on(all_students) random.choice(all_mentors).teach(Mentor.check_knowledge(all_students))
def __init__(self): self.students = Student.create_by_csv() self.mentors = Mentor.create_by_csv() self.location = 'Cracow' self.year = 2016
from assignment import Assignment from codecool_class import CodecoolClass from electronic import Electronic, Laptop from feedback import Feedback from mentor import Mentor from student import Student from colors import Colors print(Colors.OKBLUE + "\nThe ACT presents an (almost) average day in codecool." + Colors.ENDC) skip = input() miki = Mentor.create_by_csv()[0] dani = Mentor.create_by_csv()[1] tomi = Mentor.create_by_csv()[2] print("Mentors are initialized from CSV.") skip = input() móni = Student.create_by_csv()[0] beru = Student.create_by_csv()[1] beni = Student.create_by_csv()[3] print("Students are initialized from CSV.") skip = input() print("School @ Budapest, in year 2016 is created, with 3 mentors and 4 students.") skip = input() print("Examine a mentor.. for example Dani.") skip = input() print("Nickname: {}\nKnowledge level: {}\nEnergy level: {}\nJoy level: {}".format( dani.nickname, dani.knowledge_level, dani.energy_level, dani.joy_level)) print("He has more attributes, but it's not necessary for now.") skip = input()