support auto_freeze with auto

This commit is contained in:
Emmanuel Garette 2021-01-06 22:20:33 +01:00
parent 8a07892276
commit 1a77416e6d
8 changed files with 24 additions and 6 deletions

View File

@ -15,8 +15,7 @@ FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie'
INTERNAL_FUNCTIONS = ['valid_enum', 'valid_in_network', 'valid_differ', 'valid_entier']
def get_actions_from_condition(condition_name: str,
) -> List[str]:
def get_actions_from_condition(condition_name: str) -> List[str]:
"""get action's name from a condition
"""
if condition_name.startswith('hidden_if_'):
@ -71,7 +70,8 @@ class ConstrainteAnnotator:
del self.objectspace.space.constraints
def convert_auto_freeze(self):
"""convert auto_freeze to continue
"""convert auto_freeze
only if FREEZE_AUTOFREEZE_VARIABLE == 'oui' this variable is frozen
"""
def _convert_auto_freeze(variable, namespace):
if variable.auto_freeze:

View File

@ -109,7 +109,9 @@ class FamilyAnnotator:
variable.mode = family_mode
if variable.hidden is True:
variable.frozen = True
if not variable.auto_save is True and 'force_default_on_freeze' not in vars(variable):
if not variable.auto_save is True and \
not variable.auto_freeze and \
'force_default_on_freeze' not in vars(variable):
variable.force_default_on_freeze = True
def change_variable_mode(self): # pylint: disable=C0111

View File

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

View File

@ -0,0 +1,15 @@
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 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_4 = ChoiceOption(properties=frozenset({'auto_freeze', 'basic', 'force_store_value', 'frozen', 'hidden', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamValue("oui")), kwargs={})), values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='general', 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])

View File

@ -28,9 +28,9 @@ excludes = set([])
#excludes = set(['01base_file_utfchar'])
test_ok -= excludes
test_raise -= excludes
#test_ok = ['10valid_enum_eosfunc']
#test_ok = ['01auto_autofreeze']
#test_ok = []
#test_raise = ['80redefine_double_error']
#test_raise = ['80auto_autofreeze']
#test_raise = []
ORI_DIR = getcwd()