-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample1.py
39 lines (31 loc) · 1.28 KB
/
example1.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
32
33
34
35
36
37
38
39
from collections import OrderedDict
from genie_python.genie_script_generator import ScriptDefinition, cast_parameters_to
class DoRun(ScriptDefinition):
global_params_definition = OrderedDict(
{
"example param:": ("0", int),
"example param 2:": ("2", float),
"example param 3:": ("any string", str),
}
)
def run(self, the="1", imat="2", fields="2", there="2", are="2", more="2"):
print(the)
print(imat)
print(fields)
print(there)
print(are)
print(more)
def parameters_valid(self, the="1", imat="2", fields="2", there="2", are="1", more="2"):
if are != "1":
return "are is not 1"
else:
return None
def estimate_time(self, the="1", imat="2", fields="2", there="2", are="1", more="2"):
return float(the) * float(imat) * float(self.global_params["example param 2:"])
def get_help(self):
return None
@cast_parameters_to(the=float, imat=float, fields=float, there=float, are=float, more=float)
def estimate_custom(self, the="1", imat="2", fields="2", there="2", are="1", more="2"):
custom1 = the * 2
custom2 = imat + 5
return OrderedDict([("custom1", str(custom1)), ("custom2", str(custom2))])