Compare commits

..

No commits in common. "0a8be9a355cfce437e39fcf236bffdb13d3b454d" and "0b8a6e399aaef4a25198b8407c3fcc0142f9f9b2" have entirely different histories.

42 changed files with 182 additions and 752 deletions

View File

@ -1,28 +1,4 @@
"""Rougail method """Rougail method
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from .rougail import Rougail from .rougail import Rougail
from .annotator import modes from .annotator import modes

View File

@ -1,28 +1,4 @@
"""Annotate dictionaries """Annotate dictionaries
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from .group import GroupAnnotator from .group import GroupAnnotator
from .service import ServiceAnnotator from .service import ServiceAnnotator
@ -49,9 +25,9 @@ class SpaceAnnotator: # pylint: disable=R0903
FillAnnotator(objectspace, FillAnnotator(objectspace,
eosfunc_file, eosfunc_file,
) )
ValueAnnotator(objectspace)
FamilyAnnotator(objectspace) FamilyAnnotator(objectspace)
PropertyAnnotator(objectspace) PropertyAnnotator(objectspace)
ValueAnnotator(objectspace)
__all__ = ('SpaceAnnotator', 'CONVERT_OPTION', 'modes') __all__ = ('SpaceAnnotator', 'CONVERT_OPTION', 'modes')

View File

@ -1,28 +1,4 @@
"""Annotate check """Annotate check
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from typing import List, Any from typing import List, Any

View File

@ -1,28 +1,4 @@
"""Annotate condition """Annotate condition
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from typing import List, Any from typing import List, Any
@ -41,15 +17,14 @@ class ConditionAnnotator:
objectspace, objectspace,
): ):
self.objectspace = objectspace self.objectspace = objectspace
self.force_service_value = {}
if hasattr(objectspace.space, 'variables'): if hasattr(objectspace.space, 'variables'):
self.convert_auto_freeze() self.convert_auto_freeze()
if not hasattr(objectspace.space, 'constraints') or \ if not hasattr(objectspace.space, 'constraints') or \
not hasattr(self.objectspace.space.constraints, 'condition'): not hasattr(self.objectspace.space.constraints, 'condition'):
return return
self.convert_condition_target() self.convert_condition_target()
self.check_condition_fallback()
self.convert_xxxlist_to_variable() self.convert_xxxlist_to_variable()
self.check_condition_fallback()
self.convert_condition_source() self.convert_condition_source()
self.check_choice_option_condition() self.check_choice_option_condition()
self.remove_condition_with_empty_target() self.remove_condition_with_empty_target()
@ -134,6 +109,31 @@ class ConditionAnnotator:
for index in remove_targets: for index in remove_targets:
condition.target.pop(index) condition.target.pop(index)
def convert_xxxlist_to_variable(self):
"""transform *list to variable or family
"""
for condition in self.objectspace.space.constraints.condition:
new_targets = []
remove_targets = []
for target_idx, target in enumerate(condition.target):
if target.type.endswith('list'):
listname = target.type
listvars = self.objectspace.list_conditions.get(listname,
{}).get(target.name)
if listvars:
for listvar in listvars:
type_ = 'variable'
new_target = self.objectspace.target(listvar.xmlfiles)
new_target.type = type_
new_target.name = listvar
new_targets.append(new_target)
remove_targets.append(target_idx)
remove_targets.sort(reverse=True)
for target_idx in remove_targets:
condition.target.pop(target_idx)
condition.target.extend(new_targets)
def check_condition_fallback(self): def check_condition_fallback(self):
"""a condition with a fallback **and** the source variable doesn't exist """a condition with a fallback **and** the source variable doesn't exist
""" """
@ -163,11 +163,8 @@ class ConditionAnnotator:
""" """
actions = self.get_actions_from_condition(condition.name) actions = self.get_actions_from_condition(condition.name)
for target in condition.target: for target in condition.target:
main_action = actions[0]
if target.type.endswith('list'):
self.force_service_value[target.name] = main_action != 'disabled'
continue
leader_or_var, variables = self._get_family_variables_from_target(target) leader_or_var, variables = self._get_family_variables_from_target(target)
main_action = actions[0]
setattr(leader_or_var, main_action, True) setattr(leader_or_var, main_action, True)
for action in actions[1:]: for action in actions[1:]:
for variable in variables: for variable in variables:
@ -199,68 +196,7 @@ class ConditionAnnotator:
variable = self.objectspace.paths.get_family(target.name.path, variable = self.objectspace.paths.get_family(target.name.path,
target.namespace, target.namespace,
) )
if hasattr(variable, 'variable'):
return variable, list(variable.variable.values()) return variable, list(variable.variable.values())
return variable, []
def convert_xxxlist_to_variable(self):
"""transform *list to variable or family
"""
fills = {}
for condition in self.objectspace.space.constraints.condition:
remove_targets = []
for target_idx, target in enumerate(condition.target):
if target.type.endswith('list'):
listname = target.type
listvars = self.objectspace.list_conditions.get(listname,
{}).get(target.name)
if listvars:
for listvar in listvars:
if target.name in self.force_service_value:
listvar.default = self.force_service_value[target.name]
continue
value = condition.name != 'disabled_if_in'
if len(condition.param) != 1:
xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles)
msg = _(f'a condition with "{listname}" can only have '
f'only have only on param')
raise DictConsistencyError(msg, 35) from err
if listvar.path in fills:
fill = fills[listvar.path]
fill.index += 1
else:
fill = self.objectspace.fill(target.xmlfiles)
fill.target = listvar.path
fill.name = 'calc_value'
fill.namespace = 'services'
fill.index = 0
if not hasattr(self.objectspace.space, 'constraints'):
self.objectspace.space.constraints = self.objectspace.constraints(elt.xmlfiles)
if not hasattr(self.objectspace.space.constraints, 'fill'):
self.objectspace.space.constraints.fill = []
self.objectspace.space.constraints.fill.append(fill)
fills[listvar.path] = fill
param1 = self.objectspace.param(target.xmlfiles)
param1.text = value
param1.type = 'boolean'
param2 = self.objectspace.param(target.xmlfiles)
param2.name = 'default'
param2.text = not value
param2.type = 'boolean'
fill.param = [param1, param2]
param3 = self.objectspace.param(target.xmlfiles)
param3.name = f'condition_{fill.index}'
param3.type = 'variable'
param3.text = condition.source
fill.param.append(param3)
param4 = self.objectspace.param(target.xmlfiles)
param4.name = f'expected_{fill.index}'
param4.text = getattr(condition.param[0], 'text', None)
fill.param.append(param4)
remove_targets.append(target_idx)
remove_targets.sort(reverse=True)
for target_idx in remove_targets:
condition.target.pop(target_idx)
def convert_condition_source(self): def convert_condition_source(self):
"""remove condition for ChoiceOption that don't have param """remove condition for ChoiceOption that don't have param

