-
Notifications
You must be signed in to change notification settings - Fork 0
/
task.py
31 lines (27 loc) · 834 Bytes
/
task.py
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
"""
This file describes the structure of a Task object, ie how it has a from and till field,
a description, a priority, and things like this.
"""
class Task:
def __init__(self):
self.description = ""
self.duration = None
self.priority = None
def description(self):
return self.description
def setDescription(self, text):
# TODO: checkTextConforms()
self.description = text
def duration(self):
print('Not yet implemented')
def __str__(self):
return f'8:00-10:00 {self.description}, {self.priority or "high"}'
@classmethod
def processTask(cls, text):
"""
text is a string like "study" or "play fifa" or "do homework for tomorrow"
"""
# In the most basic case, the whole string `s` is the description
task = cls()
task.setDescription(text)
return task