-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassignment.py
More file actions
79 lines (65 loc) · 2.06 KB
/
Copy pathassignment.py
File metadata and controls
79 lines (65 loc) · 2.06 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
import utilities
class assignment:
classname = "assignment"
submission_type = None
submission_location = None
count = 0
def __init__(self, name = None, start = None, end = None, grade = None):
self.name = name
self.start = start
self.end = end
self.grade = grade
self.duration = None
def getCount(self):
return assignment.count
def setCount(self,value):
assignment.count = value
def incrementCount(self):
assignment.count += 1
def getSubmission_type(self):
return assignment.submission_type
def setSubmission_type(self,value):
assignment.submission_type = value
def getSubmission_location(self):
return assignment.submission_location
def setSubmission_location(self,value):
assignment.submission_location = value
#####################################
def calculateDuration(self):
self.duration = str(int(self.end) - int(self.start))
def getName(self):
return self.name
# Look adjacent to green word for a number --> make that the name
def find_and_set_name(self,statement):
for index,word in enumerate(statement):
if word == self.classname:
if index - 1 >= 0 and utilities.RepresentsInt(statement[index-1]):
self.name = statement[index-1]
elif index + 1 < len(statement) and utilities.RepresentsInt(statement[index+1]):
self.name = statement[index+1]
# Take whatever number is left in the statement
def find_and_set(self,topic,statement,nouns):
if topic == "start":
for word in statement:
if utilities.RepresentsInt(word):
self.start = word
elif topic == "end":
for word in statement:
if utilities.RepresentsInt(word):
self.end = word
elif topic == "duration":
for word in statement:
if utilities.RepresentsInt(word):
self.duration = word
elif topic == "submission_type":
for word in statement:
if word in nouns:
assignment.submission_type = word
elif topic == "submission_location":
for word in statement:
if word in nouns:
assignment.submission_location = word
elif topic == "grade":
for word in statement:
if '%' in word:
self.grade = word