View File

@ -1,32 +1,9 @@
"""Annotate family """Annotate family
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from ..i18n import _ from ..i18n import _
from ..error import DictConsistencyError from ..error import DictConsistencyError
from ..utils import normalize_family from ..utils import normalize_family
from .variable import RENAME_ATTIBUTES
#mode order is important #mode order is important
@ -61,12 +38,27 @@ class FamilyAnnotator:
self.objectspace = objectspace self.objectspace = objectspace
if not hasattr(self.objectspace.space, 'variables'): if not hasattr(self.objectspace.space, 'variables'):
return return
self.remove_empty_families()
self.family_names() self.family_names()
self.change_modes() self.remove_empty_families()
self.change_variable_mode()
self.change_family_mode()
self.dynamic_families() self.dynamic_families()
self.convert_help() self.convert_help()
def family_names(self) -> None:
"""Set doc, path, ... to family
"""
for families in self.objectspace.space.variables.values():
families.doc = families.name
families.path = families.name
for family in families.family.values():
if not hasattr(family, 'description'):
family.description = family.name
for key, value in RENAME_ATTIBUTES.items():
setattr(family, value, getattr(family, key))
setattr(family, key, None)
family.name = normalize_family(family.name)
def remove_empty_families(self) -> None: def remove_empty_families(self) -> None:
"""Remove all families without any variable """Remove all families without any variable
""" """
@ -78,27 +70,12 @@ class FamilyAnnotator:
for family_name in removed_families: for family_name in removed_families:
del families.family[family_name] del families.family[family_name]
def family_names(self) -> None: def change_variable_mode(self):
"""Set doc, path, ... to family
"""
for families in self.objectspace.space.variables.values():
families.doc = families.name
families.path = families.name
for family in families.family.values():
if not hasattr(family, 'description'):
family.description = family.name
family.doc = family.description
del family.description
family.name = normalize_family(family.name)
def change_modes(self):
"""change the mode of variables """change the mode of variables
""" """
for families in self.objectspace.space.variables.values(): for variables in self.objectspace.space.variables.values():
for family in families.family.values(): for family in variables.family.values():
family_mode = family.mode family_mode = family.mode
# default is high level
new_family_mode = modes_level[-1]
for variable in family.variable.values(): for variable in family.variable.values():
if not isinstance(variable, self.objectspace.leadership): if not isinstance(variable, self.objectspace.leadership):
func = self._change_variabe_mode func = self._change_variabe_mode
@ -107,28 +84,19 @@ class FamilyAnnotator:
func(variable, func(variable,
family_mode, family_mode,
) )
if modes[new_family_mode] > modes[variable.mode]:
new_family_mode = variable.mode
# set the lower variable mode to family
family.mode = new_family_mode
def _change_variabe_mode(self, def _change_variabe_mode(self,
variable, variable,
family_mode: str, family_mode: str,
is_follower=False,
) -> None: ) -> None:
# auto_save or auto_freeze variable is set to 'basic' mode # auto_save or auto_freeze variable is set to 'basic' mode
# if its mode is not defined by the user # if its mode is not defined by the user
if 'mode' not in vars(variable) and \ if 'mode' not in vars(variable) and \
(variable.auto_save is True or variable.auto_freeze is True): (variable.auto_save is True or variable.auto_freeze is True):
variable.mode = modes_level[0] variable.mode = modes_level[0]
# mandatory variable without value is a basic variable self._annotate_variable(variable,
if variable.mandatory is True and not hasattr(variable, 'default'): family_mode,
variable.mode = modes_level[0] )
# none basic variable in high level family has to be in high level
if modes[variable.mode] < modes[family_mode] and \
(not is_follower or variable.mode != modes_level[0]):
variable.mode = family_mode
def _change_variable_mode_leader(self, def _change_variable_mode_leader(self,
leadership, leadership,
@ -145,7 +113,7 @@ class FamilyAnnotator:
xmlfiles = self.objectspace.display_xmlfiles(leadership.xmlfiles) xmlfiles = self.objectspace.display_xmlfiles(leadership.xmlfiles)
msg = f'leader/followers "{follower.name}" could not be auto_freeze in {xmlfiles}' msg = f'leader/followers "{follower.name}" could not be auto_freeze in {xmlfiles}'
raise DictConsistencyError(_(msg), 30) raise DictConsistencyError(_(msg), 30)
self._change_variabe_mode(follower, self._annotate_variable(follower,
family_mode, family_mode,
is_follower, is_follower,
) )
@ -159,6 +127,60 @@ class FamilyAnnotator:
is_follower = True is_follower = True
leadership.mode = leader_mode leadership.mode = leader_mode
def _annotate_variable(self,
variable,
family_mode: str,
is_follower=False,
) -> None:
"""if the variable is mandatory and doesn't have any value
then the variable's mode is set to 'basic'
"""
# a boolean must have value, the default value is "True"
if not hasattr(variable, 'value') and variable.type == 'boolean':
new_value = self.objectspace.value(variable.xmlfiles)
new_value.name = True
new_value.type = 'boolean'
variable.value = [new_value]
# variable with default value is mandatory
if hasattr(variable, 'value') and variable.value:
has_value = True
for value in variable.value:
if value.type == 'calculation':
has_value = False
break
if has_value:
# if has value without any calculation
variable.mandatory = True
# mandatory variable without value is a basic variable
if variable.mandatory is True and (not hasattr(variable, 'value') or is_follower):
variable.mode = modes_level[0]
# none basic variable in high level family has to be in high level
if modes[variable.mode] < modes[family_mode] and \
(not is_follower or variable.mode != modes_level[0]):
variable.mode = family_mode
# hidden variable is also frozen
if variable.hidden is True:
variable.frozen = True
if not variable.auto_save and \
not variable.auto_freeze and \
'force_default_on_freeze' not in vars(variable):
variable.force_default_on_freeze = True
def change_family_mode(self):
"""change mode of a family
"""
for families in self.objectspace.space.variables.values():
for family in families.family.values():
# default is high level
mode = modes_level[-1]
# get de lower sub variable mode
for variable in family.variable.values():
variable_mode = variable.mode
if modes[mode] > modes[variable_mode]:
mode = variable_mode
# set the lower variable mode to family
family.mode = mode
def dynamic_families(self): def dynamic_families(self):
"""link dynamic families to object """link dynamic families to object
""" """
@ -179,8 +201,7 @@ class FamilyAnnotator:
""" """
for families in self.objectspace.space.variables.values(): for families in self.objectspace.space.variables.values():
for family in families.family.values(): for family in families.family.values():
if not hasattr(family, 'help'): if hasattr(family, 'help'):
continue
if not hasattr(family, 'information'): if not hasattr(family, 'information'):
family.information = self.objectspace.information(family.xmlfiles) family.information = self.objectspace.information(family.xmlfiles)
family.information.help = family.help family.information.help = family.help

View File

@ -1,28 +1,4 @@
"""Fill annotator """Fill annotator
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from ..utils import load_modules from ..utils import load_modules
from ..i18n import _ from ..i18n import _
@ -79,9 +55,6 @@ class FillAnnotator:
value = self.objectspace.value(fill.xmlfiles) value = self.objectspace.value(fill.xmlfiles)
value.type = 'calculation' value.type = 'calculation'
value.name = fill.name value.name = fill.name
if variable.namespace == 'services':
variable.default = value
else:
variable.value = [value] variable.value = [value]
# manage params # manage params

View File

@ -1,28 +1,4 @@
"""Annotate group """Annotate group
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from ..i18n import _ from ..i18n import _
from ..error import DictConsistencyError from ..error import DictConsistencyError

View File

@ -1,28 +1,4 @@
"""Annotate properties """Annotate properties
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from ..i18n import _ from ..i18n import _
from ..error import DictConsistencyError from ..error import DictConsistencyError
@ -50,15 +26,9 @@ class PropertyAnnotator:
) -> None: ) -> None:
"""convert properties """convert properties
""" """
# hidden variable is also frozen
if isinstance(variable, self.objectspace.variable) and variable.hidden is True:
variable.frozen = True
if not variable.auto_save and \
not variable.auto_freeze and \
'force_default_on_freeze' not in vars(variable):
variable.force_default_on_freeze = True
if not hasattr(variable, 'properties'): if not hasattr(variable, 'properties'):
variable.properties = [] variable.properties = []
for prop in PROPERTIES: for prop in PROPERTIES:
if hasattr(variable, prop): if hasattr(variable, prop):
if getattr(variable, prop) is True: if getattr(variable, prop) is True:

View File

@ -1,28 +1,4 @@
"""Annotate services """Annotate services
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from os.path import basename from os.path import basename
from typing import Tuple from typing import Tuple
@ -148,6 +124,8 @@ class ServiceAnnotator:
elt.xmlfiles, elt.xmlfiles,
f'{subpath}.{key}' f'{subpath}.{key}'
)) ))
# FIXME ne devrait pas etre True par défaut
# devrait etre un calcule
family.variable.append(activate_obj) family.variable.append(activate_obj)
families.append(family) families.append(family)
return families return families

View File

@ -1,28 +1,4 @@
"""Annotate value """Annotate value
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
class ValueAnnotator: # pylint: disable=R0903 class ValueAnnotator: # pylint: disable=R0903
@ -41,8 +17,6 @@ class ValueAnnotator: # pylint: disable=R0903
""" """
for families in self.objectspace.space.variables.values(): for families in self.objectspace.space.variables.values():
for family in families.family.values(): for family in families.family.values():
if not hasattr(family, 'variable'):
continue
for variable in family.variable.values(): for variable in family.variable.values():
if isinstance(variable, self.objectspace.leadership): if isinstance(variable, self.objectspace.leadership):
variable_type = 'leader' variable_type = 'leader'
@ -54,29 +28,10 @@ class ValueAnnotator: # pylint: disable=R0903
else: else:
self._convert_value(variable) self._convert_value(variable)
def _convert_value(self, @staticmethod
variable, def _convert_value(variable,
variable_type: str=None, variable_type: str=None,
) -> None: ) -> None:
# a boolean must have value, the default value is "True"
if not hasattr(variable, 'value') and variable.type == 'boolean':
new_value = self.objectspace.value(variable.xmlfiles)
new_value.name = True
new_value.type = 'boolean'
variable.value = [new_value]
"""if the variable is mandatory and doesn't have any value
then the variable's mode is set to 'basic'
"""
# variable with default value is mandatory
if hasattr(variable, 'value') and variable.value:
has_value = True
for value in variable.value:
if value.type == 'calculation':
has_value = False
break
if has_value:
# if has value without any calculation
variable.mandatory = True
if not hasattr(variable, 'value'): if not hasattr(variable, 'value'):
return return
if variable.value[0].type == 'calculation': if variable.value[0].type == 'calculation':

View File

@ -1,28 +1,4 @@
"""Annotate variable """Annotate variable
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
@ -63,6 +39,9 @@ FORCE_CHOICE = {'schedule': ['none', 'daily', 'weekly', 'monthly'],
} }
RENAME_ATTIBUTES = {'description': 'doc'}
class VariableAnnotator: # pylint: disable=R0903 class VariableAnnotator: # pylint: disable=R0903
"""Annotate variable """Annotate variable
""" """
@ -109,19 +88,20 @@ class VariableAnnotator: # pylint: disable=R0903
if hasattr(variable, 'value'): if hasattr(variable, 'value'):
value_to_del = [] value_to_del = []
for idx, value in enumerate(variable.value): for idx, value in enumerate(variable.value):
if not hasattr(value, 'name'):
value_to_del.append(idx)
else:
if not hasattr(value, 'type'): if not hasattr(value, 'type'):
value.type = variable.type value.type = variable.type
if 'name' not in vars(value):
value_to_del.append(idx)
else:
value.name = CONVERT_OPTION.get(value.type, {}).get('func', str)(value.name) value.name = CONVERT_OPTION.get(value.type, {}).get('func', str)(value.name)
value_to_del.sort(reverse=True) value_to_del.sort(reverse=True)
for idx in value_to_del: for idx in value_to_del:
del variable.value[idx] del variable.value[idx]
if not variable.value: if not variable.value:
del variable.value del variable.value
variable.doc = variable.description for key, value in RENAME_ATTIBUTES.items():
del variable.description setattr(variable, value, getattr(variable, key))
setattr(variable, key, None)
if variable_type == 'follower': if variable_type == 'follower':
if variable.multi is True: if variable.multi is True:
variable.multi = 'submulti' variable.multi = 'submulti'

