Quick definition of an optional parameter variable #24

Merged
egarette merged 8 commits from optional_parameter_in_variable into develop 2024-09-04 17:30:38 +02:00
9 changed files with 12 additions and 0 deletions

View file

@ -138,6 +138,8 @@ class Annotator(Walk): # pylint: disable=R0903
calculated_variable, suffix = self.objectspace.paths.get_with_dynamic( calculated_variable, suffix = self.objectspace.paths.get_with_dynamic(
calculated_variable_path, variable.default.path_prefix, variable.path, variable.version, variable.namespace, variable.xmlfiles calculated_variable_path, variable.default.path_prefix, variable.path, variable.version, variable.namespace, variable.xmlfiles
) )
if calculated_variable is None:
return
variable.type = calculated_variable.type variable.type = calculated_variable.type
if variable.params is None and calculated_variable.params is not None: if variable.params is None and calculated_variable.params is not None:
variable.params = calculated_variable.params variable.params = calculated_variable.params

View file

@ -606,6 +606,9 @@ class SuffixCalculation(_SuffixCalculation):
self, self,
objectspace, objectspace,
) -> dict: ) -> dict:
suffix = {"type": "suffix"}
if self.suffix is not None:
suffix["suffix"] = self.suffix
return { return {
"function": "calc_value", "function": "calc_value",
"params": {None: [self.get_suffix()]}, "params": {None: [self.get_suffix()]},

View file

@ -1,5 +1,6 @@
from tiramisu import * from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('tests/dictionaries/../eosfunc/test.py') load_functions('tests/dictionaries/../eosfunc/test.py')
ALLOWED_LEADER_PROPERTIES.add("basic") ALLOWED_LEADER_PROPERTIES.add("basic")

View file

@ -1,5 +1,6 @@
from tiramisu import * from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('tests/dictionaries/../eosfunc/test.py') load_functions('tests/dictionaries/../eosfunc/test.py')
ALLOWED_LEADER_PROPERTIES.add("basic") ALLOWED_LEADER_PROPERTIES.add("basic")

View file

@ -1,5 +1,6 @@
from tiramisu import * from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('tests/dictionaries/../eosfunc/test.py') load_functions('tests/dictionaries/../eosfunc/test.py')
ALLOWED_LEADER_PROPERTIES.add("basic") ALLOWED_LEADER_PROPERTIES.add("basic")

View file

@ -1,5 +1,6 @@
from tiramisu import * from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('tests/dictionaries/../eosfunc/test.py') load_functions('tests/dictionaries/../eosfunc/test.py')
ALLOWED_LEADER_PROPERTIES.add("basic") ALLOWED_LEADER_PROPERTIES.add("basic")

View file

@ -1,5 +1,6 @@
from tiramisu import * from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('tests/dictionaries/../eosfunc/test.py') load_functions('tests/dictionaries/../eosfunc/test.py')
ALLOWED_LEADER_PROPERTIES.add("basic") ALLOWED_LEADER_PROPERTIES.add("basic")

View file

@ -1,5 +1,6 @@
from tiramisu import * from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('tests/dictionaries/../eosfunc/test.py') load_functions('tests/dictionaries/../eosfunc/test.py')
ALLOWED_LEADER_PROPERTIES.add("basic") ALLOWED_LEADER_PROPERTIES.add("basic")

View file

@ -5,6 +5,7 @@ varname:
- val1 - val1
dyn{{ suffix }}: dyn{{ suffix }}:
dynamic: dynamic:
type: variable
variable: _.varname variable: _.varname
optional: true optional: true
vardyn: vardyn: