suppress separators

This commit is contained in:
Emmanuel Garette 2021-01-17 18:12:33 +01:00
parent fc2551a8d2
commit f0ba368f2a
66 changed files with 5 additions and 241 deletions

View File

@ -51,10 +51,10 @@ class VariableAnnotator:
def __init__(self, def __init__(self,
objectspace, objectspace,
): ):
if not hasattr(objectspace.space, 'variables'):
return
self.objectspace = objectspace self.objectspace = objectspace
if hasattr(self.objectspace.space, 'variables'):
self.convert_variable() self.convert_variable()
self.convert_separators()
def _convert_variable(self, def _convert_variable(self,
namespace: str, namespace: str,
@ -140,17 +140,3 @@ class VariableAnnotator:
variable, variable,
'variable', 'variable',
) )
def convert_separators(self): # pylint: disable=C0111,R0201
for family in self.objectspace.space.variables.values():
if not hasattr(family, 'separators'):
continue
if hasattr(family.separators, 'separator'):
for separator in family.separators.separator:
option = self.objectspace.paths.get_variable(separator.name)
if hasattr(option, 'separator'):
xmlfiles = self.objectspace.display_xmlfiles(separator.xmlfiles)
msg = _(f'{separator.name} already has a separator in {xmlfiles}')
raise DictConsistencyError(msg, 35)
option.separator = separator.text
del family.separators

View File

@ -79,7 +79,7 @@
<!ATTLIST override source CDATA #IMPLIED > <!ATTLIST override source CDATA #IMPLIED >
<!ATTLIST override templating (True|False) "True"> <!ATTLIST override templating (True|False) "True">
<!ELEMENT variables (family*, separators*)> <!ELEMENT variables (family*)>
<!ELEMENT family (variable*)> <!ELEMENT family (variable*)>
<!ATTLIST family name CDATA #REQUIRED> <!ATTLIST family name CDATA #REQUIRED>
<!ATTLIST family description CDATA #IMPLIED> <!ATTLIST family description CDATA #IMPLIED>
@ -107,11 +107,6 @@
<!ATTLIST variable remove_fill (True|False) "False"> <!ATTLIST variable remove_fill (True|False) "False">
<!ATTLIST variable test CDATA #IMPLIED> <!ATTLIST variable test CDATA #IMPLIED>
<!ELEMENT separators (separator*)>
<!ELEMENT separator (#PCDATA)>
<!ATTLIST separator name CDATA #REQUIRED>
<!ELEMENT value (#PCDATA)> <!ELEMENT value (#PCDATA)>
<!ELEMENT constraints ((fill* | check* | condition* | group*)*)> <!ELEMENT constraints ((fill* | check* | condition* | group*)*)>

View File

@ -8,7 +8,7 @@ from .annotator import ERASED_ATTRIBUTES, CONVERT_OPTION
FUNC_TO_DICT = [] FUNC_TO_DICT = []
FORCE_INFORMATIONS = ['help', 'test', 'separator', 'manage'] FORCE_INFORMATIONS = ['help', 'test', 'manage']
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi') ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi')

View File

@ -9,7 +9,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val" target="mode_conteneur_actif">

View File

@ -13,7 +13,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab

View File

@ -13,7 +13,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab

View File

@ -13,7 +13,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab

View File

@ -9,7 +9,6 @@
<value>0.527</value> <value>0.527</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab

View File

@ -9,7 +9,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val" target="mode_conteneur_actif">

View File

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

View File

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

View File

@ -1,15 +0,0 @@
from importlib.machinery import SourceFileLoader
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
for key, value in dict(locals()).items():
if key != ['SourceFileLoader', 'func']:
setattr(func, key, value)
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non')
option_3.impl_set_information("separator", "Établissement")
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

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

View File

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

View File

@ -1,15 +0,0 @@
from importlib.machinery import SourceFileLoader
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
for key, value in dict(locals()).items():
if key != ['SourceFileLoader', 'func']:
setattr(func, key, value)
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non')
option_3.impl_set_information("separator", "Établissement")
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -4,7 +4,6 @@
<family name="general"> <family name="general">
<variable name="mode_conteneur_actif3" redefine="True"/> <variable name="mode_conteneur_actif3" redefine="True"/>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -14,7 +14,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -14,7 +14,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -14,7 +14,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -11,7 +11,6 @@
<value>c</value> <value>c</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -10,7 +10,6 @@
<family name="enumfam" mode="expert"> <family name="enumfam" mode="expert">
<variable name="enumvar" type="string" description="multi" mandatory="True"/> <variable name="enumvar" type="string" description="multi" mandatory="True"/>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -11,7 +11,6 @@
<value>b</value> <value>b</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -9,7 +9,6 @@
<family name="enumfam" mode="expert"> <family name="enumfam" mode="expert">
<variable name="enumvar" type="string" description="multi" help="bla bla bla"/> <variable name="enumvar" type="string" description="multi" help="bla bla bla"/>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -9,7 +9,6 @@
<family name="enumfam" mode="expert"> <family name="enumfam" mode="expert">
<variable name="enumvar" type="string" description="multi" help="bla bla bla"/> <variable name="enumvar" type="string" description="multi" help="bla bla bla"/>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -13,7 +13,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab

View File

@ -13,7 +13,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab

View File

@ -6,7 +6,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -4,7 +4,6 @@
<family name="general"> <family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True"/> <variable name="mode_conteneur_actif" type="string" description="No change" hidden="True"/>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -6,7 +6,6 @@
<value>oui</value> <value>oui</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab

View File

@ -6,7 +6,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab

View File

@ -14,6 +14,5 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>

View File

@ -16,7 +16,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab

View File

@ -1,15 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="général">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>non</value>
</variable>
<variable name="activer_ejabberd" type="string" description="No change" hidden="True">
<value>non</value>
</variable>
</family>
</variables>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<rougail>
<variables>
<family name='ejabberd'>
<variable name="description" type="string">
<value>Exportation de la base de ejabberd</value>
</variable>
<variable name="day" type="schedule"></variable>
<variable name="mode" type="schedulemod">
<value>pre</value>
</variable>
</family>
<separators>
<separator name="extra.ejabberd.day">Séparateur</separator>
</separators>
</variables>
<constraints>
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
<param>non</param>
<param type='variable' name='condition_1' notraisepropertyerror='True'>activer_ejabberd</param>
<param name='match'>none</param>
<param name='mismatch'>daily</param>
</fill>
</constraints>
</rougail>

View File

@ -1 +0,0 @@
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": null, "extra.ejabberd.mode": "pre"}

View File

@ -1,21 +0,0 @@
from importlib.machinery import SourceFileLoader
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
for key, value in dict(locals()).items():
if key != ['SourceFileLoader', 'func']:
setattr(func, key, value)
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non')
option_4 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='activer_ejabberd', 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_7 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='description', doc='description', multi=False, default='Exportation de la base de ejabberd')
option_8 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='day', doc='day', multi=False, default=Calculation(func.calc_multi_condition, Params((ParamValue("non")), kwargs={'condition_1': ParamOption(option_4, notraisepropertyerror=True, todict=False), 'match': ParamValue("none"), 'mismatch': ParamValue("daily")})), values=('none', 'daily', 'weekly', 'monthly'))
option_8.impl_set_information("separator", "Séparateur")
option_9 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode', doc='mode', multi=False, default='pre', values=('pre', 'post'))
option_6 = OptionDescription(name='ejabberd', doc='ejabberd', properties=frozenset({'normal'}), children=[option_7, option_8, option_9])
option_5 = OptionDescription(name='extra', doc='extra', children=[option_6])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_5])