View File

@ -1,29 +1,7 @@
# -*- coding: utf-8 -*-
""" """
Config file for Rougail fichier de configuration pour rougail
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from os.path import join, abspath, dirname from os.path import join, abspath, dirname

View File

@ -13,7 +13,7 @@
# Forked by: # Forked by:
# Cadoles (http://www.cadoles.com) # Cadoles (http://www.cadoles.com)
# Copyright (C) 2019-2021 # Copyright (C) 2019-2020
# distribued with GPL-2 or later license # distribued with GPL-2 or later license

View File

@ -1,28 +1,4 @@
"""Standard error classes """Standard error classes
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
class ConfigError(Exception): class ConfigError(Exception):
"""Standard error for templating """Standard error for templating

View File

@ -1,28 +1,23 @@
"""Internationalisation utilities # -*- coding: UTF-8 -*-
Created by: # Copyright (C) 2012-2013 Team tiramisu (see AUTHORS for all contributors)
EOLE (http://eole.orion.education.fr) #
Copyright (C) 2005-2018 # This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
Forked by: # Free Software Foundation, either version 3 of the License, or (at your
Cadoles (http://www.cadoles.com) # option) any later version.
Copyright (C) 2019-2021 #
# This program is distributed in the hope that it will be useful, but WITHOUT
distribued with GPL-2 or later license # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
This program is free software; you can redistribute it and/or modify # details.
it under the terms of the GNU General Public License as published by #
the Free Software Foundation; either version 2 of the License, or # You should have received a copy of the GNU Lesser General Public License
(at your option) any later version. # along with this program. If not, see <http://www.gnu.org/licenses/>.
#
This program is distributed in the hope that it will be useful, # The original `Config` design model is unproudly borrowed from
but WITHOUT ANY WARRANTY; without even the implied warranty of # the rough gus of pypy: pypy: http://codespeak.net/svn/pypy/dist/pypy/config/
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # the whole pypy projet is under MIT licence
GNU General Public License for more details. "internationalisation utilities"
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
import gettext import gettext
import os import os
import sys import sys

View File

@ -1,29 +1,5 @@
"""parse XML files and build a space with objects """parse XML files and build a space with objects
it aggregates this files and manage redefine and exists attributes it aggregates this files and manage redefine and exists attributes
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from typing import Optional from typing import Optional

View File

@ -1,28 +1,4 @@
"""Manage path to find objects """Manage path to find objects
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from .i18n import _ from .i18n import _
from .error import DictConsistencyError from .error import DictConsistencyError

View File

@ -1,29 +1,6 @@
"""Takes a bunch of Rougail XML dispatched in differents folders """
as an input and outputs a Tiramisu's file. Takes a bunch of Rougail XML dispatched in differents folders
as an input and outputs a Tiramisu's file
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sample usage:: Sample usage::

View File

@ -1,28 +1,7 @@
"""Template langage for Rougail # -*- coding: utf-8 -*-
"""
Created by: Gestion du mini-langage de template
EOLE (http://eole.orion.education.fr) On travaille sur les fichiers cibles
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from shutil import copy from shutil import copy
@ -365,7 +344,7 @@ class CreoleTemplateEngine:
filename = fill['source'] filename = fill['source']
if not isfile(filename): # pragma: no cover if not isfile(filename): # pragma: no cover
raise FileNotFound(_(f"File {filename} does not exist.")) raise FileNotFound(_(f"File {filename} does not exist."))
if fill['activate']: if fill.get('activate', False):
self.instance_file(fill, self.instance_file(fill,
tmp_dir, tmp_dir,
dest_dir, dest_dir,

View File

@ -1,28 +1,4 @@
"""Redefine Tiramisu object """Redefine Tiramisu object
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
try: try:
from tiramisu3 import DynOptionDescription from tiramisu3 import DynOptionDescription

View File

@ -1,29 +1,5 @@
"""loader """loader
flattened XML specific flattened XML specific
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from json import dumps from json import dumps
@ -264,6 +240,7 @@ class Variable(Common):
if hasattr(self.elt, key) and getattr(self.elt, key) is not None: if hasattr(self.elt, key) and getattr(self.elt, key) is not None:
value = getattr(self.elt, key) value = getattr(self.elt, key)
if isinstance(value, str): if isinstance(value, str):
print('pouet')
value = self.convert_str(value) value = self.convert_str(value)
elif isinstance(value, self.objectspace.value): elif isinstance(value, self.objectspace.value):
value = self.calculation_value(value, []) value = self.calculation_value(value, [])
@ -312,7 +289,7 @@ class Variable(Common):
if value is not None: if value is not None:
value = self.convert_str(value) value = self.convert_str(value)
return f"ParamValue({value})" return f"ParamValue({value})"
if param.type in ['number', 'boolean']: if param.type == 'number':
return f'ParamValue({param.text})' return f'ParamValue({param.text})'
if param.type == 'variable': if param.type == 'variable':
return self.build_param(param, function) return self.build_param(param, function)
@ -320,7 +297,7 @@ class Variable(Common):
return f'ParamInformation("{param.text}", None)' return f'ParamInformation("{param.text}", None)'
if param.type == 'suffix': if param.type == 'suffix':
return 'ParamSuffix()' return 'ParamSuffix()'
raise Exception(f'unknown type {param.type}') # pragma: no cover return '' # pragma: no cover
@staticmethod @staticmethod
def build_param(param, def build_param(param,

View File

@ -1,28 +1,5 @@
"""Rougail's tools """
utilitaires créole
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from typing import List from typing import List
from unicodedata import normalize, combining from unicodedata import normalize, combining

View File

@ -1,28 +1,4 @@
"""load XML file from directory """load XML file from directory
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from typing import List from typing import List
from os.path import join, isfile from os.path import join, isfile

View File

@ -1,29 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="Général">
<variable name="condition" type="string" description="No change">
<value>non</value>
</variable>
<variable name="mode_conteneur_actif" type="string" description="No change" >
<value>non</value>
</variable>
<variable name="mode_conteneur_actif2" type="string" description="No change">
<value>non</value>
</variable>
</family>
<family name="Général2">
</family>
</variables>
<constraints>
<condition name="hidden_if_in" source="condition">
<param>oui</param>
<target type="variable">mode_conteneur_actif</target>
<target type="variable">mode_conteneur_actif2</target>
<target type="family">Général2</target>
</condition>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1 +0,0 @@
{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"}

View File

@ -1,20 +0,0 @@
from importlib.machinery import SourceFileLoader
from importlib.util import spec_from_loader, module_from_spec
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
spec = spec_from_loader(loader.name, loader)
func = module_from_spec(spec)
loader.exec_module(func)
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(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}))
option_2 = OptionDescription(name="general", doc="Général", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -23,7 +23,7 @@ option_12 = StrOption(name="name", doc="name", default="/etc/file")
option_13 = StrOption(name="owner", doc="owner", default="root") option_13 = StrOption(name="owner", doc="owner", default="root")
option_14 = StrOption(name="source", doc="source", default="file") option_14 = StrOption(name="source", doc="source", default="file")
option_15 = BoolOption(name="templating", doc="templating", default=True) option_15 = BoolOption(name="templating", doc="templating", default=True)
option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("oui")}))) option_16 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}))
option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) 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_8 = OptionDescription(name="files", doc="files", children=[option_9])
option_7 = OptionDescription(name="test", doc="test", children=[option_8]) option_7 = OptionDescription(name="test", doc="test", children=[option_8])

