manage fill with multi variable
This commit is contained in:
parent
d895c46729
commit
9eb6a67ac6
1 changed files with 17 additions and 0 deletions
|
@ -32,6 +32,9 @@ from .target import TargetAnnotator
|
||||||
from .param import ParamAnnotator
|
from .param import ParamAnnotator
|
||||||
|
|
||||||
|
|
||||||
|
CALC_MULTI = ('calc_value', 'calc_list', 'get_range', 'calc_val_first_value', 'unbound_filename')
|
||||||
|
|
||||||
|
|
||||||
class FillAnnotator(TargetAnnotator, ParamAnnotator):
|
class FillAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
"""Fill annotator
|
"""Fill annotator
|
||||||
"""
|
"""
|
||||||
|
@ -46,11 +49,20 @@ class FillAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
self.functions = dir(load_modules(eosfunc_file))
|
self.functions = dir(load_modules(eosfunc_file))
|
||||||
self.target_is_uniq = True
|
self.target_is_uniq = True
|
||||||
self.only_variable = True
|
self.only_variable = True
|
||||||
|
self.allow_function = False
|
||||||
self.convert_target(self.objectspace.space.constraints.fill)
|
self.convert_target(self.objectspace.space.constraints.fill)
|
||||||
self.convert_param(self.objectspace.space.constraints.fill)
|
self.convert_param(self.objectspace.space.constraints.fill)
|
||||||
self.fill_to_value()
|
self.fill_to_value()
|
||||||
del self.objectspace.space.constraints.fill
|
del self.objectspace.space.constraints.fill
|
||||||
|
|
||||||
|
def calc_is_multi(self, variable: 'self.objectspace.variable') -> bool:
|
||||||
|
multi = variable.multi
|
||||||
|
if multi is False:
|
||||||
|
return multi
|
||||||
|
if multi == 'submulti':
|
||||||
|
return True
|
||||||
|
return not self.objectspace.paths.is_follower(variable.path)
|
||||||
|
|
||||||
def fill_to_value(self) -> None:
|
def fill_to_value(self) -> None:
|
||||||
"""valid and manage <fill>
|
"""valid and manage <fill>
|
||||||
"""
|
"""
|
||||||
|
@ -65,6 +77,11 @@ class FillAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
value = self.objectspace.value(fill.xmlfiles)
|
value = self.objectspace.value(fill.xmlfiles)
|
||||||
value.type = 'calculation'
|
value.type = 'calculation'
|
||||||
value.name = fill.name
|
value.name = fill.name
|
||||||
|
if fill.name not in CALC_MULTI:
|
||||||
|
is_calc_multi = self.calc_is_multi(target.name)
|
||||||
|
else:
|
||||||
|
is_calc_multi = False
|
||||||
|
value.calc_multi = is_calc_multi
|
||||||
if target.name.namespace == 'services':
|
if target.name.namespace == 'services':
|
||||||
target.name.default = value
|
target.name.default = value
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue