Exemplo n.º 1
0
    def add_professor(self, prof_details):
        """
        Adds new professor entry to memory, then writes to database.

        Args:
            prof_details (dict)     : dictionary with valid professor params
        Returns:
            bool        : indicates success

        """
        new_professor = ""
        try:
            new_professor = Professor(prof_details)
        except:
            print "[DatabaseConnector::add_professor] Invalid parameters"
            return False

        self.database[new_professor.email] = new_professor.get_json()

        try:
            self.write_to_database()
            print "[DatabaseConnector::add_professor] Added professor"
            return True
        except:
            print "[DatabaseConnector::add_professor] Failed to add professor"
            return False
Exemplo n.º 2
0
def scrape_professor(school_name,
                     faculty_url,
                     extracts_title,
                     extracts_name,
                     extracts_cv_url = None,
                     extracts_personal_url = None,
                     extracts_gscholar_url = None,
                     extracts_papers = None):
    """ :return: a Professor object or None if it's not a tenure track faculty """
    tree = get_tree(faculty_url)
    if tree is None:
        return None
    job_title = strip_whitespace(extracts_title(tree))
    if job_title is None:
        print("WARNING: job title not found on "+faculty_url)
        return None
    if not title_is_tenure_track(job_title):
        return None
    name = extracts_name(tree)
    cv_link = None if extracts_cv_url is None else extracts_cv_url(faculty_url, tree)
    personal_url = None if extracts_personal_url is None else extracts_personal_url(faculty_url, tree)
    google_scholar_url = None if extracts_gscholar_url is None else extracts_gscholar_url(faculty_url, tree)
    prof = Professor(name=name, title=job_title, cv_url=cv_link, school=school_name,
                     faculty_directory_url=faculty_url, personal_url=personal_url, google_scholar_url=google_scholar_url)
    if extracts_papers is not None:
        paper_list_url, papers = extracts_papers(faculty_url, tree)
        # save paper list to disk
        if paper_list_url and papers and len(papers) > 0:
            prof.paper_list_url = paper_list_url
            save_paper_list('paper_list', prof, papers)
    return prof
Exemplo n.º 3
0
    def get_course_class_list(self):        
        from algorithm.models import School, Department, Class, Prerequisite, Building, Room, Period, Lecturer, ClassInstance, ClassLab, Person, Role, PersonRole 
        from course_class import CourseClass
    # This section takes values from the database and stores them in course clas list 
        print "This will print out all of the course classes currently in the database"
        self.classes_list = []

        all_course_class = ClassInstance.objects.all()
        for ClassInstance in all_course_class:       

            lecturer = ClassInstance.idLecturer
            new_prof = Professor()
            new_prof.name = lecturer.Name
            new_prof.id = lecturer.idLecturer

            Class = ClassInstance.idClass
            new_course = Course()
            new_course.id = Class.idClass
            new_course.name = Class.Class
            
            
            


            new_course_class = CourseClass()
            new_course_class.professor = new_prof
            new_course_class.course = new_course
            new_course_class.duration = 1
            new_course_class.lab = False
            new_course_class.id = ClassInstance.idClassInstance
            self.classes_list.append(new_course_class)
            self.num_classes += 1

        for course_class in self.classes_list:
            print "(Professer: %s Course: %s Durration: %d Lab: %d)" % (course_class.professor, course_class.course, course_class.duration, course_class.lab)
Exemplo n.º 4
0
def test_confirmacao_matricula():
    aluno = Aluno('Lucas', 1701419)
    turma = Turma('Tecnologia Web')

    matricula = Matricula(aluno, turma)

    professor = Professor('Professor', 1)

    assert professor.confirmar_matricula(matricula) == False
Exemplo n.º 5
0
    def excluirProfessor(self):
        prof = Professor()

        prof.idprofessor = self.txtidprofessor.get()

        self.lblmsg["text"] = prof.deleteProfessor()

        self.txtidprofessor.delete(0, END)
        self.txtnome.delete(0, END)
        self.txtcpf.delete(0, END)
        self.txtdepartamento.delete(0, END)
Exemplo n.º 6
0
    def explore(self,
                student_summary=[],
                professors_list=[],
                search_papers=10,
                return_papers=3):
        if professors_list == []:
            professors_list = self.preProcessor.read_authors_from_file()
        if student_summary == []:
            # TODO: return an error message
            student_summary = ["student work is empty !"]

        oas = OverAllSimilarity(student_summary=student_summary)
        resmerg = ResultMerger()
        for author in tqdm(professors_list):
            # retrieving an author articles from arxiv. config in arxivsearch
            resp = self.ArxivSearch.fetch_articles_by_author(
                author, max_results=search_papers)
            # TODO: check response status
            # new professor
            prof = Professor(author)
            # pars arxiv response for each professor
            prof.pars_arxiv_response(resp['entries'])
            # export professors only summary per article
            professor_articles_summaries = prof.export_articles_summaries_list(
            )
            # calculate over all similarity along with a list of each article similarity
            professor_similarities = oas.calculate_overall_similarity(
                professor_articles_summaries)
            # adding list of similarities to each professors article list
            prof.parse_similarity_list(professor_similarities)
            # adding the completed professor object to result merger object
            resmerg.append_professor(prof)

        # printing resultMerger final results
        return resmerg.export_final_json(return_papers)
Exemplo n.º 7
0
    def buscarProfessor(self):
        prof = Professor()

        idprofessor = self.txtidprofessor.get()

        self.lblmsg["text"] = prof.selectProfessor(idprofessor)

        self.txtidprofessor.delete(0, END)
        self.txtidprofessor.insert(INSERT, prof.idprofessor)

        self.txtnome.delete(0, END)
        self.txtnome.insert(INSERT, prof.nome)

        self.txtcpf.delete(0, END)
        self.txtcpf.insert(INSERT, prof.cpf)

        self.txtdepartamento.delete(0, END)
        self.txtdepartamento.insert(INSERT, prof.departamento)
Exemplo n.º 8
0
def main():

    student1 = Student('Anty', 20)
    student1.accept_task(1)
    student1.accept_task(2)
    student1.accept_task(3)
    student2 = Student('Mary', 14)

    student1.age += 1
    student2.name = 'Alice'
    student2.accept_test(12)
    student1.accept_test(7)
    student1.print_info()
    student2.print_info()

    pprint(student1.__dict__)

    professor1 = Professor('Dr.Who', 30)
    professor1.print_info()
Exemplo n.º 9
0
 def read_profs(self):
     """:return: a list of Professor objects"""
     profs = []
     saw_header = False
     for row in self.rows:
         if not saw_header:
             saw_header = True
             continue
         profs.append(Professor.from_spreadsheet_row(row))
     return profs
Exemplo n.º 10
0
def profResults():


    prof = Professor('', '', '', '', '', '', '', '')

    profid = request.args.get('profid')

    database = Database()
    database.connect()
    prof = database.profSearch(profid)
    database.disconnect()

    titles = prof.getTitles()
    links = prof.getLinks()
    pic = prof.getPicLink()

    html = render_template('profpage.html', profid = profid, prof = prof, pic = pic, titles = titles, links = links)
    response = make_response(html)
    return(response)
Exemplo n.º 11
0
    def get_prof_list(self):
        from algorithm.models import School, Department, Class, Prerequisite, Building, Room, Period, Lecturer, ClassInstance, ClassLab, Person, Role, PersonRole 
        from professor import Professor
        
        print "This will print out all of the professors currently in the database"
        self.prof_list = []
    
        all_lecturers = Lecturer.objects.all()
        
        for Lecturer in all_lecturers:
            print "Lecturer name = %s, Lecturer ID = %d" % (Lecturer.Name, Lecturer.idLecturer)
            new_prof = Professor()
            new_prof.name = Lecturer.Name
            new_prof.id = Lecturer.idLecturer
