- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery_struct.py
More file actions
Latest commit
45 lines (39 loc) · 1.2 KB
/
Copy pathquery_struct.py
File metadata and controls
45 lines (39 loc) · 1.2 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
fromenumimportEnum
fromunittestimportresult
classQuery_type(Enum):
COMPUTE_FIBO=0
LIST=1,
LIST_END=2
def__str__(self):
ifself==Query_type.COMPUTE_FIBO:
return"fibo"
ifself==Query_type.LIST:
return"list"
ifself==Query_type.LIST_END:
return"list end"
return"error_type"
classQuery_Status(Enum):
TO_BE_SENT=0
SCHEDULED=1
DONE=2
def__str__(self):
ifself==Query_Status.TO_BE_SENT:
return"to be sent"
ifself==Query_Status.SCHEDULED:
return"scheduled"
ifself==Query_Status.DONE:
return"done"
return"error_status"
classQuery:
def__init__(self, type : Query_type, value=None ) ->None:
self.type=type
self.value=value
self.status=Query_Status.TO_BE_SENT
self.result=None
def__str__(self):
res='[{0}] {1}'.format(self.status, self.type)
ifself.value!=None:
res+=" "+str(self.value)
ifself.result!=None:
res+=' (result {0})'.format(self.result)
returnres