11import operator
2+ from functools import partial
23from paths_cli .wizard .parameters import ProxyParameter
34from paths_cli .wizard .plugin_classes import (
45 LoadFromOPS , WizardParameterObjectPlugin , WizardObjectPlugin ,
78from paths_cli .wizard .helper import EvalHelperFunc , Helper
89from paths_cli .wizard .core import interpret_req
910import paths_cli .compiling .volumes
10- from functools import partial
11+
1112
1213def _binary_func_volume (wizard , context , op ):
1314 wizard .say ("Let's make the first constituent volume:" )
@@ -28,6 +29,7 @@ def _binary_func_volume(wizard, context, op):
2829_LAMBDA_STR = ("What is the {minmax} allowed value for "
2930 "'{{obj_dict[cv].name}}' in this volume?" )
3031
32+
3133CV_DEFINED_VOLUME_PLUGIN = WizardParameterObjectPlugin .from_proxies (
3234 name = "CV-defined volume (allowed values of CV)" ,
3335 category = "volume" ,
@@ -57,6 +59,7 @@ def _binary_func_volume(wizard, context, op):
5759 compiler_plugin = paths_cli .compiling .volumes .CV_VOLUME_PLUGIN ,
5860)
5961
62+
6063INTERSECTION_VOLUME_PLUGIN = WizardObjectPlugin (
6164 name = 'Intersection of two volumes (must be in both)' ,
6265 category = "volume" ,
@@ -69,6 +72,7 @@ def _binary_func_volume(wizard, context, op):
6972 "both of the volumes that define it." ),
7073)
7174
75+
7276UNION_VOLUME_PLUGIN = WizardObjectPlugin (
7377 name = 'Union of two volumes (must be in at least one)' ,
7478 category = "volume" ,
@@ -81,6 +85,7 @@ def _binary_func_volume(wizard, context, op):
8185 "that define this are also in this volume" ),
8286)
8387
88+
8489NEGATED_VOLUME_PLUGIN = WizardObjectPlugin (
8590 name = 'Complement of a volume (not in given volume)' ,
8691 category = 'volume' ,
@@ -93,13 +98,15 @@ def _binary_func_volume(wizard, context, op):
9398 "in the existing volume." ),
9499)
95100
101+
96102_FIRST_STATE = ("Now let's define state states for your system. "
97103 "You'll need to define {n_states_string} of them." )
98104_ADDITIONAL_STATES = "Okay, let's define another stable state."
99105_VOL_DESC = ("You can describe this as either a range of values for some "
100106 "CV, or as some combination of other such volumes "
101107 "(i.e., intersection or union)." )
102108
109+
103110def volume_intro (wizard , context ):
104111 as_state = context .get ('depth' , 0 ) == 0
105112 n_states = len (wizard .states )
@@ -114,18 +121,21 @@ def volume_intro(wizard, context):
114121 intro += [_VOL_DESC ]
115122 return intro
116123
124+
117125def volume_set_context (wizard , context , selected ):
118126 depth = context .get ('depth' , 0 ) + 1
119127 new_context = {
120128 'depth' : depth ,
121129 }
122130 return new_context
123131
132+
124133def volume_ask (wizard , context ):
125134 as_state = context .get ('depth' , 0 ) == 0
126135 obj = {True : 'state' , False : 'volume' }[as_state ]
127136 return f"What describes this { obj } ?"
128137
138+
129139VOLUME_FROM_FILE = LoadFromOPS ('volume' )
130140
131141VOLUMES_PLUGIN = WrapCategory (
0 commit comments