#            new_prof.course_list = course_list
            self.prof_list.append(new_prof)
            self.num_professors += 1

        for Professor in self.prof_list:
            Professor.print_professor()
Exemplo n.º 12
0
 def create_all_profs(self, classes):
     for c in classes:
         professor = c['professor']
         professor_id = professor['id']
         matched = False
         for p in self.professors:
             if professor_id == p.get_id():
                 matched = True
         if matched == False:
             self.professors.append(
                 Professor(professor['first_name'], professor['last_name'],
                           professor['id']))
Exemplo n.º 13
0
 def find_google_scholar_page(self, prof: Professor):
     # get search results page
     self.get_page(
         'https://scholar.google.com/scholar?q=author%%3A"%s"+%s' %
         (urllib.parse.quote(prof.simple_name()), prof.school))
     # look for a matching user profile
     try:
         anchor = self.selenium_driver.find_element_by_css_selector(
             'h4.gs_rt2 a')
         return anchor.get_attribute('href')
     except NoSuchElementException:
         return None
Exemplo n.º 14
0
    def profSearch(self, profid):

        cursor = self._connection.cursor()
        stmtStr = 'SELECT profs.name, profs.email, profs.bio, profs.pic_links FROM profs WHERE profs.prof_id = %s'
        cursor.execute(stmtStr, (profid, ))
        rows = cursor.fetchall()
        for row in rows:
            name = row[0]
            contact = row[1]
            bio = row[2]
            picLink = row[3]

        areas = []
        projects = []
        titles = []
        links = []

        stmtStr = 'SELECT areas.area FROM areas WHERE areas.prof_id = %s'
        cursor.execute(stmtStr, (profid, ))
        areas = cursor.fetchall()
        if len(areas) == 0:
            areas = 'No research areas found.'

        stmtStr = 'SELECT projects.title FROM projects WHERE projects.prof_id = %s'
        cursor.execute(stmtStr, (profid, ))
        projects = cursor.fetchall()
        if len(projects) == 0:
            projects = 'No projects found.'

        stmtStr = 'SELECT past_theses.title, past_theses.link FROM past_theses WHERE past_theses.prof_id = %s'
        cursor.execute(stmtStr, (profid, ))
        rows = cursor.fetchall()

        for row in rows:
            titles.append(row[0])
            links.append(row[1])

        if contact == 'NaN':
            contact = 'No contact provided.'

        if bio == 'NaN':
            bio = 'No bio provided.'

        if len(titles) == 0:
            titles = 'This advisor has no previous works advised.'
            links = ''

        cursor.close()

        professor = Professor(name, bio, areas, projects, titles, links,
                              contact, picLink)
        return professor
Exemplo n.º 15
0
def main():
    student1 = Student('Ivan', 18)
    print(type(student1), id(student1))

    student2 = Student('Mariya', 18)
    print(type(student2), id(student2))

    #student1.name = 'Ivan Ivanov'
    #student1.age = 18
    print(student1.name, student1.age)
    student1.age += 1
    print(student1.name, student1.age)

    print(student2.name, student2.age)
    student2.name = 'Alice'
    print(student2.name, student2.age)

    student1.accept_task(1)
    student1.accept_task(3)
    student1.accept_task(5)
    student1.print_info()
    student2.accept_test(12)
    student2.print_info()

    # print(type(Student))
    #
    # pp(student1.__dict__)
    # student1.__dict__['name'] = 'IVAN'
    # print(student1.name)
    #
    # pp(Student.__dict__)

    prof1 = Professor('Dr. Who', 42)
    prof1.salary = 1000
    prof1.print_info()
    print(prof1)
    print(prof1.salary)
Exemplo n.º 16
0
 def read_profs(self):
     """:return: a list of Professor objects"""
     values = self.get_range('Professors')
     print("read %d rows" % len(values))
     profs = []
     if not values:
         print('No data found.')
     else:
         saw_header = False
         for row in values:
             if not saw_header:
                 saw_header = True
                 continue
             profs.append(Professor.from_spreadsheet_row(row))
     return profs
Exemplo n.º 17
0
    def inserirProfessor(self):
        prof = Professor()

        prof.nome = self.txtnome.get()
        prof.cpf = self.txtcpf.get()
        prof.departamento = self.txtdepartamento.get()

        self.lblmsg["text"] = prof.insertProfessor()

        self.txtidprofessor.delete(0, END)
        self.txtnome.delete(0, END)
        self.txtcpf.delete(0, END)
        self.txtdepartamento.delete(0, END)
Exemplo n.º 18
0
    def alterarProfessor(self):
        prof = Professor()

        prof.idprofessor = self.txtidprofessor.get()
        prof.nome = self.txtnome.get()
        prof.cpf = self.txtcpf.get()
        prof.departamento = self.txtdepartamento.get()

        self.lblmsg["text"] = prof.updateProfessor

        self.txtidprofessor.delete(0, END)
        self.txtnome.delete(0, END)
        self.txtcpf.delete(0, END)
        self.txtdepartamento.delete(0, END)
Exemplo n.º 19
0
from student import Student
from professor import Professor
from photosession import takephoto

s1 = Student(name='mehul', gender='m', roll=10, marks=90)
# Student.__init__(4003, name='mehul', gender='m', roll=10, marks=90)

p1 = Professor(name='fatih',
               gender='m',
               subjects=['Physics', 'Maths'],
               contactnos=['9879897', '9878686878'])
# Professor.__init__(4005, name='fatih', gender='m', subjects=['Physics','Maths'])

# print(s1.name)
# print(p1.name)

# print(s1.getdetails())
# Student.getdetails(s1)

# print(p1.getdetails())
# Professor.getdetails(p1)

name = 'mehul'
print(name)
# print(name.__str__())

print(p1)
print(s1)
# print(p1.__str__())

takephoto(s1)
Exemplo n.º 20
0
from professor import Professor
name=input("\nEnter the name of professor : ")
gender=input("Gender : ")
subject=input("Subject : ")
print("---------Details---------")
p=Professor(name,gender,subject)	#p is object
p.displayDetails()

from professor import Professor
from disciplina import Disciplina
from aluno import Aluno

p1 = Professor(nome='pablo', email='pablo', ra=12, celular=9999)
d1 = Disciplina(nome='lp2', cargaHoraria=80, mensalidade=100, professor=p1)

a = Aluno(nome='pablo',
          email='pablo',
          ra='123',
          celular='0999999',
          desconto=50)

a.adicionaDisciplina(d1)
a.diminuirDesconto(25)
print(a.retornaValorMensalidade())
print(a.retornaCargaHoraria())
Exemplo n.º 22
0
#Initializes Variables to be used
num = 0
num2 = 0
name = 's'
name2 = 's'
c_id = 0
c_name = 's'


# Test for constructors

# Test constructor with valid information
# Input: ID = 24 Name = Werner
# Expected output: (24, Werner)
p1 = Professor(24, 'Werner')
p1.print_professor()
# Test constructor, and add variables later
p2 = Professor()

# Add variables using manipulation procedure
p2.add_id(42)
p2.add_name('name')

# Test access functions using variables initialized above
num = p1.get_id()
name = p1.get_name()
num2 = p2.get_id()
name2 = p2.get_name()

# Print statment to insure that the variables 
Exemplo n.º 23
0
                except NoSuchElementException:
                    # this is probably a working paper
                    continue
                match = re.findall(
                    r"\"(.*)\"", citation)  # article titles are inside quotes
                if len(match) == 0:
                    # this is a book, which we don't record
                    continue
                title = match[0]
                papers.append(
                    Paper(title=title,
                          authors=authors,
                          venue=venue,
                          year=year,
                          scholar_citations=r['scholar_citations'],
                          wos_citations=r['wos_citations'],
                          id=r['citation_id']))
        return papers


if __name__ == '__main__':
    # for some reason, running this in the IDE requires me to set the geckodriver path
    with GoogleScholar('/usr/local/bin/geckodriver') as scholar:
        print(
            scholar.scrape_profile(
                'https://scholar.google.com/citations?user=a1ngrCIAAAAJ&hl=en')
        )
        print(
            scholar.scrape_search_results(
                Professor(school='Northwestern', name='Nabil Al-Najjar')))
Exemplo n.º 24
0
student3 = Student('Kaung3',
                   'Oo',
                   '5_10_1993',
                   '1234',
                   address1,
                   international=True)

student4 = Student('Kaung4',
                   'Oo',
                   '5_10_1993',
                   '1234',
                   address1,
                   international=True)

prof1_addr = Address('US', 'FL', 'Orlando', '99 Lake Street', '043432')
prof1 = Professor('Kong', 'King', '5_10_1887', '4321', prof1_addr, 80e3)

course1 = Course('Intro ECE', 'ECE101', 6, 2, prof1)
prof1.add_course(course1)

enroll_course(student1, course1)

enroll_course(student2, course1)

enroll_course(student3, course1)

enroll_course(student4, course1)

enroll_course(student4, course1)

enroll_course(student4, course1)
Exemplo n.º 25
0
from professor import Professor
from student import Student
from contact import Contact
from person import Person

# p = Person(name='mehul', gender='m') # cannot do that!

p1 = Professor(name='mehul chopra', gender='m', subjects=['Maths', 'Programming'],\
    contact=Contact(email='*****@*****.**', mobile='0987907907'))
'''
    1) RAM 90345
    2) Professor.__init__(90345, name, gender, subjects)
'''

s1 = Student(name='jane', gender='f', roll=10, marks=90)

s1.giveAttendance()
p1.giveAttendance()
'''print(p1.getEmail())
print(p1.getMobile())

print(s1.getEmail())'''

# print(s1.getPrettyDetails())
# print(p1.getPrettyDetails())
# print(p1.name)
'''Professor and Student objects belong to a common category of people in the college.
   They share common properties (name, gender)
'''
Exemplo n.º 26
0
    student1.print_info()
    student2.print_info()
    student3.print_info()

    # pprint.pprint(Student.__dict__)
    # pprint.pprint(student1.__dict__)
    student1.__dict__['name'] = 'William'
    print(student1.__dict__['name'])
    print(student1.name)

    print(
        '===================================================================================='
    )
    print('NEW')
    print(
        '===================================================================================='
    )
    pr1 = Professor('Donald Knuth', 42)
    pr1.print_info()
    pr1.salary = 1000
    pr1.print_info()

    print(pr1.groups)
    #
    # print(pr1.get_group())
    pr1._groups = ["Math", "CS", "ML", "AI"]
    # print(pr1.get_group())
    print(pr1.group)
    print(student1.__str__())
    student_str = str(student1)
    print(student_str)
Exemplo n.º 27
0
from professor import Professor

p = Professor("abc", "m", ["python", "hadoop"])
p.display_details()

p1 = Professor("def", "m", [])
p1.display_details()
Exemplo n.º 28
0
    def scrape_search_results(self, prof: Professor) -> List[Paper]:
        """In this case, we are saving all articles, even if we are not sure that they match the author.
        We only search in the past ten years (2007 and later) and only include the first 100 pages of results,
        and only papers that have at least one citation in Google Scholar (to save us some time)."""
        # parse each page of results, up to at most 1000 articles (100 pages)
        papers = []
        # for each page of results
        for start in range(0, 1000, 10):
            result_row_info = []
            # get search results page
            self.get_page(
                'https://scholar.google.com/scholar?start=%d&as_ylo=%s&q=author%%3A"%s"+%s'
                % (start, STARTING_YEAR, urllib.parse.quote(
                    prof.simple_name()), prof.school))

            # We get the GS and WoS citation counts from the search results page
            # We get the full citation information by virtually clicking the "cite" link for each article
            tree = tree_from_string(self.selenium_driver.page_source)
            for row in css_select(tree, 'div.gs_r div.gs_ri'):
                scholar_citations = None
                wos_citations = None
                citation_id = None
                for link in css_select(row, 'div.gs_fl a'):
                    if 'Cited by' in link.text:
                        scholar_citations = link.text.split(' ')[-1]
                    elif 'Web of Science:' in link.text:
                        wos_citations = link.text.split(': ')[-1]
                    elif 'Related articles' in link.text:
                        citation_id = link.get('href').split(":")[1]
                # ignore papers with no citations
                if not scholar_citations:
                    break
                result_row_info.append({
                    'scholar_citations': scholar_citations,
                    'wos_citations': wos_citations,
                    'citation_id': citation_id
                })
            # stop when we've gone past the end of results
            if len(result_row_info) == 0:
                break

            # fetch each citation and pick out the Chicago format because it has full firstnames
            # and includes all the author names (or at least more of them before using "et al."
            # eg., https://scholar.google.com/scholar?q=info:J2Uvx00ui50J:scholar.google.com/&output=cite&scirp=1&hl=en
            for r in result_row_info:
                self.get_page(
                    'https://scholar.google.com/scholar?q=info:%s:scholar.google.com/'
                    '&output=cite&scirp=1&hl=en' % r['citation_id'])
                # the third row in the table contains the Chicago-style citation
                citation = self.selenium_driver.find_elements_by_css_selector(
                    'td')[2].text
                year = get_year(citation)
                if not year:
                    continue
                # look for the first period that is not part of a middle initial
                match = re.search(r"\w{2}\. ", citation)
                if not match:
                    # otherwise, just take the first period as in:
                    # Al-Najjar, Nabil I. "A bayesian framework for precautionary policies." (2013).
                    match = re.search(r"\. ", citation)
                authors = citation[:match.end()]
                # venue is in italics
                try:
                    venue = self.selenium_driver.find_elements_by_css_selector('td')[2]\
                                                .find_element_by_css_selector('i').text
                except NoSuchElementException:
                    # this is probably a working paper
                    continue
                match = re.findall(
                    r"\"(.*)\"", citation)  # article titles are inside quotes
                if len(match) == 0:
                    # this is a book, which we don't record
                    continue
                title = match[0]
                papers.append(
                    Paper(title=title,
                          authors=authors,
                          venue=venue,
                          year=year,
                          scholar_citations=r['scholar_citations'],
                          wos_citations=r['wos_citations'],
                          id=r['citation_id']))
        return papers
Exemplo n.º 29
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from person import Person
from student import Student
from professor import Professor

pe = Person("person1")
st = Student("student1", 15)
pr = Professor("professor1")

pe.info()
st.info()
pr.info()
Exemplo n.º 30
0
#Initializes Variables to be used
num = 0
num2 = 0
name = 's'
name2 = 's'
c_id = 0
c_name = 's'


# Test for constructors