View File

@ -1 +1 @@
{"rougail.general.condition": "oui", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/etc/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true, "services.test.files.file.activate": false} {"rougail.general.condition": "oui", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/etc/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true}

View File

@ -23,7 +23,7 @@ option_12 = StrOption(name="name", doc="name", default="/etc/file")
option_13 = StrOption(name="owner", doc="owner", default="root") option_13 = StrOption(name="owner", doc="owner", default="root")
option_14 = StrOption(name="source", doc="source", default="file") option_14 = StrOption(name="source", doc="source", default="file")
option_15 = BoolOption(name="templating", doc="templating", default=True) option_15 = BoolOption(name="templating", doc="templating", default=True)
option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("oui")}))) option_16 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}))
option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) 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_8 = OptionDescription(name="files", doc="files", children=[option_9])
option_7 = OptionDescription(name="test", doc="test", children=[option_8]) option_7 = OptionDescription(name="test", doc="test", children=[option_8])

View File

@ -23,7 +23,7 @@ option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
option_13 = StrOption(name="owner", doc="owner", default="root") option_13 = StrOption(name="owner", doc="owner", default="root")
option_14 = StrOption(name="source", doc="source", default="file1") option_14 = StrOption(name="source", doc="source", default="file1")
option_15 = BoolOption(name="templating", doc="templating", default=True) option_15 = BoolOption(name="templating", doc="templating", default=True)
option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("oui")}))) option_16 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}))
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
option_18 = StrOption(name="group", doc="group", default="root") option_18 = StrOption(name="group", doc="group", default="root")
option_19 = StrOption(name="mode", doc="mode", default="0644") option_19 = StrOption(name="mode", doc="mode", default="0644")
@ -31,7 +31,7 @@ option_20 = StrOption(name="name", doc="name", default="/tmp/file2")
option_21 = StrOption(name="owner", doc="owner", default="root") option_21 = StrOption(name="owner", doc="owner", default="root")
option_22 = StrOption(name="source", doc="source", default="file2") option_22 = StrOption(name="source", doc="source", default="file2")
option_23 = BoolOption(name="templating", doc="templating", default=True) option_23 = BoolOption(name="templating", doc="templating", default=True)
option_24 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("oui")}))) option_24 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}))
option_17 = OptionDescription(name="file2", doc="file2", children=[option_18, option_19, option_20, option_21, option_22, option_23, option_24]) option_17 = OptionDescription(name="file2", doc="file2", children=[option_18, option_19, option_20, option_21, option_22, option_23, option_24])
option_8 = OptionDescription(name="files", doc="files", children=[option_9, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9, option_17])
option_7 = OptionDescription(name="test", doc="test", children=[option_8]) option_7 = OptionDescription(name="test", doc="test", children=[option_8])

View File

@ -1 +1 @@
{"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, "services.test.files.file.activate": false} {"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

@ -23,7 +23,7 @@ option_12 = StrOption(name="name", doc="name", default="/tmp/file")
option_13 = StrOption(name="owner", doc="owner", default="root") option_13 = StrOption(name="owner", doc="owner", default="root")
option_14 = StrOption(name="source", doc="source", default="file") option_14 = StrOption(name="source", doc="source", default="file")
option_15 = BoolOption(name="templating", doc="templating", default=True) option_15 = BoolOption(name="templating", doc="templating", default=True)
option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(True)), kwargs={'default': ParamValue(False), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("unpossible")}))) option_16 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('unpossible'), 'reverse_condition': ParamValue(True)}))}))
option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) 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_8 = OptionDescription(name="files", doc="files", children=[option_9])
option_7 = OptionDescription(name="test", doc="test", children=[option_8]) option_7 = OptionDescription(name="test", doc="test", children=[option_8])

View File

@ -1 +1 @@
{"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, "services.test.files.file.activate": false} {"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

@ -23,7 +23,7 @@ option_12 = StrOption(name="name", doc="name", default="/tmp/file")
option_13 = StrOption(name="owner", doc="owner", default="root") option_13 = StrOption(name="owner", doc="owner", default="root")
option_14 = StrOption(name="source", doc="source", default="file") option_14 = StrOption(name="source", doc="source", default="file")
option_15 = BoolOption(name="templating", doc="templating", default=True) option_15 = BoolOption(name="templating", doc="templating", default=True)
option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(True)), kwargs={'default': ParamValue(False), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("unpossible")}))) option_16 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('unpossible'), 'reverse_condition': ParamValue(True)}))}))
option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) 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_8 = OptionDescription(name="files", doc="files", children=[option_9])
option_7 = OptionDescription(name="test", doc="test", children=[option_8]) option_7 = OptionDescription(name="test", doc="test", children=[option_8])

View File

@ -1 +1 @@
{"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, "services.test.files.file.activate": false} {"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

@ -23,7 +23,7 @@ option_12 = StrOption(name="name", doc="name", default="/tmp/file")
option_13 = StrOption(name="owner", doc="owner", default="root") option_13 = StrOption(name="owner", doc="owner", default="root")
option_14 = StrOption(name="source", doc="source", default="file") option_14 = StrOption(name="source", doc="source", default="file")
option_15 = BoolOption(name="templating", doc="templating", default=True) option_15 = BoolOption(name="templating", doc="templating", default=True)
option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(True)), kwargs={'default': ParamValue(False), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("unpossible"), 'condition_1': ParamOption(option_5, notraisepropertyerror=False, todict=False), 'expected_1': ParamValue("oui")}))) option_16 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('unpossible'), 'reverse_condition': ParamValue(True)})), Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}))
option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) 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_8 = OptionDescription(name="files", doc="files", children=[option_9])
option_7 = OptionDescription(name="test", doc="test", children=[option_8]) option_7 = OptionDescription(name="test", doc="test", children=[option_8])

View File

@ -1 +1 @@
{"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, "services.test.files.file.activate": false} {"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

@ -23,7 +23,7 @@ option_12 = StrOption(name="name", doc="name", default="/tmp/file")
option_13 = StrOption(name="owner", doc="owner", default="root") option_13 = StrOption(name="owner", doc="owner", default="root")
option_14 = StrOption(name="source", doc="source", default="file") option_14 = StrOption(name="source", doc="source", default="file")
option_15 = BoolOption(name="templating", doc="templating", default=True) option_15 = BoolOption(name="templating", doc="templating", default=True)
option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(True)), kwargs={'default': ParamValue(False), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("statique")}))) option_16 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('statique'), 'reverse_condition': ParamValue(True)}))}))
option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) 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_8 = OptionDescription(name="files", doc="files", children=[option_9])
option_7 = OptionDescription(name="test", doc="test", children=[option_8]) option_7 = OptionDescription(name="test", doc="test", children=[option_8])

View File

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

View File

@ -22,7 +22,7 @@ option_11 = StrOption(name="name", doc="name", default="/tmp/file1")
option_12 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="owner", doc="owner", default="root")
option_13 = StrOption(name="source", doc="source", default="file1") option_13 = StrOption(name="source", doc="source", default="file1")
option_14 = BoolOption(name="templating", doc="templating", default=True) option_14 = BoolOption(name="templating", doc="templating", default=True)
option_15 = BoolOption(name="activate", doc="activate", default=False) option_15 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({"disabled"}))
option_8 = OptionDescription(name="file1", doc="file1", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15]) option_8 = OptionDescription(name="file1", doc="file1", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15])
option_7 = OptionDescription(name="files", doc="files", children=[option_8]) option_7 = OptionDescription(name="files", doc="files", children=[option_8])
option_6 = OptionDescription(name="test", doc="test", children=[option_7]) option_6 = OptionDescription(name="test", doc="test", children=[option_7])