-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstatic.py
More file actions
84 lines (74 loc) · 2.92 KB
/
static.py
File metadata and controls
84 lines (74 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
class Static:
@staticmethod
def consultation_links():
return [
'https://www.tthk.ee/oppetoo/opetajate-konsultatsioonid/uldainete-konsultatsioonid/',
'https://www.tthk.ee/oppetoo/opetajate-konsultatsioonid/transporditehnika-valdkonna-konsultatsioonid/',
'https://www.tthk.ee/oppetoo/opetajate-konsultatsioonid/mehaanika-ja-metallitootluse-valdkonna'
'-konsultatsioonid/',
'https://www.tthk.ee/oppetoo/opetajate-konsultatsioonid/mehhatroonka-osakonna-konsultatsiooid/',
'https://www.tthk.ee/infotehnoloogia-valdkonna-konsultatsioonid/',
'https://www.tthk.ee/logistika-valdkonna-konsultatsioonid/',
'https://www.tthk.ee/oppetoo/opetajate-konsultatsioonid/tekstiili-ja-kaubanduse-valdkonna-konsultatsioonid/'
]
@staticmethod
def changes_link():
return 'http://www.tthk.ee/tunniplaani-muudatused/'
@staticmethod
def groups_link():
return 'https://www.tthk.ee/oppetoo/tunniplaan/ruhmajuhatajad/'
@staticmethod
def weekdays():
return ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']
@staticmethod
def department_titles():
return ['general', 'transport', 'mechanics', 'energy', 'infotechnology', 'logistics', 'textile']
@staticmethod
def department_titles_groups_page():
return ['transport', 'mechanics', 'energy', 'beauty', 'textile', 'logistics', 'infotechnology']
@staticmethod
def consultation_template(cells, department):
try:
return {
'teacher': cells[0].text.strip(),
'room': cells[1].text.strip(),
'email': None,
'department': department,
'times': []
}
except IndexError:
return None
@staticmethod
def change_template(cells):
try:
return {
"dayofweek": cells[0].text.strip(),
"date": cells[1].text.strip(),
"group": cells[2].text.strip(),
"lessons": cells[3].text.strip(),
"teacher": cells[4].text.strip(),
"room": cells[5].text.strip()
}
except IndexError:
return None
@staticmethod
def study_language(text):
languages = {
"E": "estonian",
"V": "russian",
"E/V": "estonian/russian"
}
return languages[text]
@staticmethod
def group_template(cells, department):
departments = Static.department_titles_groups_page()
try:
return {
"group": cells[0].text.strip(),
"department": departments[department],
"language": Static.study_language(cells[1].text.strip()),
"teacher": cells[2].text.strip(),
"contact": cells[3].text.strip()
}
except IndexError:
return None