# Test constructor with valid information
# Input: ID = 24 Name = Werner
# Expected output: (24, Werner)
p1 = Professor(24, 'Werner')
p1.print_professor()
# Test constructor with low number bound
# Input: ID = 0, Name = Werner
# Expected output: (0, Werner)
p1 = Professor(0, 'Werner')
p1.print_professor()
# Test constructor with No name input
# Input: ID = 24, Name = 
# Expected output: (24, )
p1 = Professor(24, '')
p1.print_professor()
# Test constructor with high number bound
# Input: ID = 24000000000000000000, Name = Werner
# Expected output: (24000000000000000000, Werner)
p1 = Professor(24000000000000000000, 'Werner')
Exemplo n.º 31
0
    def load_from_file(self, course_file_path, course_name, begin_date, end_date):

        print "\nStarting to load \'" + course_file_path + "\' file.\n"
        
        students_file_path = course_file_path + "students.in"
        professors_file_path = course_file_path + "professors.in"
        tutors_file_path = course_file_path + "tutors.in"
        
        ignore_file_path = course_file_path + "ignore"
        ignored_names = self._get_ignored_names(ignore_file_path)

        data_student = open(students_file_path)
        data_professor = open(professors_file_path)
        data_tutors = open(tutors_file_path)

        data_size = os.path.getsize(students_file_path) + os.path.getsize(professors_file_path) \
                                                        + os.path.getsize(tutors_file_path)

        # Put the carret at the right place
        data_processed = len(data_professor.readline()) + len(data_professor.readline())
        data_processed = data_processed + len(data_student.readline()) + len(data_student.readline())
        data_processed = data_processed + len(data_tutors.readline()) + len(data_tutors.readline())

        course = Course(course_name)
        count_interaction = 0
        
        #Professors loader
        for line in data_professor:
            data_processed = data_processed + len(line)
            self.progress_load(data_size, data_processed)

            new_line = remove_white_space(line)
            split_line = string.split(new_line, "|")

            #split_line must have 3 position
            if len(split_line) != 3:
                continue

            complete_name = split_line[0]+" "+split_line[1]
            first_name = split_line[0]
            last_name = split_line[1]
            timestamp = split_line[2]

            if complete_name in ignored_names:
                continue
            
            if not begin_date < int(timestamp) < end_date:
                continue
            
            if complete_name in course.professors:
                professor = course.professors.get(complete_name)
                conf_interaction = professor.set_interation(timestamp)
            else:
                professor = Professor(first_name, last_name)
                conf_interaction = professor.set_interation(timestamp)
                course.professors[complete_name] = professor

        data_professor.close()
        
        #Tutors loader
        for line in data_tutors:

            data_processed = data_processed + len(line)
            self.progress_load(data_size, data_processed)

            new_line = remove_white_space(line)
            split_line = string.split(new_line, "|")

            #split_line must have 3 position
            if len(split_line) != 3:
                continue

            complete_name = split_line[0]+" "+split_line[1]
            first_name = split_line[0]
            last_name = split_line[1]
            timestamp = split_line[2]

            if complete_name in ignored_names:
                continue
            
            if not begin_date < int(timestamp) < end_date:
                continue

            if self.is_professor(complete_name, course):
                continue

            if complete_name in course.tutors:
                tutor = course.tutors.get(complete_name)
                tutor.set_interation(timestamp)
            else:
                tutor = Tutor(first_name, last_name)
                tutor.set_interation(timestamp)
                course.tutors[complete_name] = tutor

        data_tutors.close()
            
        #Students loader
        for line in data_student:

            data_processed = data_processed + len(line)
            self.progress_load(data_size, data_processed)

            new_line = remove_white_space(line)
            split_line = string.split(new_line, "|")

            #split_line must have 3 position
            if len(split_line) != 3:
                continue

            complete_name = split_line[0]+" "+split_line[1]
            first_name = split_line[0]
            last_name = split_line[1]
            timestamp = split_line[2]

            if complete_name in ignored_names:
                continue
            
            if not begin_date < int(timestamp) < end_date:
                continue

            if self.is_professor(complete_name, course):
                continue
            
            if self.is_tutor(complete_name, course):
                continue

            confirm_interaction = None
            if complete_name in course.students:
                student = course.students.get(complete_name)
                confirm_interaction = student.set_interation(timestamp)
            else:
                student = Student(first_name, last_name)
                confirm_interaction = student.set_interation(timestamp)
                course.students[complete_name] = student

            #Exclude the invalid dates
            if confirm_interaction is not None:
                course.add_to_week_average(timestamp, 1)
                count_interaction += 1

        data_student.close()
        
        for student in course.students.itervalues():
            student.set_average_by_week()

        print "\n"
        self.print_data_stats(count_interaction, course)

        return course
