Compare commits

..

No commits in common. "71b9b7075525415e8dce75d90d10905a2ca7eb50" and "d395f4a17b6949d694bf79e60e91187df2e541c3" have entirely different histories.

62 changed files with 85 additions and 559 deletions

View File

@ -126,8 +126,7 @@ class ConstrainteAnnotator:
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
raise DictConsistencyError(_(f'valid_enum define in {xmlfiles} but already set in {old_xmlfiles} for "{check.target}", did you forget remove_check?'), 3)
if not hasattr(check, 'param'):
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
raise DictConsistencyError(_(f'param is mandatory for a valid_enum of variable "{check.target}" in {xmlfiles}'), 4)
raise DictConsistencyError(_(f'param is mandatory for a valid_enum of variable {check.target}'), 4)
variable = self.objectspace.paths.get_variable_obj(check.target)
values = self.load_params_in_valid_enum(check.param,
variable.name,
@ -154,22 +153,18 @@ class ConstrainteAnnotator:
for param in params:
if param.type == 'variable':
if has_variable is not None:
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable "{variable_name}" in {xmlfiles}'), 5)
raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable {variable_name}'), 5)
has_variable = True
variable = self.objectspace.paths.get_variable_obj(param.text)
if not variable.multi:
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
raise DictConsistencyError(_(f'only multi "variable" parameter is allowed for valid_enum of variable "{variable_name}" in {xmlfiles}'), 6)
raise DictConsistencyError(_(f'only multi "variable" parameter is allowed for valid_enum of variable {variable_name}'), 6)
values = param.text
else:
if has_variable:
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
raise DictConsistencyError(_(f'only one parameter is allowed for valid_enum of variable "{variable_name}" in {xmlfiles}'), 7)
raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable {variable_name}'), 7)
if not hasattr(param, 'text'):
if param.type == 'number':
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
raise DictConsistencyError(_(f'param type is number, so value is mandatory for valid_enum of variable "{variable_name}" in {xmlfiles}'), 8)
raise DictConsistencyError(_(f'value is mandatory for valid_enum of variable {variable_name}'), 8)
values.append(None)
else:
values.append(param.text)
@ -401,7 +396,7 @@ class ConstrainteAnnotator:
# build choice
variable.choice = []
if isinstance(values, str):
choice = self.objectspace.choice(variable.xmlfiles)
choice = self.objectspace.choice()
choice.type = 'calculation'
choice.name = values
variable.choice.append(choice)
@ -509,8 +504,7 @@ class ConstrainteAnnotator:
targets.append(fill.target)
#
if fill.name not in self.functions:
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles)
raise DictConsistencyError(_(f'cannot find fill function {fill.name} in {xmlfiles}'), 25)
raise DictConsistencyError(_('cannot find fill function {}').format(fill.name), 25)
namespace = fill.namespace
# let's replace the target by the path
@ -519,8 +513,7 @@ class ConstrainteAnnotator:
with_suffix=True,
)
if suffix is not None:
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles)
raise DictConsistencyError(_(f'Cannot add fill function to "{fill.target}" only with the suffix "{suffix}" in {xmlfiles}'), 26)
raise DictConsistencyError(_(f'Cannot add fill function to "{fill.target}" only with the suffix "{suffix}"'), 26)
variable = self.objectspace.paths.get_variable_obj(fill.target)
value = self.objectspace.value(variable.xmlfiles)
value.type = 'calculation'
@ -529,15 +522,9 @@ class ConstrainteAnnotator:
param_to_delete = []
for fill_idx, param in enumerate(fill.param):
if param.type not in ['suffix', 'string'] and not hasattr(param, 'text'):
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles)
raise DictConsistencyError(_(f"All '{param.type}' variables must have a value in order to calculate {fill.target} in {xmlfiles}"), 27)
if param.type == 'suffix':
if hasattr(param, 'text'):
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles)
raise DictConsistencyError(_(f"All '{param.type}' variables must not have a value in order to calculate {fill.target} in {xmlfiles}"), 28)
if not self.objectspace.paths.variable_is_dynamic(fill.target):
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles)
raise DictConsistencyError(_(f'Cannot set suffix target to the none dynamic variable "{fill.target}" in {xmlfiles}'), 53)
raise DictConsistencyError(_(f"All '{param.type}' variables must have a value in order to calculate {fill.target}"), 27)
if param.type == 'suffix' and hasattr(param, 'text'):
raise DictConsistencyError(_(f"All '{param.type}' variables must not have a value in order to calculate {fill.target}"), 28)
if param.type == 'string':
if not hasattr(param, 'text'):
param.text = None

View File

@ -174,11 +174,6 @@ class Path:
return True
return name in self.variables
def variable_is_dynamic(self,
name: str,
) -> bool:
return self._get_variable(name)['is_dynamic']
def _get_variable(self,
name: str,
with_suffix: bool=False,

View File

@ -44,7 +44,9 @@ class TiramisuReflector:
)
def get_root_family(self):
family = Family(BaseElt(),
family = Family(BaseElt('baseoption',
'baseoption',
),
self.storage,
False,
'.',
@ -156,9 +158,15 @@ class TiramisuReflector:
class BaseElt:
def __init__(self) -> None:
self.name = 'baseoption'
self.doc = 'baseoption'
def __init__(self,
name,
doc,
):
self.name = name
self.doc = doc
def __iter__(self):
return iter([])
class ElementStorage:
@ -173,9 +181,13 @@ class ElementStorage:
self.index += 1
def get(self, path):
if path not in self.paths or self.paths[path][0] is None:
raise LoaderError(_('there is no element for path {}').format(path))
return self.paths[path][0]
def get_name(self, path):
if path not in self.paths:
raise LoaderError(_('there is no element for index {}').format(path))
return f'option_{self.paths[path][1]}'
@ -195,13 +207,15 @@ class Common:
self.storage.add(self.path, self)
def populate_properties(self, child):
assert child.type == 'calculation'
action = f"ParamValue('{child.name}')"
option_name = self.storage.get(child.source).get()
kwargs = f"'condition': ParamOption({option_name}, todict=True), 'expected': ParamValue('{child.expected}')"
if child.inverse:
kwargs += ", 'reverse_condition': ParamValue(True)"
prop = 'Calculation(calc_value, Params(' + action + ', kwargs={' + kwargs + '}))'
if child.type == 'calculation':
action = f"ParamValue('{child.name}')"
option_name = self.storage.get(child.source).get()
kwargs = f"'condition': ParamOption({option_name}, todict=True), 'expected': ParamValue('{child.expected}')"
if child.inverse:
kwargs += ", 'reverse_condition': ParamValue(True)"
prop = 'Calculation(calc_value, Params(' + action + ', kwargs={' + kwargs + '}))'
else:
prop = "'" + child.text + "'"
if self.attrib['properties']:
self.attrib['properties'] += ', '
self.attrib['properties'] += prop
@ -249,8 +263,15 @@ class Common:
):
for attr in dir(space):
if not attr.startswith('_') and attr not in ERASED_ATTRIBUTES:
if isinstance(getattr(space, attr), list):
yield attr, getattr(space, attr)
value = getattr(space, attr)
if isinstance(value, (list, dict)):
children = getattr(space, attr)
if children.__class__.__name__ == 'Family':
children = [children]
if isinstance(children, dict):
children = list(children.values())
if children and isinstance(children, list):
yield attr, children
class Variable(Common):
@ -293,7 +314,7 @@ class Variable(Common):
for key in self.get_attributes(self.elt):
value = getattr(self.elt, key)
if key in FORCE_INFORMATIONS:
if key == 'test': # pragma: no cover
if key == 'test':
value = value.split(',')
if self.object_type == 'IntOption':
value = [int(v) for v in value]
@ -347,15 +368,19 @@ class Variable(Common):
def calculation_value(self, child, args):
kwargs = []
# has parameters
function = child.name
if hasattr(child, 'param'):
for param in child.param:
value = self.populate_param(function, param)
if not hasattr(param, 'name'):
args.append(str(value))
else:
kwargs.append(f"'{param.name}': " + value)
if hasattr(child, 'name'):
# has parameters
function = child.name
if hasattr(child, 'param'):
for param in child.param:
value = self.populate_param(function, param)
if not hasattr(param, 'name'):
args.append(str(value))
else:
kwargs.append(f"'{param.name}': " + value)
else:
# function without any parameter
function = child.text.strip()
ret = f"Calculation(func.{function}, Params((" + ', '.join(args) + "), kwargs=" + "{" + ', '.join(kwargs) + "})"
if hasattr(child, 'warnings_only'):
ret += f', warnings_only={child.warnings_only}'
@ -381,7 +406,7 @@ class Variable(Common):
return f'ParamInformation("{param.text}", None)'
elif param.type == 'suffix':
return f'ParamSuffix()'
raise LoaderError(_('unknown param type {}').format(param.type)) # pragma: no cover
raise LoaderError(_('unknown param type {}').format(param.type))
def populate_value(self,
child,
@ -455,8 +480,11 @@ class Family(Common):
if 'properties' in self.attrib:
self.attrib['properties'] = "'" + "', '".join(sorted(list(self.attrib['properties']))) + "'"
if hasattr(self.elt, 'property'):
#self.attrib['properties'] = ''
for child in self.elt.property:
self.populate_properties(child)
if not self.attrib['properties']:
del self.attrib['properties']
def get_object_name(self):
if 'suffixes' in self.attrib:

View File

@ -1,16 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change"/>
</family>
</variables>
<constraints>
<fill name="calc_val" target="mode_conteneur_actif">
<param type="information">test_information</param>
</fill>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1 +0,0 @@
{"rougail.general.mode_conteneur_actif": "value"}

View File

@ -8,7 +8,4 @@ try:
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(properties=frozenset({'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamInformation("test_information", None)), kwargs={})))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[])

View File

@ -0,0 +1,11 @@
from importlib.machinery import SourceFileLoader
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
for key, value in dict(locals()).items():
if key != ['SourceFileLoader', 'func']:
setattr(func, key, value)
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[])

View File

@ -1,34 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services>
<service name="test">
<file name="/tmp/file" filelist="afilllist"/>
</service>
</services>
<variables>
<family name="general">
<variable name="condition" type="string" description="No change">
<value>non</value>
</variable>
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
<value>non</value>
</variable>
<variable name="mode_conteneur_actif2" type="oui/non" description="No change" hidden="True">
<value>non</value>
</variable>
</family>
</variables>
<constraints>
<check name="valid_enum" target="condition">
<param>non</param>
<param>statique</param>
</check>
<condition name="disabled_if_not_in" source="condition">
<param>statique</param>
<target type="filelist">afilllist</target>
</condition>
</constraints>
</rougail>

View File

@ -1 +0,0 @@
{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/tmp/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true}

View File

@ -8,21 +8,4 @@ try:
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('non', 'statique'))
option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5])
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
option_10 = StrOption(name='group', doc='group', multi=False, default='root')
option_11 = StrOption(name='mode', doc='mode', multi=False, default='0644')
option_12 = StrOption(name='name', doc='name', multi=False, default='/tmp/file')
option_13 = StrOption(name='owner', doc='owner', multi=False, default='root')
option_14 = StrOption(name='source', doc='source', multi=False, default='file')
option_15 = BoolOption(name='templating', doc='templating', multi=False, default=True)
option_16 = BoolOption(properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('statique'), 'reverse_condition': ParamValue(True)}))}), name='activate', doc='activate', multi=False, default=True)
option_9 = OptionDescription(name='file', doc='file', children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
option_8 = OptionDescription(name='files', doc='files', children=[option_9])
option_7 = OptionDescription(name='test', doc='test', children=[option_8])
option_7.impl_set_information("manage", True)
option_6 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_7])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_6])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[])

