1212class ObjectMixin :
1313 """A mixin class for Ramble objects"""
1414
15- def _get_app_or_mod_inst (self ):
16- # This helper gets the mod_inst for modifier, and the app_inst for others
15+ def _get_app_inst (self ):
16+ # This helper gets the app_inst for different object types
1717 if hasattr (self , "app_inst" ):
1818 return self .app_inst
1919 return self
2020
21+ def satisfy_when (self , when_key ):
22+ app_inst = self ._get_app_inst ()
23+ return app_inst .expander .satisfies (when_key , app_inst .object_variants )
24+
2125 def get_required_variables (self ):
2226 """Get all the required variables based on the mode and when conditions."""
23- inst = self ._get_app_or_mod_inst ()
2427 required_vars = self .required_vars
2528 filtered_vars = {}
2629 if required_vars :
2730 for var_name , var_props in required_vars .items ():
28- if inst .expander .satisfies (
29- var_props ["when" ], inst .object_variants
30- ):
31+ if self .satisfy_when (var_props ["when" ]):
3132 filtered_vars [var_name ] = {
3233 # Exclude the extra when prop
3334 k : var_props [k ]
@@ -44,9 +45,8 @@ def selected_variables(self):
4445 """
4546
4647 selected_vars = {}
47- inst = self ._get_app_or_mod_inst ()
4848 for when_key , var_list in self .object_variables .items ():
49- if not inst . expander . satisfies (when_key , inst . object_variants ):
49+ if not self . satisfy_when (when_key ):
5050 continue
5151
5252 for var in var_list :
@@ -63,12 +63,11 @@ def selected_environment_variables(self):
6363 """
6464
6565 selected_env_vars = {}
66- inst = self ._get_app_or_mod_inst ()
6766 for (
6867 when_key ,
6968 env_var_list ,
7069 ) in self .object_environment_variables .items ():
71- if not inst . expander . satisfies (when_key , inst . object_variants ):
70+ if not self . satisfy_when (when_key ):
7271 continue
7372
7473 for env_var in env_var_list :
@@ -77,4 +76,10 @@ def selected_environment_variables(self):
7776 return selected_env_vars
7877
7978 def format_doc (self , ** kwargs ):
79+ """Doc formatting for Sphinx"""
8080 return format .format_doc (self .__doc__ , ** kwargs )
81+
82+ def add_inmem_fom_value (self , fom_map_key , value ):
83+ """Add an in-memory FOM value"""
84+ app_inst = self ._get_app_inst ()
85+ app_inst .add_inmem_fom_value (fom_map_key , value )
0 commit comments