Exemplo n.º 32
0
from student import Student
from professor import Professor

s1 = Student('Hung', 13)
s1.setId(1234)
s1.joinASubject('Math')

s2 = Student('Mai', 27)
s2.setId(456)
s1.joinASubject('English')

p1 = Professor('Luong', 28)
p1.setDomain('Math')

s1.sayHello()
print('s1 id: ' + str(s1.getId()))
print('s1 subjects: ' + str(s1.getSubject()))

s2.sayHello()
print('s2 id: ' + str(s2.getId()))
print('s2 subjects: ' + str(s2.getSubject()))

p1.sayHello()
print('p1 domain: ' + p1.getDomain())
Exemplo n.º 33
0
    elif op == 2:
        if ip < 2:
            clear()
            name = input("Digite o nome da pessoa: ")
            phone = input("Digite o telefone: ")
            email = input("Digite o email: ")
            course = int(input("Digite o curso: "))
            salary = int(input("Digite o numero de salario: "))
            print("Digite o dia de ingresso: ")
            ano = int(input("digite o ano"))
            mes = int(input("digite o mes"))
            dia = int(input("digite o dia"))
            sd = [ano, mes, dia]
            c = [name, email, phone, email, course, sd]
            professor.append(c)
            p = Professor(name, phone, email, course, salary, sd)
            delta = p.work_days(sd, s)
            s.append(delta)
            salar = p.additional_health_hazard(salary, course)
            pa.append(salar)
            ip = ip + 1
        else:
            print("Professores maximos cadastrados")

    elif op == 3:
        clear()
        opc = int(
            input(
                "Digite qual opção que deseja ver :\n1- Para estudantes\n2-Para professores\nEscolhe logo porra: "
            ))
        if opc == 1:
Exemplo n.º 34
0
def adicionar_professor(prof, id_usuario_online):
    limpar_tela()
    Professor.adicionar_professor()
    banco_de_questoes(prof, id_usuario_online)
Exemplo n.º 35
0
from professor import Professor
from course_uni import Course
from student import Student

professor1 = Professor(1, 'John')
professor2 = Professor(2, 'Robert')
professor3 = Professor(3, 'Angela')
professor4 = Professor(4, 'Jimmy')
professor5 = Professor(5, 'Ravi')
professor6 = Professor(6, 'Joe')

English = Course(1, 'English')
Artificial_Intelligence = Course(2, 'Artificial Intelligence')
Machine_Learning = Course(3, 'Machine Learning')
Ethical_Hacking = Course(4, 'Ethical Hacking')
Javascript = Course(5, 'Javascript')
Physics = Course(6, 'Physics')
Calculus = Course(7, 'Calculus')

student_1 = Student(100, 'Cynthia', 'Brook')
student_2 = Student(101, 'Keith', 'Brewer')
student_3 = Student(102, 'Mehmet', 'Faulkner')
student_4 = Student(103, 'Anabel', 'Molloy')
student_5 = Student(104, 'Macy', 'Clark')
student_6 = Student(105, 'Aisha', 'Berger')
student_7 = Student(106, 'Niall', 'Farrington')
student_8 = Student(107, 'Beulah', 'Esparza')
student_9 = Student(108, 'Dorsey', 'Montgomery')
student_10 = Student(109, 'Felicia', 'Ward')
Exemplo n.º 36
0
from address import Address
from course import Course
from enroll import Enroll
from professor import Professor
from student import Student

address = Address('Korea', "KB", "Daegu", "Bukgu", "754023  ")
std = Student('P', 'SC', 1974, '010-123', address)
professor = Professor('SC', 'Park', 1974, '010-223', address, 8000)

course = Course('Python', 'p12', 200, 30, professor)
enroll = Enroll(std, course)
Exemplo n.º 37
0
 def adicionar_professor(self,nome,telefone, email):
     p = Professor(nome,telefone,email)
     self.lista_professores.append(p)