From 25d4fb9db4edd2c5a9b925c3b9713456694cbf8e Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 10 Jan 2021 16:53:41 +0100 Subject: [PATCH] remove oui/non yes/no ... types --- .../80unknown_type/errno_36 => FIXME | 0 src/rougail/annotator/constrainte.py | 28 ++++++++----------- src/rougail/annotator/property.py | 20 ++++--------- src/rougail/annotator/service.py | 2 +- src/rougail/annotator/variable.py | 21 ++------------ src/rougail/data/rougail.dtd | 2 +- src/rougail/tiramisureflector.py | 1 - .../00load_autofreeze/00-base.xml | 4 +-- .../00load_autofreeze/tiramisu/base.py | 4 +-- .../00load_autofreezeexpert/00-base.xml | 4 +-- .../00load_autofreezeexpert/tiramisu/base.py | 4 +-- .../dictionaries/00load_autosave/00-base.xml | 2 +- .../00load_autosave/tiramisu/base.py | 2 +- .../00load_autosaveexpert/00-base.xml | 2 +- .../00load_autosaveexpert/tiramisu/base.py | 2 +- tests/dictionaries/00load_comment/00-base.xml | 2 +- .../00load_comment/tiramisu/base.py | 2 +- tests/dictionaries/00load_notype/00-base.xml | 2 +- .../00load_notype/tiramisu/base.py | 2 +- tests/dictionaries/00load_save/00-base.xml | 2 +- .../dictionaries/00load_save/tiramisu/base.py | 2 +- .../dictionaries/00load_subfolder/99-base.xml | 2 +- .../00load_subfolder/subfolder/00-base.xml | 2 +- .../00load_subfolder/tiramisu/base.py | 4 +-- .../01auto_autofreeze/00-base.xml | 4 +-- .../01auto_autofreeze/tiramisu/base.py | 4 +-- tests/dictionaries/01auto_base/00-base.xml | 4 +-- .../dictionaries/01auto_base/tiramisu/base.py | 4 +-- .../01auto_withoutparam/00-base.xml | 4 +-- .../01auto_withoutparam/tiramisu/base.py | 4 +-- .../01base_file_include/00-base.xml | 2 +- .../01base_file_include/tiramisu/base.py | 2 +- .../01base_file_patch/00-base.xml | 2 +- .../01base_file_patch/tiramisu/base.py | 2 +- .../01base_file_utfchar/00-base.xml | 2 +- .../01base_file_utfchar/tiramisu/base.py | 2 +- tests/dictionaries/01base_multi/00-base.xml | 2 +- .../01base_multi/tiramisu/base.py | 2 +- .../01base_var_name_same_family/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../01fill_autofreeze/00-base.xml | 6 ++-- .../01fill_autofreeze/tiramisu/base.py | 6 ++-- .../dictionaries/01fill_autosave/00-base.xml | 4 +-- .../01fill_autosave/tiramisu/base.py | 4 +-- tests/dictionaries/01fill_base/00-base.xml | 4 +-- .../dictionaries/01fill_base/tiramisu/base.py | 4 +-- .../01fill_baseaccent/00-base.xml | 4 +-- .../01fill_baseaccent/tiramisu/base.py | 4 +-- .../dictionaries/01fill_mandatory/00-base.xml | 4 +-- .../01fill_mandatory/tiramisu/base.py | 4 +-- tests/dictionaries/01fill_number/00-base.xml | 2 +- .../01fill_number/tiramisu/base.py | 2 +- .../01fill_only_optional/00-base.xml | 4 +-- .../01fill_only_optional/tiramisu/base.py | 4 +-- .../dictionaries/01fill_optional/00-base.xml | 4 +-- .../01fill_optional/tiramisu/base.py | 4 +-- .../01hidden_if_in_autofreeze/00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../dictionaries/01separator_base/00-base.xml | 2 +- .../01separator_base/tiramisu/base.py | 2 +- .../01separator_neverhidden/00-base.xml | 2 +- .../01separator_neverhidden/tiramisu/base.py | 2 +- .../02autosave_hidden_frozenifin/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10autosave_hidden/00-base.xml | 2 +- .../10autosave_hidden/tiramisu/base.py | 2 +- .../10check_valid_differ/00-base.xml | 4 +-- .../10check_valid_differ/tiramisu/base.py | 4 +-- .../10check_valid_differ_add/00-base.xml | 6 ++-- .../10check_valid_differ_add/tiramisu/base.py | 6 ++-- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../10check_valid_in_network/00-base.xml | 2 +- .../10check_valid_in_network/tiramisu/base.py | 2 +- .../10check_valid_in_network_cidr/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10check_valid_ipnetmask/00-base.xml | 2 +- .../10check_valid_ipnetmask/tiramisu/base.py | 2 +- .../10leadership_append/00-base.xml | 2 +- .../10leadership_append/tiramisu/base.py | 2 +- .../10leadership_auto/00-base.xml | 2 +- .../10leadership_auto/tiramisu/base.py | 2 +- .../10leadership_autoleader/00-base.xml | 2 +- .../10leadership_autoleader/tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10leadership_autosaveexpert/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10leadership_familyaccent/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10leadership_leader_hidden/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10leadership_leadermandatory/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10leadership_mandatory/00-base.xml | 2 +- .../10leadership_mandatory/tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10leadership_multi/00-base.xml | 2 +- .../10leadership_multi/tiramisu/base.py | 2 +- .../10load_disabled_if_in/00-base.xml | 6 ++-- .../10load_disabled_if_in/tiramisu/base.py | 6 ++-- .../10load_disabled_if_in_none/00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../00-base.xml | 8 +++--- .../tiramisu/base.py | 8 +++--- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../10load_disabledifin_fallback/00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../10load_frozenifin/00-base.xml | 6 ++-- .../10load_frozenifin/tiramisu/base.py | 6 ++-- .../10load_frozenifin_auto/00-base.xml | 6 ++-- .../10load_frozenifin_auto/tiramisu/base.py | 6 ++-- .../10load_frozenifin_multiparam/00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../10load_frozenifin_noexist/00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../10load_frozenifnotin/00-base.xml | 6 ++-- .../10load_frozenifnotin/tiramisu/base.py | 6 ++-- .../10load_frozenifnotin_noexist/00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../10load_hidden_if_family/00-base.xml | 8 +++--- .../10load_hidden_if_family/tiramisu/base.py | 8 +++--- .../10load_leadership/00-base.xml | 2 +- .../10load_leadership/tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10load_leadership_description/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10load_leadership_name/00-base.xml | 2 +- .../10load_leadership_name/tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10load_leadership_submulti/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10load_mandatoryifin/00-base.xml | 2 +- .../10load_mandatoryifin/tiramisu/base.py | 2 +- .../00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../10load_multivalue/00-base.xml | 2 +- .../10load_multivalue/tiramisu/base.py | 2 +- .../10valid_enum_accent/00-base.xml | 2 +- .../10valid_enum_accent/tiramisu/base.py | 2 +- .../10valid_enum_base/00-base.xml | 2 +- .../10valid_enum_base/tiramisu/base.py | 2 +- .../10valid_enum_base_redefine/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10valid_enum_leader/00-base.xml | 2 +- .../10valid_enum_leader/tiramisu/base.py | 2 +- .../10valid_enum_mandatory/00-base.xml | 2 +- .../10valid_enum_mandatory/tiramisu/base.py | 2 +- .../10valid_enum_multi/00-base.xml | 2 +- .../10valid_enum_multi/tiramisu/base.py | 2 +- .../10valid_enum_none/00-base.xml | 2 +- .../10valid_enum_none/tiramisu/base.py | 2 +- .../10valid_enum_number/00-base.xml | 2 +- .../10valid_enum_number/tiramisu/base.py | 2 +- .../10valid_enum_numberdefault/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10valid_enum_param_empty/00-base.xml | 2 +- .../10valid_enum_param_empty/tiramisu/base.py | 2 +- .../10valid_enum_param_empty2/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../11disabled_if_in_filelist/00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 8 +++--- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 8 +++--- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 8 +++--- .../00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../dictionaries/20family_append/00-base.xml | 2 +- .../dictionaries/20family_append/01-base.xml | 2 +- .../20family_append/tiramisu/base.py | 4 +-- .../20family_appendaccent/00-base.xml | 4 +-- .../20family_appendaccent/01-base.xml | 2 +- .../20family_appendaccent/02-base.xml | 2 +- .../20family_appendaccent/tiramisu/base.py | 8 +++--- tests/dictionaries/20family_empty/00-base.xml | 2 +- .../20family_empty/tiramisu/base.py | 2 +- .../dictionaries/20family_hidden/00-base.xml | 2 +- .../20family_hidden/tiramisu/base.py | 2 +- tests/dictionaries/20family_mode/00-base.xml | 2 +- .../20family_mode/tiramisu/base.py | 2 +- .../20family_modeleadership/00-base.xml | 2 +- .../20family_modeleadership/tiramisu/base.py | 2 +- tests/dictionaries/20notemplating/00-base.xml | 2 +- .../20notemplating/tiramisu/base.py | 2 +- tests/dictionaries/20override/00-base.xml | 2 +- .../dictionaries/20override/tiramisu/base.py | 2 +- tests/dictionaries/21family_empty/00-base.xml | 2 +- .../21family_empty/tiramisu/base.py | 2 +- .../dictionaries/40condition_base/00-base.xml | 8 +++--- .../40condition_base/tiramisu/base.py | 8 +++--- .../40condition_base_add/00-base.xml | 8 +++--- .../40condition_base_add/tiramisu/base.py | 8 +++--- .../40condition_fallback/00-base.xml | 8 +++--- .../40condition_fallback/tiramisu/base.py | 8 +++--- .../40condition_optional/00-base.xml | 6 ++-- .../40condition_optional/tiramisu/base.py | 6 ++-- .../40condition_optional_empty/00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../40hidden_if_in_group_fallback/00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../40ifin_leadership/00-base.xml | 6 ++-- .../40ifin_leadership/tiramisu/base.py | 4 +-- .../40ifin_leadershipauto/00-base.xml | 8 ++++-- .../40ifin_leadershipauto/tiramisu/base.py | 4 +-- .../00-base.xml | 8 ++++-- .../tiramisu/base.py | 4 +-- tests/dictionaries/40ifin_multi/00-base.xml | 6 ++-- .../40ifin_multi/tiramisu/base.py | 6 ++-- .../dictionaries/40ifin_validenum/00-base.xml | 4 +-- .../40ifin_validenum/tiramisu/base.py | 4 +-- .../dictionaries/50exists_exists/00-base.xml | 2 +- .../dictionaries/50exists_exists/01-base.xml | 2 +- .../50exists_exists/tiramisu/base.py | 2 +- .../50redefine_description/00-base.xml | 2 +- .../50redefine_description/tiramisu/base.py | 2 +- .../51exists_nonexists/00-base.xml | 4 +-- .../51exists_nonexists/01-base.xml | 2 +- .../51exists_nonexists/tiramisu/base.py | 6 ++-- .../51exists_redefine/00-base.xml | 2 +- .../51exists_redefine/tiramisu/base.py | 2 +- .../dictionaries/51redefine_auto/00-base.xml | 2 +- .../51redefine_auto/tiramisu/base.py | 2 +- .../51redefine_autofill/00-base.xml | 2 +- .../51redefine_autofill/tiramisu/base.py | 2 +- .../51redefine_family/00-base.xml | 4 +-- .../51redefine_family/tiramisu/base.py | 4 +-- .../dictionaries/51redefine_fill/00-base.xml | 2 +- .../51redefine_fill/tiramisu/base.py | 2 +- .../51redefine_fillauto/00-base.xml | 2 +- .../51redefine_fillauto/tiramisu/base.py | 2 +- .../dictionaries/51redefine_help/00-base.xml | 2 +- .../51redefine_help/tiramisu/base.py | 2 +- .../51redefine_hidden/00-base.xml | 2 +- .../51redefine_hidden/tiramisu/base.py | 2 +- .../dictionaries/51redefine_multi/00-base.xml | 2 +- .../51redefine_remove_condition/00-base.xml | 8 +++--- .../tiramisu/base.py | 8 +++--- .../00-base.xml | 10 +++---- .../tiramisu/base.py | 10 +++---- .../dictionaries/51redefine_type/00-base.xml | 2 +- .../dictionaries/51redefine_value/00-base.xml | 4 +-- .../51redefine_value/tiramisu/base.py | 4 +-- tests/dictionaries/51remove_fill/00-base.xml | 6 ++-- .../51remove_fill/tiramisu/base.py | 4 +-- .../52exists_redefine/00-base.xml | 2 +- .../52exists_redefine/tiramisu/base.py | 2 +- .../60action_external/00-base.xml | 2 +- .../60action_external/tiramisu/base.py | 2 +- .../60extra_externalspace/00-base.xml | 2 +- .../60extra_externalspaceauto/00-base.xml | 2 +- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../00-base.xml | 2 +- .../00-base.xml | 2 +- tests/dictionaries/60extra_group/00-base.xml | 4 +-- .../60extra_group/tiramisu/base.py | 4 +-- tests/dictionaries/60extra_help/00-base.xml | 4 +-- .../60extra_help/tiramisu/base.py | 4 +-- tests/dictionaries/60extra_load/00-base.xml | 4 +-- .../60extra_load/tiramisu/base.py | 4 +-- .../60extra_mandatory/00-base.xml | 4 +-- .../60extra_mandatory/tiramisu/base.py | 4 +-- .../60extra_name_family/00-base.xml | 4 +-- .../60extra_name_family/tiramisu/base.py | 4 +-- .../dictionaries/60extra_redefine/00-base.xml | 4 +-- .../60extra_redefine/tiramisu/base.py | 4 +-- .../60extra_separators/00-base.xml | 4 +-- .../60extra_separators/tiramisu/base.py | 4 +-- tests/dictionaries/60familyaction/00-base.xml | 2 +- .../60familyaction/tiramisu/base.py | 2 +- .../60familyaction_accent/00-base.xml | 2 +- .../60familyaction_accent/tiramisu/base.py | 2 +- .../60familyaction_mandatory/00-base.xml | 2 +- .../60familyaction/00-base.xml | 2 +- .../60familyaction_mandatory/tiramisu/base.py | 2 +- .../70container_files/00-base.xml | 2 +- .../70container_files/tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../70container_files_twice/00-base.xml | 2 +- .../70container_files_twice/tiramisu/base.py | 2 +- .../70container_filesmulti/00-base.xml | 2 +- .../70container_filesmulti/tiramisu/base.py | 2 +- .../70container_filesredefine/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../dictionaries/70container_new/00-base.xml | 2 +- .../70container_new/tiramisu/base.py | 2 +- .../70container_newnocont/00-base.xml | 2 +- .../70container_newnocont/tiramisu/base.py | 2 +- .../70container_newwithip/00-base.xml | 2 +- .../70container_newwithip/tiramisu/base.py | 2 +- .../70container_pathaccess/00-base.xml | 2 +- .../70container_pathaccess/tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../dictionaries/70container_save/00-base.xml | 2 +- .../70container_save/tiramisu/base.py | 2 +- .../70container_serviceaccess/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../70container_services/00-base.xml | 2 +- .../70container_services/tiramisu/base.py | 2 +- .../70services_unmanage/00-base.xml | 2 +- .../70services_unmanage/tiramisu/base.py | 2 +- .../80condition_not_exists_error/00-base.xml | 2 +- .../00-base.xml | 2 +- .../80condition_without_target/00-base.xml | 8 +++--- .../00-base.xml | 2 +- .../00-base.xml | 2 +- .../80extra_auto_freeze/00-base.xml | 4 +-- .../dictionaries/80family_change/00-base.xml | 4 +-- .../80family_changeaccent/00-base.xml | 4 +-- .../dictionaries/80family_several/00-base.xml | 2 +- tests/dictionaries/80fill_error/00-base.xml | 2 +- tests/dictionaries/80fill_multi/00-base.xml | 4 +-- .../80fill_not_exists/00-base.xml | 4 +-- .../80fill_unknown_function/00-base.xml | 4 +-- .../80hidden_if_in_filelist/00-base.xml | 4 +-- .../80leadership_auto_save/00-base.xml | 2 +- .../80leadership_autofreeze/00-base.xml | 2 +- .../80leadership_leader_not_multi/00-base.xml | 2 +- .../00-base.xml | 2 +- .../80leadership_not_ordered/00-base.xml | 2 +- .../80leadership_not_same_family/00-base.xml | 2 +- .../80leadership_notexists/00-base.xml | 2 +- .../80redefine_double_error/00-base.xml | 2 +- .../dictionaries/80redefine_error/00-base.xml | 2 +- .../80redefine_error/01-redefine.xml | 2 +- .../80redefine_fillerror/00-base.xml | 2 +- .../80redefine_notexists/00-base.xml | 2 +- .../80separator_multi/00-base.xml | 2 +- .../80separator_multi2/00-base.xml | 2 +- .../80separator_nonexists/00-base.xml | 2 +- tests/dictionaries/80unknown_type/errno_43 | 0 .../80valid_enum_base_redefine/00-base.xml | 2 +- .../80valid_enum_no_param/00-base.xml | 2 +- .../00-base.xml | 2 +- .../88valid_enum_not_number/00-base.xml | 2 +- .../88valid_enum_not_number2/00-base.xml | 2 +- .../00-base.xml | 2 +- 370 files changed, 618 insertions(+), 640 deletions(-) rename tests/dictionaries/80unknown_type/errno_36 => FIXME (100%) create mode 100644 tests/dictionaries/80unknown_type/errno_43 diff --git a/tests/dictionaries/80unknown_type/errno_36 b/FIXME similarity index 100% rename from tests/dictionaries/80unknown_type/errno_36 rename to FIXME diff --git a/src/rougail/annotator/constrainte.py b/src/rougail/annotator/constrainte.py index 921918b5..4a62c9e2 100644 --- a/src/rougail/annotator/constrainte.py +++ b/src/rougail/annotator/constrainte.py @@ -44,15 +44,15 @@ class ConstrainteAnnotator: objectspace, eosfunc_file, ): - if not hasattr(objectspace.space, 'constraints'): - return self.objectspace = objectspace eosfunc = SourceFileLoader('eosfunc', eosfunc_file).load_module() self.functions = dir(eosfunc) self.functions.extend(INTERNAL_FUNCTIONS) self.valid_enums = {} - - self.convert_auto_freeze() + if hasattr(objectspace.space, 'variables'): + self.convert_auto_freeze() + if not hasattr(objectspace.space, 'constraints'): + return if hasattr(self.objectspace.space.constraints, 'check'): self.check_check() self.check_valid_enum() @@ -73,15 +73,15 @@ class ConstrainteAnnotator: """convert auto_freeze only if FREEZE_AUTOFREEZE_VARIABLE == 'oui' this variable is frozen """ - def _convert_auto_freeze(variable, namespace): + def _convert_auto_freeze(variable): if variable.auto_freeze: - if namespace != Config['variable_namespace']: + if variable.namespace != Config['variable_namespace']: xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) - msg = _(f'auto_freeze is not allowed in extra "{namespace}" in {xmlfiles}') + msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}" in {xmlfiles}') raise DictConsistencyError(msg, 49) new_condition = self.objectspace.condition(variable.xmlfiles) new_condition.name = 'auto_frozen_if_not_in' - new_condition.namespace = namespace + new_condition.namespace = variable.namespace new_condition.source = FREEZE_AUTOFREEZE_VARIABLE new_param = self.objectspace.param(variable.xmlfiles) new_param.text = 'oui' @@ -90,25 +90,21 @@ class ConstrainteAnnotator: new_target.type = 'variable' new_target.name = variable.name new_condition.target = [new_target] + if not hasattr(self.objectspace.space, 'constraints'): + self.objectspace.space.constraints = self.objectspace.constraints(variable.xmlfiles) if not hasattr(self.objectspace.space.constraints, 'condition'): self.objectspace.space.constraints.condition = [] self.objectspace.space.constraints.condition.append(new_condition) for variables in self.objectspace.space.variables.values(): - if not hasattr(variables, 'family'): - continue for family in variables.family.values(): if not hasattr(family, 'variable'): continue for variable in family.variable.values(): if isinstance(variable, self.objectspace.leadership): for follower in variable.variable: - _convert_auto_freeze(follower, - variables.namespace, - ) + _convert_auto_freeze(follower) else: - _convert_auto_freeze(variable, - variables.namespace, - ) + _convert_auto_freeze(variable) def check_check(self): """valid and manage diff --git a/src/rougail/annotator/property.py b/src/rougail/annotator/property.py index 88b1e61b..bfdceb73 100644 --- a/src/rougail/annotator/property.py +++ b/src/rougail/annotator/property.py @@ -54,13 +54,8 @@ class PropertyAnnotator: if not isinstance(service, self.objectspace.family): continue self.convert_property(service) - if not hasattr(service, 'family'): - continue - self.convert_property(service) for family in service.family: self.convert_property(family) - if not hasattr(family, 'variable'): - continue for variable in family.variable: self.convert_property(variable) @@ -68,16 +63,11 @@ class PropertyAnnotator: """convert variables """ for variables in self.objectspace.space.variables.values(): - if not hasattr(variables, 'family'): - continue for family in variables.family.values(): self.convert_property(family) - if not hasattr(family, 'variable'): - continue for variable in family.variable.values(): - if isinstance(variable, self.objectspace.leadership): - self.convert_property(variable) - for follower in variable.variable: - self.convert_property(follower) - else: - self.convert_property(variable) + self.convert_property(variable) + if not isinstance(variable, self.objectspace.leadership): + continue + for follower in variable.variable: + self.convert_property(follower) diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index d99fd279..588afa3e 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -7,7 +7,7 @@ from ..error import DictConsistencyError # that shall not be present in the exported (flatened) XML ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace', 'remove_condition', 'path', 'instance_mode', 'index', 'is_in_leadership', - 'level', 'remove_fill', 'xmlfiles') + 'level', 'remove_fill', 'xmlfiles', 'type') KEY_TYPE = {'variable': 'symlink', diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index 3e75a6a9..d490276d 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -37,11 +37,9 @@ CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int), } -FORCE_CHOICE = {'oui/non': ['oui', 'non'], - 'on/off': ['on', 'off'], - 'yes/no': ['yes', 'no'], - 'schedule': ['none', 'daily', 'weekly', 'monthly'], - 'schedulemod': ['pre', 'post']} +FORCE_CHOICE = {'schedule': ['none', 'daily', 'weekly', 'monthly'], + 'schedulemod': ['pre', 'post'], + } RENAME_ATTIBUTES = {'description': 'doc'} @@ -63,8 +61,6 @@ class VariableAnnotator: variable, variable_type: str, ) -> None: - if not hasattr(variable, 'type'): - variable.type = 'string' if variable.type != 'symlink' and not hasattr(variable, 'description'): variable.description = variable.name if hasattr(variable, 'value'): @@ -83,7 +79,6 @@ class VariableAnnotator: self._convert_valid_enum(namespace, variable, ) - self._valid_type(variable) def _convert_valid_enum(self, namespace, @@ -111,20 +106,10 @@ class VariableAnnotator: self.objectspace.space.constraints.check.append(check) variable.type = 'string' - def _valid_type(self, - variable - ) -> None: - if variable.type not in CONVERT_OPTION: - xmlf = self.objectspace.display_xmlfiles(variable.xmlfiles) - msg = _(f'unvalid type "{variable.type}" for variable "{variable.name}" in {xmlf}') - raise DictConsistencyError(msg, 36) - def convert_variable(self): """convert variable """ for families in self.objectspace.space.variables.values(): - if not hasattr(families, 'family'): - continue families.doc = families.name for family in families.family.values(): family.doc = family.name diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index 9985dc55..aa9cbe68 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -90,7 +90,7 @@ - + diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index be6f161b..aef03d03 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -266,7 +266,6 @@ class Variable(Common): ) self.is_follower = is_follower convert_option = CONVERT_OPTION[elt.type] - del elt.type self.object_type = convert_option['opttype'] self.attrib.update(convert_option.get('initkwargs', {})) if self.object_type != 'SymLinkOption': diff --git a/tests/dictionaries/00load_autofreeze/00-base.xml b/tests/dictionaries/00load_autofreeze/00-base.xml index aefd954e..fd503179 100644 --- a/tests/dictionaries/00load_autofreeze/00-base.xml +++ b/tests/dictionaries/00load_autofreeze/00-base.xml @@ -2,10 +2,10 @@ - + non - + non diff --git a/tests/dictionaries/00load_autofreeze/tiramisu/base.py b/tests/dictionaries/00load_autofreeze/tiramisu/base.py index f54bce7f..8e2f715b 100644 --- a/tests/dictionaries/00load_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/00load_autofreeze/tiramisu/base.py @@ -8,8 +8,8 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_3 = ChoiceOption(properties=frozenset({'auto_freeze', 'basic', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_4 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non') +option_3 = StrOption(properties=frozenset({'auto_freeze', 'basic', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non') option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'basic'}), 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]) diff --git a/tests/dictionaries/00load_autofreezeexpert/00-base.xml b/tests/dictionaries/00load_autofreezeexpert/00-base.xml index 2c66f0dc..f344cdef 100644 --- a/tests/dictionaries/00load_autofreezeexpert/00-base.xml +++ b/tests/dictionaries/00load_autofreezeexpert/00-base.xml @@ -2,10 +2,10 @@ - + non - + non diff --git a/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py b/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py index 34cd6727..f01b4ad9 100644 --- a/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py +++ b/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py @@ -8,8 +8,8 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_3 = ChoiceOption(properties=frozenset({'auto_freeze', 'expert', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_4 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non') +option_3 = StrOption(properties=frozenset({'auto_freeze', 'expert', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non') option_2 = OptionDescription(name='general', doc='général', 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]) diff --git a/tests/dictionaries/00load_autosave/00-base.xml b/tests/dictionaries/00load_autosave/00-base.xml index 8825e85b..8be2a32d 100644 --- a/tests/dictionaries/00load_autosave/00-base.xml +++ b/tests/dictionaries/00load_autosave/00-base.xml @@ -2,7 +2,7 @@ - + non diff --git a/tests/dictionaries/00load_autosave/tiramisu/base.py b/tests/dictionaries/00load_autosave/tiramisu/base.py index 0353b8dd..fd39dd72 100644 --- a/tests/dictionaries/00load_autosave/tiramisu/base.py +++ b/tests/dictionaries/00load_autosave/tiramisu/base.py @@ -8,7 +8,7 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'basic', 'force_store_value', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_3 = StrOption(properties=frozenset({'basic', 'force_store_value', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non') option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'basic'}), children=[option_3]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/00load_autosaveexpert/00-base.xml b/tests/dictionaries/00load_autosaveexpert/00-base.xml index 7fa79f58..0ed16b71 100644 --- a/tests/dictionaries/00load_autosaveexpert/00-base.xml +++ b/tests/dictionaries/00load_autosaveexpert/00-base.xml @@ -2,7 +2,7 @@ - + non diff --git a/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py b/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py index a2270173..0e5f43a9 100644 --- a/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py +++ b/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py @@ -8,7 +8,7 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'expert', 'force_store_value', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_3 = StrOption(properties=frozenset({'expert', 'force_store_value', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non') option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'expert'}), children=[option_3]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/00load_comment/00-base.xml b/tests/dictionaries/00load_comment/00-base.xml index a5e543fe..3b468b1f 100644 --- a/tests/dictionaries/00load_comment/00-base.xml +++ b/tests/dictionaries/00load_comment/00-base.xml @@ -3,7 +3,7 @@ - diff --git a/tests/dictionaries/00load_comment/tiramisu/base.py b/tests/dictionaries/00load_comment/tiramisu/base.py index 1706e7d2..e7b834cb 100644 --- a/tests/dictionaries/00load_comment/tiramisu/base.py +++ b/tests/dictionaries/00load_comment/tiramisu/base.py @@ -8,7 +8,7 @@ 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='No change', multi=False, default='non', values=('oui', 'non')) +option_3 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non') option_2 = OptionDescription(name='general', doc='général', 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]) diff --git a/tests/dictionaries/00load_notype/00-base.xml b/tests/dictionaries/00load_notype/00-base.xml index aac6f7fe..05d4be90 100644 --- a/tests/dictionaries/00load_notype/00-base.xml +++ b/tests/dictionaries/00load_notype/00-base.xml @@ -2,7 +2,7 @@ -