View File

@ -11,7 +11,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -140,7 +140,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</family> </family>
<family doc="" name="extra"> <family doc="" name="extra">
<family hidden="False" mode="basic" doc="test" name="test"> <family hidden="False" mode="basic" doc="test" name="test">

View File

@ -15,6 +15,5 @@
<value>/etc/mailname2</value> <value>/etc/mailname2</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>

View File

@ -19,6 +19,5 @@
<value>mailname2</value> <value>mailname2</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>

View File

@ -17,6 +17,5 @@
<value>mailname</value> <value>mailname</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>

View File

@ -6,7 +6,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -6,7 +6,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -14,6 +14,5 @@
<value>/etc/mailname</value> <value>/etc/mailname</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>

View File

@ -6,7 +6,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab

View File

@ -6,7 +6,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
</rougail> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab

View File

@ -6,7 +6,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -1,16 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>non</value>
</variable>
</family>
<separators>
<separator name="mode_conteneur_actif">Établissement</separator>
<separator name="mode_conteneur_actif">Établissement</separator>
</separators>
</variables>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

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

View File

@ -1,8 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<separators>
<separator name="mode_conteneur_actif">Établissement</separator>
</separators>
</variables>
</rougail>

View File

@ -1,16 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>non</value>
</variable>
</family>
<separators>
<separator name="mode_conteneur_actif">Établissement</separator>
<separator name="nonexist_variable">separator</separator>
</separators>
</variables>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -11,7 +11,6 @@
<value>c</value> <value>c</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -9,7 +9,6 @@
<family name="enumfam" mode="expert"> <family name="enumfam" mode="expert">
<variable name="enumvar" type="number" description="enumvar"/> <variable name="enumvar" type="number" description="enumvar"/>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>

View File

@ -11,7 +11,6 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<separators/>
</variables> </variables>
<constraints> <constraints>