Quick definition of an optional parameter variable (#24)

Co-authored-by: gwen <gwenaelremond@free.fr>
Co-authored-by: gwen <gwenael.remond@free.fr>
Co-authored-by: Emmanuel Garette <egarette@silique.fr>
Reviewed-on: #24
Co-authored-by: gremond <gwenael.remond@protonmail.com>
Co-committed-by: gremond <gwenael.remond@protonmail.com>
This commit is contained in:
gremond 2024-09-04 17:30:38 +02:00 committed by gwen
parent 7bdc39e370
commit ccb4eff30b
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_path, variable.default.path_prefix, variable.path, variable.version, variable.namespace, variable.xmlfiles
)
if calculated_variable is None:
return
variable.type = calculated_variable.type
if variable.params is None and calculated_variable.params is not None:
variable.params = calculated_variable.params

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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