View File

@ -1,22 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change">
<value>a</value>
</variable>
<variable name="var" type="string" description="New variable" multi="True">
<value>a</value>
<value>b</value>
<value>c</value>
</variable>
</family>
</variables>
<constraints>
<check name="valid_enum" target="mode_conteneur_actif">
<param type="variable">var</param>
</check>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1 +0,0 @@
{"rougail.general.mode_conteneur_actif": "a", "rougail.general.var": ["a", "b", "c"]}

View File

@ -1,15 +0,0 @@
from importlib.machinery import SourceFileLoader
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
for key, value in dict(locals()).items():
if key != ['SourceFileLoader', 'func']:
setattr(func, key, value)
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_4 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='var', doc='New variable', multi=True, default=['a', 'b', 'c'], default_multi='c')
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='a', values=Calculation(func.calc_value, Params((ParamOption(option_4)))))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4])
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<rougail>
<variables>
<family name='general'>
<variable name='varname' type='string' description="No change" multi="True">
<value>val1</value>
<value>val2</value>
</variable>
</family>
<family name='dyn' dynamic="varname">
<variable name='vardyn' type='string' description="No change">
<value>val</value>
</variable>
</family>
<family name='new'>
<variable name='newvar' type='string' description="No change"/>
</family>
</variables>
<constraints>
<fill name="calc_val" target="newvar">
<param type="variable">vardynval1</param>
</fill>
</constraints>
</rougail>

View File

@ -1 +0,0 @@
{"rougail.general.varname": ["val1", "val2"], "rougail.dynval1.vardynval1": "val", "rougail.dynval2.vardynval2": "val", "rougail.new.newvar": "val"}

View File

@ -8,11 +8,4 @@ try:
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='varname', doc='No change', multi=True, default=['val1', 'val2'], default_multi='val2')
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
option_5 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='vardyn', doc='No change', multi=False, default='val')
option_4 = ConvertDynOptionDescription(name='dyn', doc='dyn', suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), properties=frozenset({'normal'}), children=[option_5])
option_7 = StrOption(properties=frozenset({'normal'}), name='newvar', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamDynOption(option_5, 'val1', option_4, notraisepropertyerror=False, todict=False)), kwargs={})))
option_6 = OptionDescription(name='new', doc='new', properties=frozenset({'normal'}), children=[option_7])
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4, option_6])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[])

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<rougail>
<variables>
<family name='general'>
<variable name='varname' type='string' description="No change" multi="True">
<value>val1</value>
<value>val2</value>
</variable>
</family>
<family name='dyn' dynamic="varname">
<variable name='vardyn' type='string' description="No change">
<value>val</value>
</variable>
</family>
<family name='new'>
<variable name='newvar' type='string' description="No change"/>
</family>
</variables>
<constraints>
<fill name="calc_val" target="vardyn">
<param type="suffix"/>
</fill>
</constraints>
</rougail>

View File

@ -1 +0,0 @@
{"rougail.general.varname": ["val1", "val2"], "rougail.dynval1.vardynval1": "val1", "rougail.dynval2.vardynval2": "val2", "rougail.new.newvar": null}

View File

@ -1,18 +0,0 @@
from importlib.machinery import SourceFileLoader
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
for key, value in dict(locals()).items():
if key != ['SourceFileLoader', 'func']:
setattr(func, key, value)
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='varname', doc='No change', multi=True, default=['val1', 'val2'], default_multi='val2')
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
option_5 = StrOption(properties=frozenset({'normal'}), name='vardyn', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamSuffix()), kwargs={})))
option_4 = ConvertDynOptionDescription(name='dyn', doc='dyn', suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), properties=frozenset({'normal'}), children=[option_5])
option_7 = StrOption(properties=frozenset({'normal'}), name='newvar', doc='No change', multi=False)
option_6 = OptionDescription(name='new', doc='new', properties=frozenset({'normal'}), children=[option_7])
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4, option_6])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -1,15 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True"/>
</family>
</variables>
<constraints>
<fill name="calc_val" target="mode_conteneur_actif">
<param>value</param>
</fill>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1 +0,0 @@
{"rougail.general.mode_conteneur_actif": "value"}

View File

@ -8,7 +8,4 @@ try:
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamValue("value")), kwargs={})))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[])

View File

@ -1,13 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change"/>
</family>
</variables>
<constraints>
<fill name="calc_val" target="mode_conteneur_actif">
<param>value</param>
</fill>
</constraints>
</rougail>

View File

@ -1 +1 @@
{"rougail.general.mode_conteneur_actif": "value"}
{}

View File

@ -8,7 +8,4 @@ try:
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(properties=frozenset({'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamValue("value")), kwargs={})))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[])

View File

@ -1,33 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
<value>non</value>
</variable>
</family>
<family name="general2" hidden="True">
<variable name="mode_conteneur_actif2" type="oui/non" description="No change">
<value>non</value>
</variable>
<variable name="mode_conteneur_actif3" type="string" description="No change"/>
</family>
</variables>
<constraints>
<check name="valid_enum" target="mode_conteneur_actif3">
<param>a</param>
<param>b</param>
<param>c</param>
</check>
<condition name="disabled_if_in" source="mode_conteneur_actif3">
<param>d</param>
<target type="variable">mode_conteneur_actif</target>
</condition>
<condition name="disabled_if_not_in" source="mode_conteneur_actif3">
<param>d</param>
<target type="variable">mode_conteneur_actif2</target>
</condition>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1 +0,0 @@
{"rougail.general.mode_conteneur_actif": "non", "rougail.general2.mode_conteneur_actif3": "a"}

View File

@ -8,10 +8,4 @@ try:
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
option_5 = ChoiceOption(properties=frozenset({'disabled', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_6 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif3', doc='No change', multi=False, default='a', values=('a', 'b', 'c'))
option_4 = OptionDescription(name='general2', doc='general2', properties=frozenset({'hidden', 'normal'}), children=[option_5, option_6])
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[])

View File

@ -1,17 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="Redefine description" hidden="True"/>
</family>
</variables>
<constraints>
<check name="valid_enum" target="mode_conteneur_actif">
<param>a</param>
<param>b</param>
<param>c</param>
</check>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1,16 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" redefine="True" remove_check="True"/>
</family>
</variables>
<constraints>
<check name="valid_enum" target="mode_conteneur_actif">
<param>a</param>
<param>b</param>
</check>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1 +0,0 @@
{"rougail.general.mode_conteneur_actif": "a"}

View File

@ -8,7 +8,4 @@ try:
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Redefine description', multi=False, default='a', values=('a', 'b'))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[])

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<rougail>
<variables>
<family name='general'>
<variable name='varname' type='string' description="No change" multi="True">
<value>val1</value>
<value>val2</value>
</variable>
</family>
<family name='dyn' dynamic="varname">
<variable name='vardyn' type='string' description="No change">
<value>val</value>
</variable>
</family>
<family name='new'>
<variable name='newvar' type='string' description="No change"/>
</family>
</variables>
<constraints>
<fill name="calc_val" target="newvar">
<param type="suffix"/>
</fill>
</constraints>
</rougail>

View File

@ -1,33 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general" mode="expert">
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
<value>non</value>
</variable>
</family>
<family name="enumfam" mode="expert">
<variable name="enumvar2" type="string" description="multi">
<value>c</value>
</variable>
<variable name="enumvar" type="string" description="multi" help="bla bla bla">
<value>c</value>
</variable>
</family>
</variables>
<constraints>
<check name="valid_enum" target="enumvar">
<param>a</param>
<param>b</param>
<param>c</param>
</check>
<check name="valid_enum" target="enumvar2">
<param>a</param>
<param>b</param>
<param>c</param>
</check>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1,19 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="enumfam" mode="expert">
<variable name="enumvar" redefine="True">
<value>c</value>
</variable>
</family>
</variables>
<constraints>
<check name="valid_enum" target="enumvar">
<param>a</param>
<param>c</param>
</check>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1,23 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change">
<value>a</value>
</variable>
<variable name="var" type="string" description="New variable" multi="True">
<value>a</value>
<value>b</value>
<value>c</value>
</variable>
</family>
</variables>
<constraints>
<check name="valid_enum" target="mode_conteneur_actif">
<param type="variable">var</param>
<param>d</param>
</check>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1,28 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change">
<value>a</value>
</variable>
<variable name="var" type="string" description="New variable" multi="True">
<value>a</value>
<value>b</value>
<value>c</value>
</variable>
<variable name="var2" type="string" description="New variable" multi="True">
<value>a</value>
<value>b</value>
<value>c</value>
</variable>
</family>
</variables>
<constraints>
<check name="valid_enum" target="mode_conteneur_actif">
<param type="variable">var</param>
<param type="variable">var2</param>
</check>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1,22 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general" mode="expert">
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
<value>non</value>
</variable>
</family>
<family name="enumfam" mode="expert">
<variable name="enumvar" type="string" description="multi" help="bla bla bla">
<value>c</value>
</variable>
</family>
<separators/>
</variables>
<constraints>
<check name="valid_enum" target="enumvar"/>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1,20 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change">
<value>a</value>
</variable>
<variable name="var" type="string" description="New variable">
<value>a</value>
</variable>
</family>
</variables>
<constraints>
<check name="valid_enum" target="mode_conteneur_actif">
<param type="variable">var</param>
</check>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1,22 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general" mode="expert">
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
<value>non</value>
</variable>
</family>
<family name="enumfam" mode="expert">
<variable name="enumvar" type="number" description="enumvar" help="bla bla bla"/>
</family>
</variables>
<constraints>
<check name="valid_enum" target="enumvar">
<param type="number"/>
</check>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -5,7 +5,7 @@ from pytest import fixture, raises
from os import listdir
from json import load
from rougail import Rougail
from rougail import Rougail, annotator
from rougail.error import DictConsistencyError
from rougail.config import Config
@ -28,10 +28,9 @@ excludes = set([])
#excludes = set(['01base_file_utfchar'])
test_ok -= excludes
test_raise -= excludes
#test_ok = ['10valid_enum_eosfunc']
#test_ok = ['40condition_base_add']
#test_ok = []
#test_raise = ['80redefine_double_error']
#test_raise = []
ORI_DIR = getcwd()
@ -71,8 +70,6 @@ def launch_flattener(test_dir, test_ok=False):
Config['patch_dir'] = join(test_dir, 'patches')
eolobj.space_visitor(eosfunc)
tiramisu_objects = eolobj.save()
if 'children=[]' in tiramisu_objects.split('\n')[-2]:
raise Exception('empty tiramisu object?')
tiramisu_dir = join(test_dir, 'tiramisu')
if isdir(tiramisu_dir):
tiramisu_file = join(tiramisu_dir, 'base.py')

View File

@ -43,7 +43,6 @@ async def launch_flattener(test_dir):
for token in modulepath.split(".")[1:]:
mod = getattr(mod, token)
config = await Config(mod.option_0)
await config.information.set('test_information', 'value')
await config.property.read_only()
await config.property.pop('mandatory')
await config.information.set('info', 'value')
@ -51,7 +50,7 @@ async def launch_flattener(test_dir):
if config_dict:
if not isdir(makedict_dir):
mkdir(makedict_dir)
if not isfile(makedict_file) or debug:
if debug:
with open(makedict_file, 'w') as fh:
dump(config_dict, fh)
fh.write('\n')