add jinja support in validator or fill
This commit is contained in:
parent
61569f3772
commit
763c7a4fb8
693 changed files with 6436 additions and 1174 deletions
|
@ -32,6 +32,7 @@ from copy import copy
|
|||
|
||||
from rougail.annotator.target import TargetAnnotator
|
||||
from rougail.annotator.param import ParamAnnotator
|
||||
from rougail.annotator.fill import get_jinja_variable_to_param
|
||||
|
||||
from rougail.i18n import _
|
||||
from rougail.error import DictConsistencyError, display_xmlfiles
|
||||
|
@ -60,6 +61,7 @@ class Annotator(TargetAnnotator, ParamAnnotator):
|
|||
self.convert_target(constraints.check, path_prefix)
|
||||
self.convert_param(constraints.check, path_prefix)
|
||||
self.check_check(constraints)
|
||||
self.convert_check_jinja(constraints, path_prefix)
|
||||
self.check_change_warning(constraints)
|
||||
self.convert_valid_entier(constraints)
|
||||
self.convert_check(constraints)
|
||||
|
@ -72,7 +74,7 @@ class Annotator(TargetAnnotator, ParamAnnotator):
|
|||
"""
|
||||
remove_indexes = []
|
||||
for check_idx, check in enumerate(constraints.check):
|
||||
if not check.name in self.functions and not self.objectspace.just_doc:
|
||||
if check.type == 'function' and not check.name in self.functions and not self.objectspace.just_doc:
|
||||
msg = _(f'cannot find check function "{check.name}"')
|
||||
raise DictConsistencyError(msg, 1, check.xmlfiles)
|
||||
if hasattr(check, 'param') and check.param == []:
|
||||
|
@ -81,15 +83,6 @@ class Annotator(TargetAnnotator, ParamAnnotator):
|
|||
for idx in remove_indexes:
|
||||
del constraints.check[idx]
|
||||
|
||||
def check_change_warning(self,
|
||||
constraints,
|
||||
):
|
||||
"""convert level to "warnings_only"
|
||||
"""
|
||||
for check in constraints.check:
|
||||
check.warnings_only = check.level == 'warning'
|
||||
check.level = None
|
||||
|
||||
def convert_valid_entier(self,
|
||||
constraints,
|
||||
) -> None:
|
||||
|
@ -121,6 +114,48 @@ class Annotator(TargetAnnotator, ParamAnnotator):
|
|||
for idx in remove_indexes:
|
||||
del constraints.check[idx]
|
||||
|
||||
def convert_check_jinja(self,
|
||||
constraints,
|
||||
path_prefix,
|
||||
) -> None:
|
||||
"""convert jinja <check> to a function
|
||||
"""
|
||||
for check in constraints.check:
|
||||
if check.type != 'jinja':
|
||||
continue
|
||||
if len(check.target) > 1:
|
||||
msg = _(f'a check with type jinja cannot have more than one target')
|
||||
raise DictConsistencyError(msg, 92, check.xmlfiles)
|
||||
if not hasattr(check, 'param'):
|
||||
check.param = []
|
||||
jinja_text = check.name
|
||||
check.name = 'valid_with_jinja'
|
||||
new_param = self.objectspace.param(check.xmlfiles)
|
||||
new_param.name = '__internal_jinja'
|
||||
new_param.text = jinja_text
|
||||
new_param.type = 'jinja'
|
||||
check.param.append(new_param)
|
||||
if path_prefix:
|
||||
path = check.target[0].name.path.split('.', 1)[-1]
|
||||
else:
|
||||
path = check.target[0].name.path
|
||||
get_jinja_variable_to_param(jinja_text,
|
||||
self.objectspace,
|
||||
check,
|
||||
path_prefix,
|
||||
check.target[0].name.name,
|
||||
path,
|
||||
)
|
||||
|
||||
def check_change_warning(self,
|
||||
constraints,
|
||||
):
|
||||
"""convert level to "warnings_only"
|
||||
"""
|
||||
for check in constraints.check:
|
||||
check.warnings_only = check.level == 'warning'
|
||||
check.level = None
|
||||
|
||||
def convert_check(self,
|
||||
constraints,
|
||||
) -> None:
|
||||
|
|
|
@ -234,7 +234,8 @@ class Annotator(Walk):
|
|||
self._change_variable_mode(variable, family_mode, is_leadership)
|
||||
if self.modes[min_variable_mode] > self.modes[variable.mode]:
|
||||
min_variable_mode = variable.mode
|
||||
if not isinstance(family, self.objectspace.family) or is_leadership:
|
||||
if not isinstance(family, (self.objectspace.family, self.objectspace.variables)) or \
|
||||
is_leadership:
|
||||
# it's Variable, Service, ... and leadership
|
||||
return
|
||||
if not hasattr(family, 'mode'):
|
||||
|
|
|
@ -32,10 +32,93 @@ from rougail.i18n import _
|
|||
from rougail.error import DictConsistencyError
|
||||
|
||||
from rougail.annotator.target import TargetAnnotator
|
||||
from rougail.annotator.param import ParamAnnotator
|
||||
from rougail.annotator.param import ParamAnnotator, set_variable_to_param
|
||||
|
||||
|
||||
CALC_MULTI = ('calc_value', 'calc_list', 'get_range', 'calc_val_first_value', 'unbound_filename', 'zone_information', 'get_certificates', 'nsd_filename', 'get_linked_configuration', 'get_internal_zones', 'nsd_concat_lists', 'get_internal_info_in_zone')
|
||||
from jinja2.sandbox import SandboxedEnvironment
|
||||
from jinja2 import Undefined, UndefinedError, DictLoader
|
||||
from jinja2.utils import missing
|
||||
|
||||
|
||||
class CollectUndefined(Undefined):
|
||||
def __init__(
|
||||
self,
|
||||
hint=None,
|
||||
obj=missing,
|
||||
name=None,
|
||||
exc=UndefinedError,
|
||||
subname=None,
|
||||
) -> None:
|
||||
self._undefined_hint = hint
|
||||
self._undefined_obj = obj
|
||||
self._undefined_name = name
|
||||
self._undefined_exception = exc
|
||||
if subname:
|
||||
full_name = subname + '.'
|
||||
else:
|
||||
full_name = ''
|
||||
full_name += self._undefined_name
|
||||
self.variables.add(full_name)
|
||||
self._undefined_full_name = full_name
|
||||
|
||||
def __getattr__(self, name):
|
||||
return CollectUndefined(name=name, subname=self._undefined_full_name)
|
||||
|
||||
|
||||
def get_jinja_variable_to_param(jinja_text,
|
||||
objectspace,
|
||||
obj,
|
||||
path_prefix,
|
||||
variable_name,
|
||||
variable_path,
|
||||
):
|
||||
CollectUndefined.variables = set()
|
||||
try:
|
||||
SandboxedEnvironment(loader=DictLoader({'tmpl': jinja_text}), undefined=CollectUndefined).get_template('tmpl').render()
|
||||
except UndefinedError as err:
|
||||
msg = _(f'error in jinja "{jinja_text}": {err}')
|
||||
raise DictConsistencyError(msg, 91, obj.xmlfiles) from err
|
||||
variables = list(CollectUndefined.variables)
|
||||
variables.sort()
|
||||
for variable in variables:
|
||||
new_param = objectspace.param(obj.xmlfiles)
|
||||
if variable in [variable_name, variable_path]:
|
||||
new_param.name = '__internal_key'
|
||||
new_param.type = 'string'
|
||||
new_param.text = variable
|
||||
else:
|
||||
new_param.name = variable
|
||||
new_param.text = variable
|
||||
try:
|
||||
set_variable_to_param(new_param,
|
||||
objectspace,
|
||||
None,
|
||||
obj.namespace,
|
||||
path_prefix,
|
||||
None,
|
||||
)
|
||||
except DictConsistencyError as err:
|
||||
if err.errno != 42:
|
||||
raise err from err
|
||||
continue
|
||||
new_param.type = 'variable'
|
||||
obj.param.append(new_param)
|
||||
|
||||
|
||||
CALC_MULTI = ('calc_value',
|
||||
'calc_list',
|
||||
'get_range',
|
||||
'calc_val_first_value',
|
||||
'unbound_filename',
|
||||
'zone_information',
|
||||
'get_certificates',
|
||||
'nsd_filename',
|
||||
'get_linked_configuration',
|
||||
'get_internal_zones',
|
||||
'nsd_concat_lists',
|
||||
'get_internal_info_in_zone',
|
||||
'jinja_to_function',
|
||||
)
|
||||
|
||||
|
||||
class Annotator(TargetAnnotator, ParamAnnotator):
|
||||
|
@ -60,7 +143,7 @@ class Annotator(TargetAnnotator, ParamAnnotator):
|
|||
continue
|
||||
self.convert_target(constraints.fill, path_prefix)
|
||||
self.convert_param(constraints.fill, path_prefix)
|
||||
self.fill_to_value(constraints)
|
||||
self.fill_to_value(constraints, path_prefix)
|
||||
del constraints.fill
|
||||
|
||||
def calc_is_multi(self, variable: 'self.objectspace.variable') -> bool:
|
||||
|
@ -71,14 +154,29 @@ class Annotator(TargetAnnotator, ParamAnnotator):
|
|||
return True
|
||||
return not self.objectspace.paths.is_follower(variable)
|
||||
|
||||
def fill_to_value(self, constraints) -> None:
|
||||
def fill_to_value(self, constraints, path_prefix: str) -> None:
|
||||
"""valid and manage <fill>
|
||||
"""
|
||||
for fill in constraints.fill:
|
||||
# test if the function exists
|
||||
if not self.objectspace.just_doc and fill.name not in self.functions:
|
||||
if fill.type == 'jinja':
|
||||
jinja_text = fill.name
|
||||
fill.name = 'jinja_to_function'
|
||||
if not hasattr(fill, 'param'):
|
||||
fill.param = []
|
||||
new_param = self.objectspace.param(fill.xmlfiles)
|
||||
new_param.name = '__internal_jinja'
|
||||
new_param.text = jinja_text
|
||||
new_param.type = 'jinja'
|
||||
fill.param.append(new_param)
|
||||
if len(fill.target) > 1:
|
||||
msg = _(f'a fill with type jinja cannot have more than one target')
|
||||
raise DictConsistencyError(msg, 92, fill.xmlfiles)
|
||||
elif not self.objectspace.just_doc and fill.name not in self.functions:
|
||||
msg = _(f'cannot find fill function "{fill.name}"')
|
||||
raise DictConsistencyError(msg, 25, fill.xmlfiles)
|
||||
target_type = None
|
||||
target_multi = False
|
||||
for target in fill.target:
|
||||
# create an object value
|
||||
value = self.objectspace.value(fill.xmlfiles)
|
||||
|
@ -96,3 +194,24 @@ class Annotator(TargetAnnotator, ParamAnnotator):
|
|||
# manage params
|
||||
if hasattr(fill, 'param') and fill.param:
|
||||
value.param = fill.param
|
||||
target_type = target.name.type
|
||||
target_multi = target.name.multi
|
||||
if fill.type == 'jinja':
|
||||
new_param = self.objectspace.param(fill.xmlfiles)
|
||||
new_param.name = '__internal_type'
|
||||
new_param.text = target_type
|
||||
fill.param.append(new_param)
|
||||
#
|
||||
new_param = self.objectspace.param(fill.xmlfiles)
|
||||
new_param.name = '__internal_multi'
|
||||
new_param.text = target_multi
|
||||
new_param.type = 'boolean'
|
||||
fill.param.append(new_param)
|
||||
#
|
||||
get_jinja_variable_to_param(jinja_text,
|
||||
self.objectspace,
|
||||
fill,
|
||||
path_prefix,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
|
|
|
@ -38,6 +38,36 @@ from rougail.i18n import _
|
|||
from rougail.error import DictConsistencyError
|
||||
|
||||
|
||||
def set_variable_to_param(param,
|
||||
objectspace,
|
||||
name,
|
||||
namespace,
|
||||
path_prefix,
|
||||
variable_type,
|
||||
):
|
||||
param.text, suffix = objectspace.paths.get_variable_with_suffix(param.text,
|
||||
namespace,
|
||||
param.xmlfiles,
|
||||
path_prefix,
|
||||
)
|
||||
if variable_type and param.text.type != variable_type:
|
||||
msg = _(f'"{name}" has type "{variable_type}" but param '
|
||||
f'has type "{param.text.type}"')
|
||||
raise DictConsistencyError(msg, 26, param.xmlfiles)
|
||||
if not suffix:
|
||||
return
|
||||
param.suffix = suffix
|
||||
namespace = param.text.namespace
|
||||
family_path = objectspace.paths.get_variable_family_path(param.text.path,
|
||||
namespace,
|
||||
force_path_prefix=path_prefix,
|
||||
)
|
||||
param.family = objectspace.paths.get_family(family_path,
|
||||
namespace,
|
||||
path_prefix,
|
||||
)
|
||||
|
||||
|
||||
class ParamAnnotator:
|
||||
"""Param annotator
|
||||
"""
|
||||
|
@ -72,26 +102,13 @@ class ParamAnnotator:
|
|||
elif param.type == 'variable':
|
||||
if not isinstance(param.text, self.objectspace.variable):
|
||||
try:
|
||||
param.text, suffix = self.objectspace.paths.get_variable_with_suffix(param.text,
|
||||
obj.namespace,
|
||||
param.xmlfiles,
|
||||
path_prefix,
|
||||
)
|
||||
if variable_type and param.text.type != variable_type:
|
||||
msg = _(f'"{obj.name}" has type "{variable_type}" but param '
|
||||
f'has type "{param.text.type}"')
|
||||
raise DictConsistencyError(msg, 26, param.xmlfiles)
|
||||
if suffix:
|
||||
param.suffix = suffix
|
||||
namespace = param.text.namespace
|
||||
family_path = self.objectspace.paths.get_variable_family_path(param.text.path,
|
||||
namespace,
|
||||
force_path_prefix=path_prefix,
|
||||
)
|
||||
param.family = self.objectspace.paths.get_family(family_path,
|
||||
namespace,
|
||||
path_prefix,
|
||||
)
|
||||
set_variable_to_param(param,
|
||||
self.objectspace,
|
||||
obj.name,
|
||||
obj.namespace,
|
||||
path_prefix,
|
||||
variable_type,
|
||||
)
|
||||
except DictConsistencyError as err:
|
||||
if not self.objectspace.just_doc and (err.errno != 42 or not param.optional):
|
||||
raise err
|
||||
|
|
|
@ -151,10 +151,12 @@
|
|||
|
||||
<!ELEMENT fill ((target|param)+)>
|
||||
<!ATTLIST fill name CDATA #REQUIRED>
|
||||
<!ATTLIST fill type (function|jinja) "function">
|
||||
|
||||
<!ELEMENT check ((target|param)+)>
|
||||
<!ATTLIST check name CDATA #REQUIRED>
|
||||
<!ATTLIST check level (error|warning) "error">
|
||||
<!ATTLIST check type (function|jinja) "function">
|
||||
|
||||
<!ELEMENT condition ((target|param)+)>
|
||||
<!ATTLIST condition name (disabled_if_in|disabled_if_not_in|hidden_if_in|hidden_if_not_in|mandatory_if_in|mandatory_if_not_in) #REQUIRED>
|
||||
|
|
|
@ -1492,6 +1492,11 @@ mapping:
|
|||
type: str
|
||||
name:
|
||||
type: str
|
||||
type:
|
||||
type: str
|
||||
enum:
|
||||
- "function"
|
||||
- "jinja"
|
||||
check:
|
||||
required: false
|
||||
type: seq
|
||||
|
@ -1550,6 +1555,11 @@ mapping:
|
|||
type: str
|
||||
name:
|
||||
type: str
|
||||
type:
|
||||
type: str
|
||||
enum:
|
||||
- "function"
|
||||
- "jinja"
|
||||
level:
|
||||
type: str
|
||||
enum:
|
||||
|
|
|
@ -60,6 +60,7 @@ class TiramisuReflector:
|
|||
cfg,
|
||||
):
|
||||
self.cfg = cfg
|
||||
self.jinja_added = False
|
||||
self.text = {'header': [],
|
||||
'option': [],
|
||||
'optiondescription': [],
|
||||
|
@ -92,14 +93,55 @@ class TiramisuReflector:
|
|||
self.text['header'].append(f"setattr(func, '{func}', {func})")
|
||||
self.text['header'].extend(["try:",
|
||||
" from tiramisu4 import *",
|
||||
" from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES",
|
||||
"except:",
|
||||
" from tiramisu import *",
|
||||
" from tiramisu.setting import ALLOWED_LEADER_PROPERTIES",
|
||||
])
|
||||
for mode in objectspace.rougailconfig["modes_level"]:
|
||||
self.text['header'].append(f'ALLOWED_LEADER_PROPERTIES.add("{mode}")')
|
||||
self.objectspace = objectspace
|
||||
self.make_tiramisu_objects()
|
||||
if self.cfg['export_with_import'] and (self.cfg['force_convert_dyn_option_description'] or self.objectspace.has_dyn_option is True):
|
||||
self.text['header'].append("from rougail.tiramisu import ConvertDynOptionDescription")
|
||||
|
||||
def add_jinja_to_function(self,
|
||||
variable_name: str,
|
||||
jinja: str,
|
||||
) -> None:
|
||||
if not self.jinja_added:
|
||||
self.text['header'].extend(["from jinja2 import StrictUndefined, DictLoader",
|
||||
"from jinja2.sandbox import SandboxedEnvironment",
|
||||
"from rougail.annotator.variable import CONVERT_OPTION",
|
||||
"def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, **kwargs):",
|
||||
" kw = {}",
|
||||
" for key, value in kwargs.items():",
|
||||
" if '.' in key:",
|
||||
" c_kw = kw",
|
||||
" path, var = key.rsplit('.', 1)",
|
||||
" for subkey in path.split('.'):",
|
||||
" c_kw = c_kw.setdefault(subkey, {})",
|
||||
" c_kw[var] = value",
|
||||
" else:",
|
||||
" kw[key] = value",
|
||||
" values = ENV.get_template(__internal_jinja).render(kw)",
|
||||
" convert = CONVERT_OPTION[__internal_type].get('func', str)",
|
||||
" if __internal_multi:",
|
||||
" return [convert(val) for val in values.split(',')]",
|
||||
" return convert(values)",
|
||||
"def valid_with_jinja(value, **kwargs):",
|
||||
" kwargs[kwargs.pop('__internal_key')] = value",
|
||||
" value = jinja_to_function(__internal_type='string', __internal_multi=False, **kwargs)",
|
||||
" if value:",
|
||||
" raise ValueError(value)",
|
||||
"func.jinja_to_function = jinja_to_function",
|
||||
"func.valid_with_jinja = valid_with_jinja",
|
||||
"dict_env = {}",
|
||||
])
|
||||
self.jinja_added = True
|
||||
jinja_text = dumps(jinja, ensure_ascii=False)
|
||||
self.text['header'].append(f"dict_env['{variable_name}'] = {jinja_text}")
|
||||
|
||||
def make_tiramisu_objects(self) -> None:
|
||||
"""make tiramisu objects
|
||||
"""
|
||||
|
@ -107,15 +149,13 @@ class TiramisuReflector:
|
|||
baseelt.reflector_name = f'option_0{self.objectspace.rougailconfig["suffix"]}'
|
||||
self.set_name(baseelt)
|
||||
basefamily = Family(baseelt,
|
||||
self.text,
|
||||
self.objectspace,
|
||||
self,
|
||||
)
|
||||
if not self.objectspace.paths.has_path_prefix():
|
||||
for elt in self.reorder_family(self.objectspace.space):
|
||||
self.populate_family(basefamily,
|
||||
elt,
|
||||
)
|
||||
# basefamily.populate_informations()
|
||||
if not hasattr(basefamily.elt, 'information'):
|
||||
basefamily.elt.information = self.objectspace.information(None)
|
||||
basefamily.elt.information = self.objectspace.paths.get_providers_path()
|
||||
|
@ -126,8 +166,7 @@ class TiramisuReflector:
|
|||
space = self.objectspace.space.variables[path_prefix]
|
||||
self.set_name(space)
|
||||
baseprefix = Family(space,
|
||||
self.text,
|
||||
self.objectspace,
|
||||
self,
|
||||
)
|
||||
basefamily.add(baseprefix)
|
||||
for elt in self.reorder_family(space):
|
||||
|
@ -140,7 +179,6 @@ class TiramisuReflector:
|
|||
setattr(baseprefix.elt.information, key, value)
|
||||
for key, value in self.objectspace.paths.get_suppliers_path(path_prefix).items():
|
||||
setattr(baseprefix.elt.information, key, value)
|
||||
# baseprefix.populate_informations()
|
||||
baseelt.name = normalize_family(self.cfg['base_option_name'])
|
||||
baseelt.doc = self.cfg['base_option_name']
|
||||
baseelt.reflector_object.get([], baseelt.doc, 'base') # pylint: disable=E1101
|
||||
|
@ -167,8 +205,7 @@ class TiramisuReflector:
|
|||
"""
|
||||
self.set_name(elt)
|
||||
family = Family(elt,
|
||||
self.text,
|
||||
self.objectspace,
|
||||
self,
|
||||
)
|
||||
parent_family.add(family)
|
||||
for children in vars(elt).values():
|
||||
|
@ -187,8 +224,7 @@ class TiramisuReflector:
|
|||
if isinstance(child, self.objectspace.variable):
|
||||
self.set_name(child)
|
||||
family.add(Variable(child,
|
||||
self.text,
|
||||
self.objectspace,
|
||||
self,
|
||||
))
|
||||
else:
|
||||
self.populate_family(family,
|
||||
|
@ -207,6 +243,10 @@ class TiramisuReflector:
|
|||
def get_text(self):
|
||||
"""Get text
|
||||
"""
|
||||
if self.jinja_added:
|
||||
self.text['header'].extend(["ENV = SandboxedEnvironment(loader=DictLoader(dict_env), undefined=StrictUndefined)",
|
||||
"ENV.compile_templates('jinja_caches', zip=None)",
|
||||
])
|
||||
return '\n'.join(self.text['header'] + self.text['option'] + self.text['optiondescription'])
|
||||
|
||||
|
||||
|
@ -215,13 +255,11 @@ class Common:
|
|||
"""
|
||||
def __init__(self,
|
||||
elt,
|
||||
text,
|
||||
objectspace,
|
||||
tiramisu,
|
||||
):
|
||||
self.elt = elt
|
||||
self.option_name = None
|
||||
self.text = text
|
||||
self.objectspace = objectspace
|
||||
self.tiramisu = tiramisu
|
||||
self.elt.reflector_object = self
|
||||
self.object_type = None
|
||||
|
||||
|
@ -256,7 +294,7 @@ class Common:
|
|||
#name = 'optiondescription'
|
||||
else:
|
||||
name = 'option'
|
||||
self.text[name].append(f'{self.option_name} = {self.object_type}({attrib})')
|
||||
self.tiramisu.text[name].append(f'{self.option_name} = {self.object_type}({attrib})')
|
||||
|
||||
def _populate_attrib(self,
|
||||
keys: dict,
|
||||
|
@ -277,7 +315,7 @@ class Common:
|
|||
properties = [self.convert_str(property_) for property_ in values
|
||||
if isinstance(property_, str)]
|
||||
calc_properties = [self.calc_properties(property_) for property_ in values \
|
||||
if isinstance(property_, self.objectspace.property_)]
|
||||
if isinstance(property_, self.tiramisu.objectspace.property_)]
|
||||
return 'frozenset({' + ', '.join(sorted(properties) + calc_properties) + '})'
|
||||
|
||||
def calc_properties(self,
|
||||
|
@ -307,7 +345,7 @@ class Common:
|
|||
continue
|
||||
if isinstance(value, str):
|
||||
value = self.convert_str(value)
|
||||
self.text['option'].append(f"{self.option_name}.impl_set_information('{key}', {value})")
|
||||
self.tiramisu.text['option'].append(f"{self.option_name}.impl_set_information('{key}', {value})")
|
||||
|
||||
def populate_param(self,
|
||||
param,
|
||||
|
@ -332,6 +370,9 @@ class Common:
|
|||
return 'ParamSuffix()'
|
||||
if param.type == 'index':
|
||||
return 'ParamIndex()'
|
||||
if param.type == 'jinja':
|
||||
self.tiramisu.add_jinja_to_function(self.elt.path, param.text)
|
||||
return f'ParamValue("{self.elt.path}")'
|
||||
value = self.convert_str(param.text)
|
||||
return f'ParamValue({value})'
|
||||
|
||||
|
@ -363,10 +404,9 @@ class Variable(Common):
|
|||
"""
|
||||
def __init__(self,
|
||||
elt,
|
||||
text,
|
||||
objectspace,
|
||||
tiramisu,
|
||||
):
|
||||
super().__init__(elt, text, objectspace)
|
||||
super().__init__(elt, tiramisu)
|
||||
self.object_type = CONVERT_OPTION[elt.type]['opttype']
|
||||
|
||||
def _populate_attrib(self,
|
||||
|
@ -390,7 +430,7 @@ class Variable(Common):
|
|||
value = getattr(self.elt, key)
|
||||
if isinstance(value, str):
|
||||
value = self.convert_str(value)
|
||||
elif isinstance(value, self.objectspace.value):
|
||||
elif isinstance(value, self.tiramisu.objectspace.value):
|
||||
value = self.calculation_value(value, [], calc_multi=value.calc_multi)
|
||||
keys[key] = value
|
||||
if hasattr(self.elt, 'validators'):
|
||||
|
@ -444,12 +484,11 @@ class Family(Common):
|
|||
"""
|
||||
def __init__(self,
|
||||
elt,
|
||||
text,
|
||||
objectspace,
|
||||
tiramisu,
|
||||
):
|
||||
super().__init__(elt, text, objectspace)
|
||||
super().__init__(elt, tiramisu)
|
||||
if hasattr(self.elt, 'suffixes'):
|
||||
self.objectspace.has_dyn_option = True
|
||||
self.tiramisu.objectspace.has_dyn_option = True
|
||||
self.object_type = 'ConvertDynOptionDescription'
|
||||
elif hasattr(self.elt, 'leadership') and self.elt.leadership:
|
||||
self.object_type = 'Leadership'
|
||||
|
|
|
@ -16,8 +16,13 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_1 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_2 = BoolOption(name="manage", doc="manage", default=True)
|
||||
optiondescription_4 = OptionDescription(name="tata_service", doc="tata.service", children=[option_1, option_2])
|
||||
|
|
|
@ -16,8 +16,13 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_1 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_2 = BoolOption(name="manage", doc="manage", default=True)
|
||||
optiondescription_7 = OptionDescription(name="tata_service", doc="tata.service", children=[option_1, option_2])
|
||||
|
|
|
@ -16,9 +16,14 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
||||
option_1 = StrOption(name="myvar", doc="myvar", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, notraisepropertyerror=True), 'expected': ParamValue(True)}), func.calc_value_property_help)}))
|
||||
optiondescription_3 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2])
|
||||
optiondescription_3 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_3])
|
||||
|
|
|
@ -16,14 +16,19 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
||||
option_1 = StrOption(name="myvar", doc="myvar", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, notraisepropertyerror=True), 'expected': ParamValue(True)}), func.calc_value_property_help)}))
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2])
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2], properties=frozenset({"basic"}))
|
||||
optiondescription_5 = OptionDescription(name="1", doc="1", children=[optiondescription_6])
|
||||
option_4 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
||||
option_3 = StrOption(name="myvar", doc="myvar", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_4, notraisepropertyerror=True), 'expected': ParamValue(True)}), func.calc_value_property_help)}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[option_3, option_4])
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[option_3, option_4], properties=frozenset({"basic"}))
|
||||
optiondescription_7 = OptionDescription(name="2", doc="2", children=[optiondescription_8])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_5, optiondescription_7])
|
||||
|
|
|
@ -16,9 +16,14 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
||||
option_1 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"expert", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, notraisepropertyerror=True), 'expected': ParamValue(True)}), func.calc_value_property_help)}))
|
||||
optiondescription_3 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2])
|
||||
optiondescription_3 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2], properties=frozenset({"normal"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_3])
|
||||
|
|
|
@ -16,14 +16,19 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
||||
option_1 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"expert", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, notraisepropertyerror=True), 'expected': ParamValue(True)}), func.calc_value_property_help)}))
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2])
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_5 = OptionDescription(name="1", doc="1", children=[optiondescription_6])
|
||||
option_4 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
||||
option_3 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"expert", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_4, notraisepropertyerror=True), 'expected': ParamValue(True)}), func.calc_value_property_help)}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[option_3, option_4])
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[option_3, option_4], properties=frozenset({"normal"}))
|
||||
optiondescription_7 = OptionDescription(name="2", doc="2", children=[optiondescription_8])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_5, optiondescription_7])
|
||||
|
|
|
@ -16,10 +16,15 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_1 = BoolOption(name="server_deployed", doc="server_deployed", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"basic", "force_store_value", "mandatory"}))
|
||||
optiondescription_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"basic"}))
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, optiondescription_2])
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, optiondescription_2], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_4])
|
||||
|
|
|
@ -16,16 +16,21 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_1 = BoolOption(name="server_deployed", doc="server_deployed", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"basic", "force_store_value", "mandatory"}))
|
||||
optiondescription_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"basic"}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, optiondescription_2])
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, optiondescription_2], properties=frozenset({"basic"}))
|
||||
optiondescription_7 = OptionDescription(name="1", doc="1", children=[optiondescription_8])
|
||||
option_4 = BoolOption(name="server_deployed", doc="server_deployed", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_6 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"basic", "force_store_value", "mandatory"}))
|
||||
optiondescription_5 = OptionDescription(name="general", doc="général", children=[option_6], properties=frozenset({"basic"}))
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[option_4, optiondescription_5])
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[option_4, optiondescription_5], properties=frozenset({"basic"}))
|
||||
optiondescription_9 = OptionDescription(name="2", doc="2", children=[optiondescription_10])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_7, optiondescription_9])
|
||||
|
|
|
@ -16,10 +16,15 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_1 = BoolOption(name="server_deployed", doc="server_deployed", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "force_store_value", "mandatory"}))
|
||||
optiondescription_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"expert"}))
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, optiondescription_2])
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, optiondescription_2], properties=frozenset({"normal"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_4])
|
||||
|
|
|
@ -16,16 +16,21 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_1 = BoolOption(name="server_deployed", doc="server_deployed", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "force_store_value", "mandatory"}))
|
||||
optiondescription_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"expert"}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, optiondescription_2])
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, optiondescription_2], properties=frozenset({"normal"}))
|
||||
optiondescription_7 = OptionDescription(name="1", doc="1", children=[optiondescription_8])
|
||||
option_4 = BoolOption(name="server_deployed", doc="server_deployed", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_6 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "force_store_value", "mandatory"}))
|
||||
optiondescription_5 = OptionDescription(name="general", doc="général", children=[option_6], properties=frozenset({"expert"}))
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[option_4, optiondescription_5])
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[option_4, optiondescription_5], properties=frozenset({"normal"}))
|
||||
optiondescription_9 = OptionDescription(name="2", doc="2", children=[optiondescription_10])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_7, optiondescription_9])
|
||||
|
|
|
@ -16,9 +16,14 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="général", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_3 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_3 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_3])
|
||||
|
|
|
@ -16,14 +16,19 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="général", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
optiondescription_5 = OptionDescription(name="1", doc="1", children=[optiondescription_6])
|
||||
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
optiondescription_3 = OptionDescription(name="general", doc="général", children=[option_4], properties=frozenset({"normal"}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3])
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3], properties=frozenset({"normal"}))
|
||||
optiondescription_7 = OptionDescription(name="2", doc="2", children=[optiondescription_8])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_5, optiondescription_7])
|
||||
|
|
|
@ -16,10 +16,15 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
option_3 = StrOption(name="without_type", doc="without_type", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="général", children=[option_2, option_3], properties=frozenset({"normal"}))
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_4])
|
||||
|
|
|
@ -16,16 +16,21 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
option_3 = StrOption(name="without_type", doc="without_type", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="général", children=[option_2, option_3], properties=frozenset({"normal"}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
optiondescription_7 = OptionDescription(name="1", doc="1", children=[optiondescription_8])
|
||||
option_5 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
option_6 = StrOption(name="without_type", doc="without_type", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_4 = OptionDescription(name="general", doc="général", children=[option_5, option_6], properties=frozenset({"normal"}))
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_4])
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_4], properties=frozenset({"normal"}))
|
||||
optiondescription_9 = OptionDescription(name="2", doc="2", children=[optiondescription_10])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_7, optiondescription_9])
|
||||
|
|
|
@ -16,9 +16,14 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="général", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_3 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_3 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_3])
|
||||
|
|
|
@ -16,14 +16,19 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="général", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
optiondescription_5 = OptionDescription(name="1", doc="1", children=[optiondescription_6])
|
||||
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
optiondescription_3 = OptionDescription(name="general", doc="général", children=[option_4], properties=frozenset({"normal"}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3])
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3], properties=frozenset({"normal"}))
|
||||
optiondescription_7 = OptionDescription(name="2", doc="2", children=[optiondescription_8])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_5, optiondescription_7])
|
||||
|
|
|
@ -16,10 +16,15 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="général", children=[option_2, option_3], properties=frozenset({"normal"}))
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_4])
|
||||
|
|
|
@ -16,16 +16,21 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="général", children=[option_2, option_3], properties=frozenset({"normal"}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
optiondescription_7 = OptionDescription(name="1", doc="1", children=[optiondescription_8])
|
||||
option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
option_6 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
optiondescription_4 = OptionDescription(name="general", doc="général", children=[option_5, option_6], properties=frozenset({"normal"}))
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_4])
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_4], properties=frozenset({"normal"}))
|
||||
optiondescription_9 = OptionDescription(name="2", doc="2", children=[optiondescription_10])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_7, optiondescription_9])
|
||||
|
|
|
@ -16,9 +16,14 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_1 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = StrOption(name="my_variable", doc="my_variable", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"basic", "force_store_value", "hidden", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_1, notraisepropertyerror=True), 'expected': ParamValue(True)}), func.calc_value_property_help)}))
|
||||
optiondescription_3 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2])
|
||||
optiondescription_3 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_3])
|
||||
|
|
|
@ -16,14 +16,19 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_1 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = StrOption(name="my_variable", doc="my_variable", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"basic", "force_store_value", "hidden", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_1, notraisepropertyerror=True), 'expected': ParamValue(True)}), func.calc_value_property_help)}))
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2])
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2], properties=frozenset({"basic"}))
|
||||
optiondescription_5 = OptionDescription(name="1", doc="1", children=[optiondescription_6])
|
||||
option_3 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
||||
option_4 = StrOption(name="my_variable", doc="my_variable", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"basic", "force_store_value", "hidden", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, notraisepropertyerror=True), 'expected': ParamValue(True)}), func.calc_value_property_help)}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[option_3, option_4])
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[option_3, option_4], properties=frozenset({"basic"}))
|
||||
optiondescription_7 = OptionDescription(name="2", doc="2", children=[optiondescription_8])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_5, optiondescription_7])
|
||||
|
|
|
@ -16,10 +16,15 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_3 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_3)))), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, option_3], properties=frozenset({"normal"}))
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_4])
|
||||
|
|
|
@ -16,16 +16,21 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_3 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_3)))), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, option_3], properties=frozenset({"normal"}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
optiondescription_7 = OptionDescription(name="1", doc="1", children=[optiondescription_8])
|
||||
option_6 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
option_5 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_6)))), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
optiondescription_4 = OptionDescription(name="general", doc="general", children=[option_5, option_6], properties=frozenset({"normal"}))
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_4])
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_4], properties=frozenset({"normal"}))
|
||||
optiondescription_9 = OptionDescription(name="2", doc="2", children=[optiondescription_10])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_7, optiondescription_9])
|
||||
|
|
10
tests/dictionaries/01auto_jinja_base/makedict/after.json
Normal file
10
tests/dictionaries/01auto_jinja_base/makedict/after.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"rougail.general.mode_conteneur_actif": {
|
||||
"owner": "default",
|
||||
"value": "non"
|
||||
},
|
||||
"rougail.general.mode_conteneur_actif1": {
|
||||
"owner": "default",
|
||||
"value": "non"
|
||||
}
|
||||
}
|
4
tests/dictionaries/01auto_jinja_base/makedict/base.json
Normal file
4
tests/dictionaries/01auto_jinja_base/makedict/base.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"rougail.general.mode_conteneur_actif": "non",
|
||||
"rougail.general.mode_conteneur_actif1": "non"
|
||||
}
|
10
tests/dictionaries/01auto_jinja_base/makedict/before.json
Normal file
10
tests/dictionaries/01auto_jinja_base/makedict/before.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"rougail.general.mode_conteneur_actif": {
|
||||
"owner": "default",
|
||||
"value": "non"
|
||||
},
|
||||
"rougail.general.mode_conteneur_actif1": {
|
||||
"owner": "default",
|
||||
"value": "non"
|
||||
}
|
||||
}
|
60
tests/dictionaries/01auto_jinja_base/tiramisu/base.py
Normal file
60
tests/dictionaries/01auto_jinja_base/tiramisu/base.py
Normal file
|
@ -0,0 +1,60 @@
|
|||
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||
class func:
|
||||
pass
|
||||
|
||||
def _load_functions(path):
|
||||
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
|
||||
loader = _SourceFileLoader('func', path)
|
||||
spec = _spec_from_loader(loader.name, loader)
|
||||
func_ = _module_from_spec(spec)
|
||||
loader.exec_module(func_)
|
||||
for function in dir(func_):
|
||||
if function.startswith('_'):
|
||||
continue
|
||||
setattr(func, function, getattr(func_, function))
|
||||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
from jinja2 import StrictUndefined, DictLoader
|
||||
from jinja2.sandbox import SandboxedEnvironment
|
||||
from rougail.annotator.variable import CONVERT_OPTION
|
||||
def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, **kwargs):
|
||||
kw = {}
|
||||
for key, value in kwargs.items():
|
||||
if '.' in key:
|
||||
c_kw = kw
|
||||
path, var = key.rsplit('.', 1)
|
||||
for subkey in path.split('.'):
|
||||
c_kw = c_kw.setdefault(subkey, {})
|
||||
c_kw[var] = value
|
||||
else:
|
||||
kw[key] = value
|
||||
values = ENV.get_template(__internal_jinja).render(kw)
|
||||
convert = CONVERT_OPTION[__internal_type].get('func', str)
|
||||
if __internal_multi:
|
||||
return [convert(val) for val in values.split(',')]
|
||||
return convert(values)
|
||||
def valid_with_jinja(value, **kwargs):
|
||||
kwargs[kwargs.pop('__internal_key')] = value
|
||||
value = jinja_to_function(__internal_type='string', __internal_multi=False, **kwargs)
|
||||
if value:
|
||||
raise ValueError(value)
|
||||
func.jinja_to_function = jinja_to_function
|
||||
func.valid_with_jinja = valid_with_jinja
|
||||
dict_env = {}
|
||||
dict_env['rougail.general.mode_conteneur_actif'] = "{{ mode_conteneur_actif1 }}"
|
||||
ENV = SandboxedEnvironment(loader=DictLoader(dict_env), undefined=StrictUndefined)
|
||||
ENV.compile_templates('jinja_caches', zip=None)
|
||||
option_3 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("rougail.general.mode_conteneur_actif"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), 'mode_conteneur_actif1': ParamOption(option_3)})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, option_3], properties=frozenset({"normal"}))
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_4])
|
67
tests/dictionaries/01auto_jinja_base/tiramisu/multi.py
Normal file
67
tests/dictionaries/01auto_jinja_base/tiramisu/multi.py
Normal file
|
@ -0,0 +1,67 @@
|
|||
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||
class func:
|
||||
pass
|
||||
|
||||
def _load_functions(path):
|
||||
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
|
||||
loader = _SourceFileLoader('func', path)
|
||||
spec = _spec_from_loader(loader.name, loader)
|
||||
func_ = _module_from_spec(spec)
|
||||
loader.exec_module(func_)
|
||||
for function in dir(func_):
|
||||
if function.startswith('_'):
|
||||
continue
|
||||
setattr(func, function, getattr(func_, function))
|
||||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
from jinja2 import StrictUndefined, DictLoader
|
||||
from jinja2.sandbox import SandboxedEnvironment
|
||||
from rougail.annotator.variable import CONVERT_OPTION
|
||||
def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, **kwargs):
|
||||
kw = {}
|
||||
for key, value in kwargs.items():
|
||||
if '.' in key:
|
||||
c_kw = kw
|
||||
path, var = key.rsplit('.', 1)
|
||||
for subkey in path.split('.'):
|
||||
c_kw = c_kw.setdefault(subkey, {})
|
||||
c_kw[var] = value
|
||||
else:
|
||||
kw[key] = value
|
||||
values = ENV.get_template(__internal_jinja).render(kw)
|
||||
convert = CONVERT_OPTION[__internal_type].get('func', str)
|
||||
if __internal_multi:
|
||||
return [convert(val) for val in values.split(',')]
|
||||
return convert(values)
|
||||
def valid_with_jinja(value, **kwargs):
|
||||
kwargs[kwargs.pop('__internal_key')] = value
|
||||
value = jinja_to_function(__internal_type='string', __internal_multi=False, **kwargs)
|
||||
if value:
|
||||
raise ValueError(value)
|
||||
func.jinja_to_function = jinja_to_function
|
||||
func.valid_with_jinja = valid_with_jinja
|
||||
dict_env = {}
|
||||
dict_env['1.rougail.general.mode_conteneur_actif'] = "{{ mode_conteneur_actif1 }}"
|
||||
dict_env['2.rougail.general.mode_conteneur_actif'] = "{{ mode_conteneur_actif1 }}"
|
||||
ENV = SandboxedEnvironment(loader=DictLoader(dict_env), undefined=StrictUndefined)
|
||||
ENV.compile_templates('jinja_caches', zip=None)
|
||||
option_3 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("1.rougail.general.mode_conteneur_actif"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), 'mode_conteneur_actif1': ParamOption(option_3)})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, option_3], properties=frozenset({"normal"}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
optiondescription_7 = OptionDescription(name="1", doc="1", children=[optiondescription_8])
|
||||
option_6 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
option_5 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("2.rougail.general.mode_conteneur_actif"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), 'mode_conteneur_actif1': ParamOption(option_6)})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
optiondescription_4 = OptionDescription(name="general", doc="general", children=[option_5, option_6], properties=frozenset({"normal"}))
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_4], properties=frozenset({"normal"}))
|
||||
optiondescription_9 = OptionDescription(name="2", doc="2", children=[optiondescription_10])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_7, optiondescription_9])
|
18
tests/dictionaries/01auto_jinja_base/xml/00-base.xml
Normal file
18
tests/dictionaries/01auto_jinja_base/xml/00-base.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.10">
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="mode_conteneur_actif1" type="string" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
</family>
|
||||
</variables>
|
||||
<constraints>
|
||||
<fill name="{{ mode_conteneur_actif1 }}" type="jinja">
|
||||
<target>mode_conteneur_actif</target>
|
||||
</fill>
|
||||
</constraints>
|
||||
</rougail>
|
23
tests/dictionaries/01auto_jinja_base/yml/00-base.yml
Normal file
23
tests/dictionaries/01auto_jinja_base/yml/00-base.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
version: '0.10'
|
||||
variables:
|
||||
- family:
|
||||
- name: general
|
||||
variables:
|
||||
- variable:
|
||||
- name: mode_conteneur_actif
|
||||
type: string
|
||||
description: No change
|
||||
hidden: true
|
||||
value:
|
||||
- text: non
|
||||
- name: mode_conteneur_actif1
|
||||
type: string
|
||||
description: No change
|
||||
value:
|
||||
- text: non
|
||||
constraints:
|
||||
- fill:
|
||||
- name: '{{ mode_conteneur_actif1 }}'
|
||||
type: jinja
|
||||
target:
|
||||
- text: mode_conteneur_actif
|
0
tests/dictionaries/01auto_jinja_full_path/__init__.py
Normal file
0
tests/dictionaries/01auto_jinja_full_path/__init__.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"rougail.general.mode_conteneur_actif": {
|
||||
"owner": "default",
|
||||
"value": "non"
|
||||
},
|
||||
"rougail.general.mode_conteneur_actif1": {
|
||||
"owner": "default",
|
||||
"value": "non"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"rougail.general.mode_conteneur_actif": "non",
|
||||
"rougail.general.mode_conteneur_actif1": "non"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"rougail.general.mode_conteneur_actif": {
|
||||
"owner": "default",
|
||||
"value": "non"
|
||||
},
|
||||
"rougail.general.mode_conteneur_actif1": {
|
||||
"owner": "default",
|
||||
"value": "non"
|
||||
}
|
||||
}
|
60
tests/dictionaries/01auto_jinja_full_path/tiramisu/base.py
Normal file
60
tests/dictionaries/01auto_jinja_full_path/tiramisu/base.py
Normal file
|
@ -0,0 +1,60 @@
|
|||
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||
class func:
|
||||
pass
|
||||
|
||||
def _load_functions(path):
|
||||
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
|
||||
loader = _SourceFileLoader('func', path)
|
||||
spec = _spec_from_loader(loader.name, loader)
|
||||
func_ = _module_from_spec(spec)
|
||||
loader.exec_module(func_)
|
||||
for function in dir(func_):
|
||||
if function.startswith('_'):
|
||||
continue
|
||||
setattr(func, function, getattr(func_, function))
|
||||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
from jinja2 import StrictUndefined, DictLoader
|
||||
from jinja2.sandbox import SandboxedEnvironment
|
||||
from rougail.annotator.variable import CONVERT_OPTION
|
||||
def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, **kwargs):
|
||||
kw = {}
|
||||
for key, value in kwargs.items():
|
||||
if '.' in key:
|
||||
c_kw = kw
|
||||
path, var = key.rsplit('.', 1)
|
||||
for subkey in path.split('.'):
|
||||
c_kw = c_kw.setdefault(subkey, {})
|
||||
c_kw[var] = value
|
||||
else:
|
||||
kw[key] = value
|
||||
values = ENV.get_template(__internal_jinja).render(kw)
|
||||
convert = CONVERT_OPTION[__internal_type].get('func', str)
|
||||
if __internal_multi:
|
||||
return [convert(val) for val in values.split(',')]
|
||||
return convert(values)
|
||||
def valid_with_jinja(value, **kwargs):
|
||||
kwargs[kwargs.pop('__internal_key')] = value
|
||||
value = jinja_to_function(__internal_type='string', __internal_multi=False, **kwargs)
|
||||
if value:
|
||||
raise ValueError(value)
|
||||
func.jinja_to_function = jinja_to_function
|
||||
func.valid_with_jinja = valid_with_jinja
|
||||
dict_env = {}
|
||||
dict_env['rougail.general.mode_conteneur_actif'] = "{{ rougail.general.mode_conteneur_actif1 }}"
|
||||
ENV = SandboxedEnvironment(loader=DictLoader(dict_env), undefined=StrictUndefined)
|
||||
ENV.compile_templates('jinja_caches', zip=None)
|
||||
option_3 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("rougail.general.mode_conteneur_actif"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), 'rougail.general.mode_conteneur_actif1': ParamOption(option_3)})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, option_3], properties=frozenset({"normal"}))
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_4])
|
67
tests/dictionaries/01auto_jinja_full_path/tiramisu/multi.py
Normal file
67
tests/dictionaries/01auto_jinja_full_path/tiramisu/multi.py
Normal file
|
@ -0,0 +1,67 @@
|
|||
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||
class func:
|
||||
pass
|
||||
|
||||
def _load_functions(path):
|
||||
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
|
||||
loader = _SourceFileLoader('func', path)
|
||||
spec = _spec_from_loader(loader.name, loader)
|
||||
func_ = _module_from_spec(spec)
|
||||
loader.exec_module(func_)
|
||||
for function in dir(func_):
|
||||
if function.startswith('_'):
|
||||
continue
|
||||
setattr(func, function, getattr(func_, function))
|
||||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
from jinja2 import StrictUndefined, DictLoader
|
||||
from jinja2.sandbox import SandboxedEnvironment
|
||||
from rougail.annotator.variable import CONVERT_OPTION
|
||||
def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, **kwargs):
|
||||
kw = {}
|
||||
for key, value in kwargs.items():
|
||||
if '.' in key:
|
||||
c_kw = kw
|
||||
path, var = key.rsplit('.', 1)
|
||||
for subkey in path.split('.'):
|
||||
c_kw = c_kw.setdefault(subkey, {})
|
||||
c_kw[var] = value
|
||||
else:
|
||||
kw[key] = value
|
||||
values = ENV.get_template(__internal_jinja).render(kw)
|
||||
convert = CONVERT_OPTION[__internal_type].get('func', str)
|
||||
if __internal_multi:
|
||||
return [convert(val) for val in values.split(',')]
|
||||
return convert(values)
|
||||
def valid_with_jinja(value, **kwargs):
|
||||
kwargs[kwargs.pop('__internal_key')] = value
|
||||
value = jinja_to_function(__internal_type='string', __internal_multi=False, **kwargs)
|
||||
if value:
|
||||
raise ValueError(value)
|
||||
func.jinja_to_function = jinja_to_function
|
||||
func.valid_with_jinja = valid_with_jinja
|
||||
dict_env = {}
|
||||
dict_env['1.rougail.general.mode_conteneur_actif'] = "{{ rougail.general.mode_conteneur_actif1 }}"
|
||||
dict_env['2.rougail.general.mode_conteneur_actif'] = "{{ rougail.general.mode_conteneur_actif1 }}"
|
||||
ENV = SandboxedEnvironment(loader=DictLoader(dict_env), undefined=StrictUndefined)
|
||||
ENV.compile_templates('jinja_caches', zip=None)
|
||||
option_3 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("1.rougail.general.mode_conteneur_actif"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), 'rougail.general.mode_conteneur_actif1': ParamOption(option_3)})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, option_3], properties=frozenset({"normal"}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
optiondescription_7 = OptionDescription(name="1", doc="1", children=[optiondescription_8])
|
||||
option_6 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
option_5 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("2.rougail.general.mode_conteneur_actif"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), 'rougail.general.mode_conteneur_actif1': ParamOption(option_6)})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
optiondescription_4 = OptionDescription(name="general", doc="general", children=[option_5, option_6], properties=frozenset({"normal"}))
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_4], properties=frozenset({"normal"}))
|
||||
optiondescription_9 = OptionDescription(name="2", doc="2", children=[optiondescription_10])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_7, optiondescription_9])
|
18
tests/dictionaries/01auto_jinja_full_path/xml/00-base.xml
Normal file
18
tests/dictionaries/01auto_jinja_full_path/xml/00-base.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.10">
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="mode_conteneur_actif1" type="string" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
</family>
|
||||
</variables>
|
||||
<constraints>
|
||||
<fill name="{{ rougail.general.mode_conteneur_actif1 }}" type="jinja">
|
||||
<target>mode_conteneur_actif</target>
|
||||
</fill>
|
||||
</constraints>
|
||||
</rougail>
|
23
tests/dictionaries/01auto_jinja_full_path/yml/00-base.yml
Normal file
23
tests/dictionaries/01auto_jinja_full_path/yml/00-base.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
version: '0.10'
|
||||
variables:
|
||||
- family:
|
||||
- name: general
|
||||
variables:
|
||||
- variable:
|
||||
- name: mode_conteneur_actif
|
||||
type: string
|
||||
description: No change
|
||||
hidden: true
|
||||
value:
|
||||
- text: non
|
||||
- name: mode_conteneur_actif1
|
||||
type: string
|
||||
description: No change
|
||||
value:
|
||||
- text: non
|
||||
constraints:
|
||||
- fill:
|
||||
- name: '{{ rougail.general.mode_conteneur_actif1 }}'
|
||||
type: jinja
|
||||
target:
|
||||
- text: mode_conteneur_actif
|
0
tests/dictionaries/01auto_jinja_if/__init__.py
Normal file
0
tests/dictionaries/01auto_jinja_if/__init__.py
Normal file
14
tests/dictionaries/01auto_jinja_if/makedict/after.json
Normal file
14
tests/dictionaries/01auto_jinja_if/makedict/after.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"rougail.general.mode_conteneur_actif": {
|
||||
"owner": "default",
|
||||
"value": "non"
|
||||
},
|
||||
"rougail.general.mode_conteneur_actif1": {
|
||||
"owner": "default",
|
||||
"value": "non"
|
||||
},
|
||||
"rougail.general.mode_conteneur_actif2": {
|
||||
"owner": "default",
|
||||
"value": "oui"
|
||||
}
|
||||
}
|
5
tests/dictionaries/01auto_jinja_if/makedict/base.json
Normal file
5
tests/dictionaries/01auto_jinja_if/makedict/base.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"rougail.general.mode_conteneur_actif": "non",
|
||||
"rougail.general.mode_conteneur_actif1": "non",
|
||||
"rougail.general.mode_conteneur_actif2": "oui"
|
||||
}
|
14
tests/dictionaries/01auto_jinja_if/makedict/before.json
Normal file
14
tests/dictionaries/01auto_jinja_if/makedict/before.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"rougail.general.mode_conteneur_actif": {
|
||||
"owner": "default",
|
||||
"value": "non"
|
||||
},
|
||||
"rougail.general.mode_conteneur_actif1": {
|
||||
"owner": "default",
|
||||
"value": "non"
|
||||
},
|
||||
"rougail.general.mode_conteneur_actif2": {
|
||||
"owner": "default",
|
||||
"value": "oui"
|
||||
}
|
||||
}
|
62
tests/dictionaries/01auto_jinja_if/tiramisu/base.py
Normal file
62
tests/dictionaries/01auto_jinja_if/tiramisu/base.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||
class func:
|
||||
pass
|
||||
|
||||
def _load_functions(path):
|
||||
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
|
||||
loader = _SourceFileLoader('func', path)
|
||||
spec = _spec_from_loader(loader.name, loader)
|
||||
func_ = _module_from_spec(spec)
|
||||
loader.exec_module(func_)
|
||||
for function in dir(func_):
|
||||
if function.startswith('_'):
|
||||
continue
|
||||
setattr(func, function, getattr(func_, function))
|
||||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
from jinja2 import StrictUndefined, DictLoader
|
||||
from jinja2.sandbox import SandboxedEnvironment
|
||||
from rougail.annotator.variable import CONVERT_OPTION
|
||||
def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, **kwargs):
|
||||
kw = {}
|
||||
for key, value in kwargs.items():
|
||||
if '.' in key:
|
||||
c_kw = kw
|
||||
path, var = key.rsplit('.', 1)
|
||||
for subkey in path.split('.'):
|
||||
c_kw = c_kw.setdefault(subkey, {})
|
||||
c_kw[var] = value
|
||||
else:
|
||||
kw[key] = value
|
||||
values = ENV.get_template(__internal_jinja).render(kw)
|
||||
convert = CONVERT_OPTION[__internal_type].get('func', str)
|
||||
if __internal_multi:
|
||||
return [convert(val) for val in values.split(',')]
|
||||
return convert(values)
|
||||
def valid_with_jinja(value, **kwargs):
|
||||
kwargs[kwargs.pop('__internal_key')] = value
|
||||
value = jinja_to_function(__internal_type='string', __internal_multi=False, **kwargs)
|
||||
if value:
|
||||
raise ValueError(value)
|
||||
func.jinja_to_function = jinja_to_function
|
||||
func.valid_with_jinja = valid_with_jinja
|
||||
dict_env = {}
|
||||
dict_env['rougail.general.mode_conteneur_actif'] = "{% if mode_conteneur_actif1 == 'non' %}non{% else %}oui{% endif %}"
|
||||
dict_env['rougail.general.mode_conteneur_actif2'] = "{% if mode_conteneur_actif1 == \"non\" %}oui{% else %}non{% endif %}"
|
||||
ENV = SandboxedEnvironment(loader=DictLoader(dict_env), undefined=StrictUndefined)
|
||||
ENV.compile_templates('jinja_caches', zip=None)
|
||||
option_3 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("rougail.general.mode_conteneur_actif"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), 'mode_conteneur_actif1': ParamOption(option_3)})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
option_4 = StrOption(name="mode_conteneur_actif2", doc="No change", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("rougail.general.mode_conteneur_actif2"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), 'mode_conteneur_actif1': ParamOption(option_3)})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, option_3, option_4], properties=frozenset({"normal"}))
|
||||
optiondescription_5 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_5])
|
71
tests/dictionaries/01auto_jinja_if/tiramisu/multi.py
Normal file
71
tests/dictionaries/01auto_jinja_if/tiramisu/multi.py
Normal file
|
@ -0,0 +1,71 @@
|
|||
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||
class func:
|
||||
pass
|
||||
|
||||
def _load_functions(path):
|
||||
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
|
||||
loader = _SourceFileLoader('func', path)
|
||||
spec = _spec_from_loader(loader.name, loader)
|
||||
func_ = _module_from_spec(spec)
|
||||
loader.exec_module(func_)
|
||||
for function in dir(func_):
|
||||
if function.startswith('_'):
|
||||
continue
|
||||
setattr(func, function, getattr(func_, function))
|
||||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
from jinja2 import StrictUndefined, DictLoader
|
||||
from jinja2.sandbox import SandboxedEnvironment
|
||||
from rougail.annotator.variable import CONVERT_OPTION
|
||||
def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, **kwargs):
|
||||
kw = {}
|
||||
for key, value in kwargs.items():
|
||||
if '.' in key:
|
||||
c_kw = kw
|
||||
path, var = key.rsplit('.', 1)
|
||||
for subkey in path.split('.'):
|
||||
c_kw = c_kw.setdefault(subkey, {})
|
||||
c_kw[var] = value
|
||||
else:
|
||||
kw[key] = value
|
||||
values = ENV.get_template(__internal_jinja).render(kw)
|
||||
convert = CONVERT_OPTION[__internal_type].get('func', str)
|
||||
if __internal_multi:
|
||||
return [convert(val) for val in values.split(',')]
|
||||
return convert(values)
|
||||
def valid_with_jinja(value, **kwargs):
|
||||
kwargs[kwargs.pop('__internal_key')] = value
|
||||
value = jinja_to_function(__internal_type='string', __internal_multi=False, **kwargs)
|
||||
if value:
|
||||
raise ValueError(value)
|
||||
func.jinja_to_function = jinja_to_function
|
||||
func.valid_with_jinja = valid_with_jinja
|
||||
dict_env = {}
|
||||
dict_env['1.rougail.general.mode_conteneur_actif'] = "{% if mode_conteneur_actif1 == 'non' %}non{% else %}oui{% endif %}"
|
||||
dict_env['1.rougail.general.mode_conteneur_actif2'] = "{% if mode_conteneur_actif1 == \"non\" %}oui{% else %}non{% endif %}"
|
||||
dict_env['2.rougail.general.mode_conteneur_actif'] = "{% if mode_conteneur_actif1 == 'non' %}non{% else %}oui{% endif %}"
|
||||
dict_env['2.rougail.general.mode_conteneur_actif2'] = "{% if mode_conteneur_actif1 == \"non\" %}oui{% else %}non{% endif %}"
|
||||
ENV = SandboxedEnvironment(loader=DictLoader(dict_env), undefined=StrictUndefined)
|
||||
ENV.compile_templates('jinja_caches', zip=None)
|
||||
option_3 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("1.rougail.general.mode_conteneur_actif"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), 'mode_conteneur_actif1': ParamOption(option_3)})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
option_4 = StrOption(name="mode_conteneur_actif2", doc="No change", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("1.rougail.general.mode_conteneur_actif2"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), 'mode_conteneur_actif1': ParamOption(option_3)})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, option_3, option_4], properties=frozenset({"normal"}))
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
optiondescription_9 = OptionDescription(name="1", doc="1", children=[optiondescription_10])
|
||||
option_7 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
option_6 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("2.rougail.general.mode_conteneur_actif"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), 'mode_conteneur_actif1': ParamOption(option_7)})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
option_8 = StrOption(name="mode_conteneur_actif2", doc="No change", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("2.rougail.general.mode_conteneur_actif2"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), 'mode_conteneur_actif1': ParamOption(option_7)})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
optiondescription_5 = OptionDescription(name="general", doc="general", children=[option_6, option_7, option_8], properties=frozenset({"normal"}))
|
||||
optiondescription_12 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_5], properties=frozenset({"normal"}))
|
||||
optiondescription_11 = OptionDescription(name="2", doc="2", children=[optiondescription_12])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_9, optiondescription_11])
|
20
tests/dictionaries/01auto_jinja_if/xml/00-base.xml
Normal file
20
tests/dictionaries/01auto_jinja_if/xml/00-base.xml
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.10">
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True"/>
|
||||
<variable name="mode_conteneur_actif1" type="string" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="mode_conteneur_actif2" type="string" description="No change" hidden="True"/>
|
||||
</family>
|
||||
</variables>
|
||||
<constraints>
|
||||
<fill name="{% if mode_conteneur_actif1 == 'non' %}non{% else %}oui{% endif %}" type="jinja">
|
||||
<target>mode_conteneur_actif</target>
|
||||
</fill>
|
||||
<fill name='{% if mode_conteneur_actif1 == "non" %}oui{% else %}non{% endif %}' type="jinja">
|
||||
<target>mode_conteneur_actif2</target>
|
||||
</fill>
|
||||
</constraints>
|
||||
</rougail>
|
29
tests/dictionaries/01auto_jinja_if/yml/00-base.yml
Normal file
29
tests/dictionaries/01auto_jinja_if/yml/00-base.yml
Normal file
|
@ -0,0 +1,29 @@
|
|||
version: '0.10'
|
||||
variables:
|
||||
- family:
|
||||
- name: general
|
||||
variables:
|
||||
- variable:
|
||||
- name: mode_conteneur_actif
|
||||
type: string
|
||||
description: No change
|
||||
hidden: true
|
||||
- name: mode_conteneur_actif1
|
||||
type: string
|
||||
description: No change
|
||||
value:
|
||||
- text: non
|
||||
- name: mode_conteneur_actif2
|
||||
type: string
|
||||
description: No change
|
||||
hidden: true
|
||||
constraints:
|
||||
- fill:
|
||||
- name: '{% if mode_conteneur_actif1 == ''non'' %}non{% else %}oui{% endif %}'
|
||||
type: jinja
|
||||
target:
|
||||
- text: mode_conteneur_actif
|
||||
- name: '{% if mode_conteneur_actif1 == "non" %}oui{% else %}non{% endif %}'
|
||||
type: jinja
|
||||
target:
|
||||
- text: mode_conteneur_actif2
|
0
tests/dictionaries/01auto_jinja_if_bool/__init__.py
Normal file
0
tests/dictionaries/01auto_jinja_if_bool/__init__.py
Normal file
19
tests/dictionaries/01auto_jinja_if_bool/makedict/after.json
Normal file
19
tests/dictionaries/01auto_jinja_if_bool/makedict/after.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"rougail.general.bool": {
|
||||
"owner": "default",
|
||||
"value": true
|
||||
},
|
||||
"rougail.general.multi1": {
|
||||
"owner": "default",
|
||||
"value": [
|
||||
true,
|
||||
false
|
||||
]
|
||||
},
|
||||
"rougail.general.multi2": {
|
||||
"owner": "default",
|
||||
"value": [
|
||||
false
|
||||
]
|
||||
}
|
||||
}
|
10
tests/dictionaries/01auto_jinja_if_bool/makedict/base.json
Normal file
10
tests/dictionaries/01auto_jinja_if_bool/makedict/base.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"rougail.general.bool": true,
|
||||
"rougail.general.multi1": [
|
||||
true,
|
||||
false
|
||||
],
|
||||
"rougail.general.multi2": [
|
||||
false
|
||||
]
|
||||
}
|
19
tests/dictionaries/01auto_jinja_if_bool/makedict/before.json
Normal file
19
tests/dictionaries/01auto_jinja_if_bool/makedict/before.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"rougail.general.bool": {
|
||||
"owner": "default",
|
||||
"value": true
|
||||
},
|
||||
"rougail.general.multi1": {
|
||||
"owner": "default",
|
||||
"value": [
|
||||
true,
|
||||
false
|
||||
]
|
||||
},
|
||||
"rougail.general.multi2": {
|
||||
"owner": "default",
|
||||
"value": [
|
||||
false
|
||||
]
|
||||
}
|
||||
}
|
62
tests/dictionaries/01auto_jinja_if_bool/tiramisu/base.py
Normal file
62
tests/dictionaries/01auto_jinja_if_bool/tiramisu/base.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||
class func:
|
||||
pass
|
||||
|
||||
def _load_functions(path):
|
||||
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
|
||||
loader = _SourceFileLoader('func', path)
|
||||
spec = _spec_from_loader(loader.name, loader)
|
||||
func_ = _module_from_spec(spec)
|
||||
loader.exec_module(func_)
|
||||
for function in dir(func_):
|
||||
if function.startswith('_'):
|
||||
continue
|
||||
setattr(func, function, getattr(func_, function))
|
||||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
from jinja2 import StrictUndefined, DictLoader
|
||||
from jinja2.sandbox import SandboxedEnvironment
|
||||
from rougail.annotator.variable import CONVERT_OPTION
|
||||
def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, **kwargs):
|
||||
kw = {}
|
||||
for key, value in kwargs.items():
|
||||
if '.' in key:
|
||||
c_kw = kw
|
||||
path, var = key.rsplit('.', 1)
|
||||
for subkey in path.split('.'):
|
||||
c_kw = c_kw.setdefault(subkey, {})
|
||||
c_kw[var] = value
|
||||
else:
|
||||
kw[key] = value
|
||||
values = ENV.get_template(__internal_jinja).render(kw)
|
||||
convert = CONVERT_OPTION[__internal_type].get('func', str)
|
||||
if __internal_multi:
|
||||
return [convert(val) for val in values.split(',')]
|
||||
return convert(values)
|
||||
def valid_with_jinja(value, **kwargs):
|
||||
kwargs[kwargs.pop('__internal_key')] = value
|
||||
value = jinja_to_function(__internal_type='string', __internal_multi=False, **kwargs)
|
||||
if value:
|
||||
raise ValueError(value)
|
||||
func.jinja_to_function = jinja_to_function
|
||||
func.valid_with_jinja = valid_with_jinja
|
||||
dict_env = {}
|
||||
dict_env['rougail.general.multi1'] = "{% if bool %}True,False{% else %}False{% endif %}"
|
||||
dict_env['rougail.general.multi2'] = "{% if not bool %}True,False{% else %}False{% endif %}"
|
||||
ENV = SandboxedEnvironment(loader=DictLoader(dict_env), undefined=StrictUndefined)
|
||||
ENV.compile_templates('jinja_caches', zip=None)
|
||||
option_2 = BoolOption(name="bool", doc="bool", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_3 = BoolOption(name="multi1", doc="multi1", multi=True, default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("rougail.general.multi1"), '__internal_type': ParamValue("boolean"), '__internal_multi': ParamValue(True), 'bool': ParamOption(option_2)})), properties=frozenset({"normal"}))
|
||||
option_4 = BoolOption(name="multi2", doc="multi2", multi=True, default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("rougail.general.multi2"), '__internal_type': ParamValue("boolean"), '__internal_multi': ParamValue(True), 'bool': ParamOption(option_2)})), properties=frozenset({"normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, option_3, option_4], properties=frozenset({"normal"}))
|
||||
optiondescription_5 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_5])
|
71
tests/dictionaries/01auto_jinja_if_bool/tiramisu/multi.py
Normal file
71
tests/dictionaries/01auto_jinja_if_bool/tiramisu/multi.py
Normal file
|
@ -0,0 +1,71 @@
|
|||
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||
class func:
|
||||
pass
|
||||
|
||||
def _load_functions(path):
|
||||
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
|
||||
loader = _SourceFileLoader('func', path)
|
||||
spec = _spec_from_loader(loader.name, loader)
|
||||
func_ = _module_from_spec(spec)
|
||||
loader.exec_module(func_)
|
||||
for function in dir(func_):
|
||||
if function.startswith('_'):
|
||||
continue
|
||||
setattr(func, function, getattr(func_, function))
|
||||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
from jinja2 import StrictUndefined, DictLoader
|
||||
from jinja2.sandbox import SandboxedEnvironment
|
||||
from rougail.annotator.variable import CONVERT_OPTION
|
||||
def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, **kwargs):
|
||||
kw = {}
|
||||
for key, value in kwargs.items():
|
||||
if '.' in key:
|
||||
c_kw = kw
|
||||
path, var = key.rsplit('.', 1)
|
||||
for subkey in path.split('.'):
|
||||
c_kw = c_kw.setdefault(subkey, {})
|
||||
c_kw[var] = value
|
||||
else:
|
||||
kw[key] = value
|
||||
values = ENV.get_template(__internal_jinja).render(kw)
|
||||
convert = CONVERT_OPTION[__internal_type].get('func', str)
|
||||
if __internal_multi:
|
||||
return [convert(val) for val in values.split(',')]
|
||||
return convert(values)
|
||||
def valid_with_jinja(value, **kwargs):
|
||||
kwargs[kwargs.pop('__internal_key')] = value
|
||||
value = jinja_to_function(__internal_type='string', __internal_multi=False, **kwargs)
|
||||
if value:
|
||||
raise ValueError(value)
|
||||
func.jinja_to_function = jinja_to_function
|
||||
func.valid_with_jinja = valid_with_jinja
|
||||
dict_env = {}
|
||||
dict_env['1.rougail.general.multi1'] = "{% if bool %}True,False{% else %}False{% endif %}"
|
||||
dict_env['1.rougail.general.multi2'] = "{% if not bool %}True,False{% else %}False{% endif %}"
|
||||
dict_env['2.rougail.general.multi1'] = "{% if bool %}True,False{% else %}False{% endif %}"
|
||||
dict_env['2.rougail.general.multi2'] = "{% if not bool %}True,False{% else %}False{% endif %}"
|
||||
ENV = SandboxedEnvironment(loader=DictLoader(dict_env), undefined=StrictUndefined)
|
||||
ENV.compile_templates('jinja_caches', zip=None)
|
||||
option_2 = BoolOption(name="bool", doc="bool", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_3 = BoolOption(name="multi1", doc="multi1", multi=True, default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("1.rougail.general.multi1"), '__internal_type': ParamValue("boolean"), '__internal_multi': ParamValue(True), 'bool': ParamOption(option_2)})), properties=frozenset({"normal"}))
|
||||
option_4 = BoolOption(name="multi2", doc="multi2", multi=True, default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("1.rougail.general.multi2"), '__internal_type': ParamValue("boolean"), '__internal_multi': ParamValue(True), 'bool': ParamOption(option_2)})), properties=frozenset({"normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, option_3, option_4], properties=frozenset({"normal"}))
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
optiondescription_9 = OptionDescription(name="1", doc="1", children=[optiondescription_10])
|
||||
option_6 = BoolOption(name="bool", doc="bool", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_7 = BoolOption(name="multi1", doc="multi1", multi=True, default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("2.rougail.general.multi1"), '__internal_type': ParamValue("boolean"), '__internal_multi': ParamValue(True), 'bool': ParamOption(option_6)})), properties=frozenset({"normal"}))
|
||||
option_8 = BoolOption(name="multi2", doc="multi2", multi=True, default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("2.rougail.general.multi2"), '__internal_type': ParamValue("boolean"), '__internal_multi': ParamValue(True), 'bool': ParamOption(option_6)})), properties=frozenset({"normal"}))
|
||||
optiondescription_5 = OptionDescription(name="general", doc="general", children=[option_6, option_7, option_8], properties=frozenset({"normal"}))
|
||||
optiondescription_12 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_5], properties=frozenset({"normal"}))
|
||||
optiondescription_11 = OptionDescription(name="2", doc="2", children=[optiondescription_12])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_9, optiondescription_11])
|
18
tests/dictionaries/01auto_jinja_if_bool/xml/00-base.xml
Normal file
18
tests/dictionaries/01auto_jinja_if_bool/xml/00-base.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.10">
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="bool" type="boolean"/>
|
||||
<variable name="multi1" type="boolean" multi="True"/>
|
||||
<variable name="multi2" type="boolean" multi="True"/>
|
||||
</family>
|
||||
</variables>
|
||||
<constraints>
|
||||
<fill name="{% if bool %}True,False{% else %}False{% endif %}" type="jinja">
|
||||
<target>multi1</target>
|
||||
</fill>
|
||||
<fill name="{% if not bool %}True,False{% else %}False{% endif %}" type="jinja">
|
||||
<target>multi2</target>
|
||||
</fill>
|
||||
</constraints>
|
||||
</rougail>
|
24
tests/dictionaries/01auto_jinja_if_bool/yml/00-base.yml
Normal file
24
tests/dictionaries/01auto_jinja_if_bool/yml/00-base.yml
Normal file
|
@ -0,0 +1,24 @@
|
|||
version: '0.10'
|
||||
variables:
|
||||
- family:
|
||||
- name: general
|
||||
variables:
|
||||
- variable:
|
||||
- name: bool
|
||||
type: boolean
|
||||
- name: multi1
|
||||
type: boolean
|
||||
multi: true
|
||||
- name: multi2
|
||||
type: boolean
|
||||
multi: true
|
||||
constraints:
|
||||
- fill:
|
||||
- name: '{% if bool %}True,False{% else %}False{% endif %}'
|
||||
type: jinja
|
||||
target:
|
||||
- text: multi1
|
||||
- name: '{% if not bool %}True,False{% else %}False{% endif %}'
|
||||
type: jinja
|
||||
target:
|
||||
- text: multi2
|
0
tests/dictionaries/01auto_jinja_if_int/__init__.py
Normal file
0
tests/dictionaries/01auto_jinja_if_int/__init__.py
Normal file
14
tests/dictionaries/01auto_jinja_if_int/makedict/after.json
Normal file
14
tests/dictionaries/01auto_jinja_if_int/makedict/after.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"rougail.bool": {
|
||||
"owner": "default",
|
||||
"value": true
|
||||
},
|
||||
"rougail.int1": {
|
||||
"owner": "default",
|
||||
"value": 1
|
||||
},
|
||||
"rougail.int2": {
|
||||
"owner": "default",
|
||||
"value": 4
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"rougail.bool": true,
|
||||
"rougail.int1": 1,
|
||||
"rougail.int2": 4
|
||||
}
|
14
tests/dictionaries/01auto_jinja_if_int/makedict/before.json
Normal file
14
tests/dictionaries/01auto_jinja_if_int/makedict/before.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"rougail.bool": {
|
||||
"owner": "default",
|
||||
"value": true
|
||||
},
|
||||
"rougail.int1": {
|
||||
"owner": "default",
|
||||
"value": 1
|
||||
},
|
||||
"rougail.int2": {
|
||||
"owner": "default",
|
||||
"value": 4
|
||||
}
|
||||
}
|
61
tests/dictionaries/01auto_jinja_if_int/tiramisu/base.py
Normal file
61
tests/dictionaries/01auto_jinja_if_int/tiramisu/base.py
Normal file
|
@ -0,0 +1,61 @@
|
|||
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||
class func:
|
||||
pass
|
||||
|
||||
def _load_functions(path):
|
||||
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
|
||||
loader = _SourceFileLoader('func', path)
|
||||
spec = _spec_from_loader(loader.name, loader)
|
||||
func_ = _module_from_spec(spec)
|
||||
loader.exec_module(func_)
|
||||
for function in dir(func_):
|
||||
if function.startswith('_'):
|
||||
continue
|
||||
setattr(func, function, getattr(func_, function))
|
||||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
from jinja2 import StrictUndefined, DictLoader
|
||||
from jinja2.sandbox import SandboxedEnvironment
|
||||
from rougail.annotator.variable import CONVERT_OPTION
|
||||
def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, **kwargs):
|
||||
kw = {}
|
||||
for key, value in kwargs.items():
|
||||
if '.' in key:
|
||||
c_kw = kw
|
||||
path, var = key.rsplit('.', 1)
|
||||
for subkey in path.split('.'):
|
||||
c_kw = c_kw.setdefault(subkey, {})
|
||||
c_kw[var] = value
|
||||
else:
|
||||
kw[key] = value
|
||||
values = ENV.get_template(__internal_jinja).render(kw)
|
||||
convert = CONVERT_OPTION[__internal_type].get('func', str)
|
||||
if __internal_multi:
|
||||
return [convert(val) for val in values.split(',')]
|
||||
return convert(values)
|
||||
def valid_with_jinja(value, **kwargs):
|
||||
kwargs[kwargs.pop('__internal_key')] = value
|
||||
value = jinja_to_function(__internal_type='string', __internal_multi=False, **kwargs)
|
||||
if value:
|
||||
raise ValueError(value)
|
||||
func.jinja_to_function = jinja_to_function
|
||||
func.valid_with_jinja = valid_with_jinja
|
||||
dict_env = {}
|
||||
dict_env['rougail.int1'] = "{% if bool %}1{% else %}2{% endif %}"
|
||||
dict_env['rougail.int2'] = "{% if not bool %}3{% else %}4{% endif %}"
|
||||
ENV = SandboxedEnvironment(loader=DictLoader(dict_env), undefined=StrictUndefined)
|
||||
ENV.compile_templates('jinja_caches', zip=None)
|
||||
option_1 = BoolOption(name="bool", doc="bool", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = IntOption(name="int1", doc="int1", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("rougail.int1"), '__internal_type': ParamValue("number"), '__internal_multi': ParamValue(False), 'bool': ParamOption(option_1)})), properties=frozenset({"normal"}))
|
||||
option_3 = IntOption(name="int2", doc="int2", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("rougail.int2"), '__internal_type': ParamValue("number"), '__internal_multi': ParamValue(False), 'bool': ParamOption(option_1)})), properties=frozenset({"normal"}))
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2, option_3], properties=frozenset({"normal"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_4])
|
69
tests/dictionaries/01auto_jinja_if_int/tiramisu/multi.py
Normal file
69
tests/dictionaries/01auto_jinja_if_int/tiramisu/multi.py
Normal file
|
@ -0,0 +1,69 @@
|
|||
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||
class func:
|
||||
pass
|
||||
|
||||
def _load_functions(path):
|
||||
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
|
||||
loader = _SourceFileLoader('func', path)
|
||||
spec = _spec_from_loader(loader.name, loader)
|
||||
func_ = _module_from_spec(spec)
|
||||
loader.exec_module(func_)
|
||||
for function in dir(func_):
|
||||
if function.startswith('_'):
|
||||
continue
|
||||
setattr(func, function, getattr(func_, function))
|
||||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
from jinja2 import StrictUndefined, DictLoader
|
||||
from jinja2.sandbox import SandboxedEnvironment
|
||||
from rougail.annotator.variable import CONVERT_OPTION
|
||||
def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, **kwargs):
|
||||
kw = {}
|
||||
for key, value in kwargs.items():
|
||||
if '.' in key:
|
||||
c_kw = kw
|
||||
path, var = key.rsplit('.', 1)
|
||||
for subkey in path.split('.'):
|
||||
c_kw = c_kw.setdefault(subkey, {})
|
||||
c_kw[var] = value
|
||||
else:
|
||||
kw[key] = value
|
||||
values = ENV.get_template(__internal_jinja).render(kw)
|
||||
convert = CONVERT_OPTION[__internal_type].get('func', str)
|
||||
if __internal_multi:
|
||||
return [convert(val) for val in values.split(',')]
|
||||
return convert(values)
|
||||
def valid_with_jinja(value, **kwargs):
|
||||
kwargs[kwargs.pop('__internal_key')] = value
|
||||
value = jinja_to_function(__internal_type='string', __internal_multi=False, **kwargs)
|
||||
if value:
|
||||
raise ValueError(value)
|
||||
func.jinja_to_function = jinja_to_function
|
||||
func.valid_with_jinja = valid_with_jinja
|
||||
dict_env = {}
|
||||
dict_env['1.rougail.int1'] = "{% if bool %}1{% else %}2{% endif %}"
|
||||
dict_env['1.rougail.int2'] = "{% if not bool %}3{% else %}4{% endif %}"
|
||||
dict_env['2.rougail.int1'] = "{% if bool %}1{% else %}2{% endif %}"
|
||||
dict_env['2.rougail.int2'] = "{% if not bool %}3{% else %}4{% endif %}"
|
||||
ENV = SandboxedEnvironment(loader=DictLoader(dict_env), undefined=StrictUndefined)
|
||||
ENV.compile_templates('jinja_caches', zip=None)
|
||||
option_1 = BoolOption(name="bool", doc="bool", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = IntOption(name="int1", doc="int1", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("1.rougail.int1"), '__internal_type': ParamValue("number"), '__internal_multi': ParamValue(False), 'bool': ParamOption(option_1)})), properties=frozenset({"normal"}))
|
||||
option_3 = IntOption(name="int2", doc="int2", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("1.rougail.int2"), '__internal_type': ParamValue("number"), '__internal_multi': ParamValue(False), 'bool': ParamOption(option_1)})), properties=frozenset({"normal"}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2, option_3], properties=frozenset({"normal"}))
|
||||
optiondescription_7 = OptionDescription(name="1", doc="1", children=[optiondescription_8])
|
||||
option_4 = BoolOption(name="bool", doc="bool", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_5 = IntOption(name="int1", doc="int1", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("2.rougail.int1"), '__internal_type': ParamValue("number"), '__internal_multi': ParamValue(False), 'bool': ParamOption(option_4)})), properties=frozenset({"normal"}))
|
||||
option_6 = IntOption(name="int2", doc="int2", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("2.rougail.int2"), '__internal_type': ParamValue("number"), '__internal_multi': ParamValue(False), 'bool': ParamOption(option_4)})), properties=frozenset({"normal"}))
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[option_4, option_5, option_6], properties=frozenset({"normal"}))
|
||||
optiondescription_9 = OptionDescription(name="2", doc="2", children=[optiondescription_10])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_7, optiondescription_9])
|
16
tests/dictionaries/01auto_jinja_if_int/xml/00-base.xml
Normal file
16
tests/dictionaries/01auto_jinja_if_int/xml/00-base.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.10">
|
||||
<variables>
|
||||
<variable name="bool" type="boolean"/>
|
||||
<variable name="int1" type="number"/>
|
||||
<variable name="int2" type="number"/>
|
||||
</variables>
|
||||
<constraints>
|
||||
<fill name="{% if bool %}1{% else %}2{% endif %}" type="jinja">
|
||||
<target>int1</target>
|
||||
</fill>
|
||||
<fill name="{% if not bool %}3{% else %}4{% endif %}" type="jinja">
|
||||
<target>int2</target>
|
||||
</fill>
|
||||
</constraints>
|
||||
</rougail>
|
19
tests/dictionaries/01auto_jinja_if_int/yml/00-base.yml
Normal file
19
tests/dictionaries/01auto_jinja_if_int/yml/00-base.yml
Normal file
|
@ -0,0 +1,19 @@
|
|||
version: '0.10'
|
||||
variables:
|
||||
- variable:
|
||||
- name: bool
|
||||
type: boolean
|
||||
- name: int1
|
||||
type: number
|
||||
- name: int2
|
||||
type: number
|
||||
constraints:
|
||||
- fill:
|
||||
- name: '{% if bool %}1{% else %}2{% endif %}'
|
||||
type: jinja
|
||||
target:
|
||||
- text: int1
|
||||
- name: '{% if not bool %}3{% else %}4{% endif %}'
|
||||
type: jinja
|
||||
target:
|
||||
- text: int2
|
0
tests/dictionaries/01auto_jinja_set/__init__.py
Normal file
0
tests/dictionaries/01auto_jinja_set/__init__.py
Normal file
14
tests/dictionaries/01auto_jinja_set/makedict/after.json
Normal file
14
tests/dictionaries/01auto_jinja_set/makedict/after.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"rougail.bool": {
|
||||
"owner": "default",
|
||||
"value": true
|
||||
},
|
||||
"rougail.int1": {
|
||||
"owner": "default",
|
||||
"value": 1
|
||||
},
|
||||
"rougail.int2": {
|
||||
"owner": "default",
|
||||
"value": 4
|
||||
}
|
||||
}
|
5
tests/dictionaries/01auto_jinja_set/makedict/base.json
Normal file
5
tests/dictionaries/01auto_jinja_set/makedict/base.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"rougail.bool": true,
|
||||
"rougail.int1": 1,
|
||||
"rougail.int2": 4
|
||||
}
|
14
tests/dictionaries/01auto_jinja_set/makedict/before.json
Normal file
14
tests/dictionaries/01auto_jinja_set/makedict/before.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"rougail.bool": {
|
||||
"owner": "default",
|
||||
"value": true
|
||||
},
|
||||
"rougail.int1": {
|
||||
"owner": "default",
|
||||
"value": 1
|
||||
},
|
||||
"rougail.int2": {
|
||||
"owner": "default",
|
||||
"value": 4
|
||||
}
|
||||
}
|
61
tests/dictionaries/01auto_jinja_set/tiramisu/base.py
Normal file
61
tests/dictionaries/01auto_jinja_set/tiramisu/base.py
Normal file
|
@ -0,0 +1,61 @@
|
|||
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||
class func:
|
||||
pass
|
||||
|
||||
def _load_functions(path):
|
||||
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
|
||||
loader = _SourceFileLoader('func', path)
|
||||
spec = _spec_from_loader(loader.name, loader)
|
||||
func_ = _module_from_spec(spec)
|
||||
loader.exec_module(func_)
|
||||
for function in dir(func_):
|
||||
if function.startswith('_'):
|
||||
continue
|
||||
setattr(func, function, getattr(func_, function))
|
||||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
from jinja2 import StrictUndefined, DictLoader
|
||||
from jinja2.sandbox import SandboxedEnvironment
|
||||
from rougail.annotator.variable import CONVERT_OPTION
|
||||
def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, **kwargs):
|
||||
kw = {}
|
||||
for key, value in kwargs.items():
|
||||
if '.' in key:
|
||||
c_kw = kw
|
||||
path, var = key.rsplit('.', 1)
|
||||
for subkey in path.split('.'):
|
||||
c_kw = c_kw.setdefault(subkey, {})
|
||||
c_kw[var] = value
|
||||
else:
|
||||
kw[key] = value
|
||||
values = ENV.get_template(__internal_jinja).render(kw)
|
||||
convert = CONVERT_OPTION[__internal_type].get('func', str)
|
||||
if __internal_multi:
|
||||
return [convert(val) for val in values.split(',')]
|
||||
return convert(values)
|
||||
def valid_with_jinja(value, **kwargs):
|
||||
kwargs[kwargs.pop('__internal_key')] = value
|
||||
value = jinja_to_function(__internal_type='string', __internal_multi=False, **kwargs)
|
||||
if value:
|
||||
raise ValueError(value)
|
||||
func.jinja_to_function = jinja_to_function
|
||||
func.valid_with_jinja = valid_with_jinja
|
||||
dict_env = {}
|
||||
dict_env['rougail.int1'] = "{%set bool1 = bool %}{% if bool1 %}1{% else %}2{% endif %}"
|
||||
dict_env['rougail.int2'] = "{%set bool1 = bool %}{% if not bool1 %}3{% else %}4{% endif %}"
|
||||
ENV = SandboxedEnvironment(loader=DictLoader(dict_env), undefined=StrictUndefined)
|
||||
ENV.compile_templates('jinja_caches', zip=None)
|
||||
option_1 = BoolOption(name="bool", doc="bool", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = IntOption(name="int1", doc="int1", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("rougail.int1"), '__internal_type': ParamValue("number"), '__internal_multi': ParamValue(False), 'bool': ParamOption(option_1)})), properties=frozenset({"normal"}))
|
||||
option_3 = IntOption(name="int2", doc="int2", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("rougail.int2"), '__internal_type': ParamValue("number"), '__internal_multi': ParamValue(False), 'bool': ParamOption(option_1)})), properties=frozenset({"normal"}))
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2, option_3], properties=frozenset({"normal"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_4])
|
69
tests/dictionaries/01auto_jinja_set/tiramisu/multi.py
Normal file
69
tests/dictionaries/01auto_jinja_set/tiramisu/multi.py
Normal file
|
@ -0,0 +1,69 @@
|
|||
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||
class func:
|
||||
pass
|
||||
|
||||
def _load_functions(path):
|
||||
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
|
||||
loader = _SourceFileLoader('func', path)
|
||||
spec = _spec_from_loader(loader.name, loader)
|
||||
func_ = _module_from_spec(spec)
|
||||
loader.exec_module(func_)
|
||||
for function in dir(func_):
|
||||
if function.startswith('_'):
|
||||
continue
|
||||
setattr(func, function, getattr(func_, function))
|
||||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
from jinja2 import StrictUndefined, DictLoader
|
||||
from jinja2.sandbox import SandboxedEnvironment
|
||||
from rougail.annotator.variable import CONVERT_OPTION
|
||||
def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, **kwargs):
|
||||
kw = {}
|
||||
for key, value in kwargs.items():
|
||||
if '.' in key:
|
||||
c_kw = kw
|
||||
path, var = key.rsplit('.', 1)
|
||||
for subkey in path.split('.'):
|
||||
c_kw = c_kw.setdefault(subkey, {})
|
||||
c_kw[var] = value
|
||||
else:
|
||||
kw[key] = value
|
||||
values = ENV.get_template(__internal_jinja).render(kw)
|
||||
convert = CONVERT_OPTION[__internal_type].get('func', str)
|
||||
if __internal_multi:
|
||||
return [convert(val) for val in values.split(',')]
|
||||
return convert(values)
|
||||
def valid_with_jinja(value, **kwargs):
|
||||
kwargs[kwargs.pop('__internal_key')] = value
|
||||
value = jinja_to_function(__internal_type='string', __internal_multi=False, **kwargs)
|
||||
if value:
|
||||
raise ValueError(value)
|
||||
func.jinja_to_function = jinja_to_function
|
||||
func.valid_with_jinja = valid_with_jinja
|
||||
dict_env = {}
|
||||
dict_env['1.rougail.int1'] = "{%set bool1 = bool %}{% if bool1 %}1{% else %}2{% endif %}"
|
||||
dict_env['1.rougail.int2'] = "{%set bool1 = bool %}{% if not bool1 %}3{% else %}4{% endif %}"
|
||||
dict_env['2.rougail.int1'] = "{%set bool1 = bool %}{% if bool1 %}1{% else %}2{% endif %}"
|
||||
dict_env['2.rougail.int2'] = "{%set bool1 = bool %}{% if not bool1 %}3{% else %}4{% endif %}"
|
||||
ENV = SandboxedEnvironment(loader=DictLoader(dict_env), undefined=StrictUndefined)
|
||||
ENV.compile_templates('jinja_caches', zip=None)
|
||||
option_1 = BoolOption(name="bool", doc="bool", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = IntOption(name="int1", doc="int1", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("1.rougail.int1"), '__internal_type': ParamValue("number"), '__internal_multi': ParamValue(False), 'bool': ParamOption(option_1)})), properties=frozenset({"normal"}))
|
||||
option_3 = IntOption(name="int2", doc="int2", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("1.rougail.int2"), '__internal_type': ParamValue("number"), '__internal_multi': ParamValue(False), 'bool': ParamOption(option_1)})), properties=frozenset({"normal"}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2, option_3], properties=frozenset({"normal"}))
|
||||
optiondescription_7 = OptionDescription(name="1", doc="1", children=[optiondescription_8])
|
||||
option_4 = BoolOption(name="bool", doc="bool", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_5 = IntOption(name="int1", doc="int1", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("2.rougail.int1"), '__internal_type': ParamValue("number"), '__internal_multi': ParamValue(False), 'bool': ParamOption(option_4)})), properties=frozenset({"normal"}))
|
||||
option_6 = IntOption(name="int2", doc="int2", default=Calculation(func.jinja_to_function, Params((), kwargs={'__internal_jinja': ParamValue("2.rougail.int2"), '__internal_type': ParamValue("number"), '__internal_multi': ParamValue(False), 'bool': ParamOption(option_4)})), properties=frozenset({"normal"}))
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[option_4, option_5, option_6], properties=frozenset({"normal"}))
|
||||
optiondescription_9 = OptionDescription(name="2", doc="2", children=[optiondescription_10])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_7, optiondescription_9])
|
16
tests/dictionaries/01auto_jinja_set/xml/00-base.xml
Normal file
16
tests/dictionaries/01auto_jinja_set/xml/00-base.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.10">
|
||||
<variables>
|
||||
<variable name="bool" type="boolean"/>
|
||||
<variable name="int1" type="number"/>
|
||||
<variable name="int2" type="number"/>
|
||||
</variables>
|
||||
<constraints>
|
||||
<fill name="{%set bool1 = bool %}{% if bool1 %}1{% else %}2{% endif %}" type="jinja">
|
||||
<target>int1</target>
|
||||
</fill>
|
||||
<fill name="{%set bool1 = bool %}{% if not bool1 %}3{% else %}4{% endif %}" type="jinja">
|
||||
<target>int2</target>
|
||||
</fill>
|
||||
</constraints>
|
||||
</rougail>
|
19
tests/dictionaries/01auto_jinja_set/yml/00-base.yml
Normal file
19
tests/dictionaries/01auto_jinja_set/yml/00-base.yml
Normal file
|
@ -0,0 +1,19 @@
|
|||
version: '0.10'
|
||||
variables:
|
||||
- variable:
|
||||
- name: bool
|
||||
type: boolean
|
||||
- name: int1
|
||||
type: number
|
||||
- name: int2
|
||||
type: number
|
||||
constraints:
|
||||
- fill:
|
||||
- name: '{%set bool1 = bool %}{% if bool1 %}1{% else %}2{% endif %}'
|
||||
type: jinja
|
||||
target:
|
||||
- text: int1
|
||||
- name: '{%set bool1 = bool %}{% if not bool1 %}3{% else %}4{% endif %}'
|
||||
type: jinja
|
||||
target:
|
||||
- text: int2
|
|
@ -16,10 +16,15 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params(())), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
option_3 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, option_3], properties=frozenset({"normal"}))
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_4 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_4])
|
||||
|
|
|
@ -16,16 +16,21 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params(())), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
option_3 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, option_3], properties=frozenset({"normal"}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
optiondescription_7 = OptionDescription(name="1", doc="1", children=[optiondescription_8])
|
||||
option_5 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params(())), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
|
||||
option_6 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_4 = OptionDescription(name="general", doc="general", children=[option_5, option_6], properties=frozenset({"normal"}))
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_4])
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_4], properties=frozenset({"normal"}))
|
||||
optiondescription_9 = OptionDescription(name="2", doc="2", children=[optiondescription_10])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_7, optiondescription_9])
|
||||
|
|
|
@ -16,10 +16,15 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_1 = DomainnameOption(name="server_name", doc="server_name", default="example.net", type='domainname', allow_ip=False, properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[option_1])
|
||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[option_1], properties=frozenset({"normal"}))
|
||||
option_6 = SymLinkOption(name="domain", opt=option_1)
|
||||
option_7 = StrOption(name="name", doc="name", default="certificate")
|
||||
option_8 = UsernameOption(name="owner", doc="owner", default="example")
|
||||
|
|
|
@ -16,10 +16,15 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_1 = DomainnameOption(name="server_name", doc="server_name", default="example.net", type='domainname', allow_ip=False, properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_20 = OptionDescription(name="rougail", doc="Rougail", children=[option_1])
|
||||
optiondescription_20 = OptionDescription(name="rougail", doc="Rougail", children=[option_1], properties=frozenset({"normal"}))
|
||||
option_7 = SymLinkOption(name="domain", opt=option_1)
|
||||
option_8 = StrOption(name="name", doc="name", default="certificate")
|
||||
option_9 = UsernameOption(name="owner", doc="owner", default="example")
|
||||
|
@ -36,7 +41,7 @@ optiondescription_22.impl_set_information('type', "service")
|
|||
optiondescription_21 = OptionDescription(name="services", doc="services", children=[optiondescription_22], properties=frozenset({"hidden"}))
|
||||
optiondescription_19 = OptionDescription(name="1", doc="1", children=[optiondescription_20, optiondescription_21])
|
||||
option_2 = DomainnameOption(name="server_name", doc="server_name", default="example.net", type='domainname', allow_ip=False, properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_24 = OptionDescription(name="rougail", doc="Rougail", children=[option_2])
|
||||
optiondescription_24 = OptionDescription(name="rougail", doc="Rougail", children=[option_2], properties=frozenset({"normal"}))
|
||||
option_15 = SymLinkOption(name="domain", opt=option_2)
|
||||
option_16 = StrOption(name="name", doc="name", default="certificate")
|
||||
option_17 = UsernameOption(name="owner", doc="owner", default="example")
|
||||
|
|
|
@ -16,11 +16,16 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_1 = UsernameOption(name="owner", doc="owner", default="example", properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = DomainnameOption(name="server_name", doc="server_name", default="example.net", type='domainname', allow_ip=False, properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_11 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2])
|
||||
optiondescription_11 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2], properties=frozenset({"normal"}))
|
||||
option_7 = SymLinkOption(name="domain", opt=option_2)
|
||||
option_8 = StrOption(name="name", doc="name", default="certificate")
|
||||
option_9 = SymLinkOption(name="owner", opt=option_1)
|
||||
|
|
|
@ -16,11 +16,16 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_1 = UsernameOption(name="owner", doc="owner", default="example", properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = DomainnameOption(name="server_name", doc="server_name", default="example.net", type='domainname', allow_ip=False, properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_22 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2])
|
||||
optiondescription_22 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2], properties=frozenset({"normal"}))
|
||||
option_9 = SymLinkOption(name="domain", opt=option_2)
|
||||
option_10 = StrOption(name="name", doc="name", default="certificate")
|
||||
option_11 = SymLinkOption(name="owner", opt=option_1)
|
||||
|
@ -38,7 +43,7 @@ optiondescription_23 = OptionDescription(name="services", doc="services", childr
|
|||
optiondescription_21 = OptionDescription(name="1", doc="1", children=[optiondescription_22, optiondescription_23])
|
||||
option_3 = UsernameOption(name="owner", doc="owner", default="example", properties=frozenset({"mandatory", "normal"}))
|
||||
option_4 = DomainnameOption(name="server_name", doc="server_name", default="example.net", type='domainname', allow_ip=False, properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_26 = OptionDescription(name="rougail", doc="Rougail", children=[option_3, option_4])
|
||||
optiondescription_26 = OptionDescription(name="rougail", doc="Rougail", children=[option_3, option_4], properties=frozenset({"normal"}))
|
||||
option_17 = SymLinkOption(name="domain", opt=option_4)
|
||||
option_18 = StrOption(name="name", doc="name", default="certificate")
|
||||
option_19 = SymLinkOption(name="owner", opt=option_3)
|
||||
|
|
|
@ -16,9 +16,14 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = DomainnameOption(name="domain", doc="Description", default="my.domain.name", type='domainname', allow_ip=False, properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_3 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_3 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_3])
|
||||
|
|
|
@ -16,14 +16,19 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = DomainnameOption(name="domain", doc="Description", default="my.domain.name", type='domainname', allow_ip=False, properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
optiondescription_5 = OptionDescription(name="1", doc="1", children=[optiondescription_6])
|
||||
option_4 = DomainnameOption(name="domain", doc="Description", default="my.domain.name", type='domainname', allow_ip=False, properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_3 = OptionDescription(name="general", doc="general", children=[option_4], properties=frozenset({"normal"}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3])
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3], properties=frozenset({"normal"}))
|
||||
optiondescription_7 = OptionDescription(name="2", doc="2", children=[optiondescription_8])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_5, optiondescription_7])
|
||||
|
|
|
@ -16,11 +16,16 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_14 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_14 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_7 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_8 = StrOption(name="source", doc="source", default="file")
|
||||
option_6 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
|
|
@ -16,11 +16,16 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_28 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_28 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_9 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_10 = StrOption(name="source", doc="source", default="file")
|
||||
option_8 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
@ -39,7 +44,7 @@ optiondescription_29 = OptionDescription(name="services", doc="services", childr
|
|||
optiondescription_27 = OptionDescription(name="1", doc="1", children=[optiondescription_28, optiondescription_29])
|
||||
option_4 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_3 = OptionDescription(name="general", doc="general", children=[option_4], properties=frozenset({"normal"}))
|
||||
optiondescription_32 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3])
|
||||
optiondescription_32 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3], properties=frozenset({"normal"}))
|
||||
option_20 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_21 = StrOption(name="source", doc="source", default="file")
|
||||
option_19 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
|
|
@ -16,11 +16,16 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_18 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_18 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_7 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_8 = StrOption(name="source", doc="source", default="file")
|
||||
option_6 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
|
|
@ -16,11 +16,16 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_36 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_36 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_9 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_10 = StrOption(name="source", doc="source", default="file")
|
||||
option_8 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
@ -43,7 +48,7 @@ optiondescription_37 = OptionDescription(name="services", doc="services", childr
|
|||
optiondescription_35 = OptionDescription(name="1", doc="1", children=[optiondescription_36, optiondescription_37])
|
||||
option_4 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_3 = OptionDescription(name="general", doc="general", children=[option_4], properties=frozenset({"normal"}))
|
||||
optiondescription_40 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3])
|
||||
optiondescription_40 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3], properties=frozenset({"normal"}))
|
||||
option_24 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_25 = StrOption(name="source", doc="source", default="file")
|
||||
option_23 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
|
|
@ -16,11 +16,16 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_14 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_14 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_7 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_8 = StrOption(name="source", doc="source", default="file")
|
||||
option_6 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
|
|
@ -16,11 +16,16 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_28 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_28 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_9 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_10 = StrOption(name="source", doc="source", default="file")
|
||||
option_8 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
@ -39,7 +44,7 @@ optiondescription_29 = OptionDescription(name="services", doc="services", childr
|
|||
optiondescription_27 = OptionDescription(name="1", doc="1", children=[optiondescription_28, optiondescription_29])
|
||||
option_4 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_3 = OptionDescription(name="general", doc="general", children=[option_4], properties=frozenset({"normal"}))
|
||||
optiondescription_32 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3])
|
||||
optiondescription_32 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3], properties=frozenset({"normal"}))
|
||||
option_20 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_21 = StrOption(name="source", doc="source", default="file")
|
||||
option_19 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
|
|
@ -16,11 +16,16 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_18 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_18 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_7 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_8 = StrOption(name="source", doc="source", default="file")
|
||||
option_6 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
|
|
@ -16,11 +16,16 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_36 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_36 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_9 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_10 = StrOption(name="source", doc="source", default="file")
|
||||
option_8 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
@ -44,7 +49,7 @@ optiondescription_37 = OptionDescription(name="services", doc="services", childr
|
|||
optiondescription_35 = OptionDescription(name="1", doc="1", children=[optiondescription_36, optiondescription_37])
|
||||
option_4 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_3 = OptionDescription(name="general", doc="general", children=[option_4], properties=frozenset({"normal"}))
|
||||
optiondescription_40 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3])
|
||||
optiondescription_40 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3], properties=frozenset({"normal"}))
|
||||
option_24 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_25 = StrOption(name="source", doc="source", default="file")
|
||||
option_23 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
|
|
@ -16,11 +16,16 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_18 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_18 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_7 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_8 = StrOption(name="source", doc="source", default="file")
|
||||
option_6 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
|
|
@ -16,11 +16,16 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_36 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_36 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_9 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_10 = StrOption(name="source", doc="source", default="file")
|
||||
option_8 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
@ -44,7 +49,7 @@ optiondescription_37 = OptionDescription(name="services", doc="services", childr
|
|||
optiondescription_35 = OptionDescription(name="1", doc="1", children=[optiondescription_36, optiondescription_37])
|
||||
option_4 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_3 = OptionDescription(name="general", doc="general", children=[option_4], properties=frozenset({"normal"}))
|
||||
optiondescription_40 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3])
|
||||
optiondescription_40 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_3], properties=frozenset({"normal"}))
|
||||
option_24 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_25 = StrOption(name="source", doc="source", default="file")
|
||||
option_23 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
|
|
@ -16,8 +16,13 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_5 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_6 = StrOption(name="source", doc="source", default="file")
|
||||
option_4 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
|
|
@ -16,8 +16,13 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_5 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_6 = StrOption(name="source", doc="source", default="file")
|
||||
option_4 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
|
|
@ -16,8 +16,13 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_5 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_6 = StrOption(name="source", doc="source", default="file")
|
||||
option_4 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
|
|
@ -16,8 +16,13 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_5 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_6 = StrOption(name="source", doc="source", default="file")
|
||||
option_4 = BoolOption(name="activate", doc="activate", default=True)
|
||||
|
|
|
@ -16,11 +16,16 @@ def _load_functions(path):
|
|||
_load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
from tiramisu4 import *
|
||||
from tiramisu4.setting import ALLOWED_LEADER_PROPERTIES
|
||||
except:
|
||||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("normal")
|
||||
ALLOWED_LEADER_PROPERTIES.add("expert")
|
||||
option_2 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2], properties=frozenset({"normal"}))
|
||||
optiondescription_18 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||
optiondescription_18 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1], properties=frozenset({"normal"}))
|
||||
option_7 = UsernameOption(name="group", doc="group", default="nobody")
|
||||
option_8 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||
option_9 = UsernameOption(name="owner", doc="owner", default="nobody")
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue