[BACKEND] actual fix
This commit is contained in:
parent
d373935fff
commit
7234c8d116
4 changed files with 24 additions and 2 deletions
|
|
@ -288,6 +288,14 @@ class Script:
|
|||
unresolvable=unresolvable,
|
||||
)
|
||||
|
||||
for lambda_func in current_var.lambdas:
|
||||
if lambda_func.value in self._functions:
|
||||
subset_to_resolve |= self._recursive_get_unresolved_output_filter_variables(
|
||||
current_var=self._functions[lambda_func.value],
|
||||
subset_to_resolve=subset_to_resolve,
|
||||
unresolvable=unresolvable,
|
||||
)
|
||||
|
||||
return subset_to_resolve
|
||||
|
||||
def _get_unresolved_output_filter(
|
||||
|
|
|
|||
|
|
@ -171,7 +171,17 @@ class VariableDependency(ABC):
|
|||
-------
|
||||
True if it contains all input variables as a dependency. False otherwise.
|
||||
"""
|
||||
for custom_function in self.custom_functions:
|
||||
# If there are lambdas, see if they are custom functions. If so, check them
|
||||
custom_functions_to_check = self.custom_functions
|
||||
for lambda_func in self.lambdas:
|
||||
if lambda_func.value in custom_function_definitions:
|
||||
custom_functions_to_check.add(
|
||||
ParsedCustomFunction(
|
||||
name=lambda_func.value, num_input_args=lambda_func.num_input_args()
|
||||
)
|
||||
)
|
||||
|
||||
for custom_function in custom_functions_to_check:
|
||||
if not custom_function_definitions[custom_function.name].is_subset_of(
|
||||
variables=variables, custom_function_definitions=custom_function_definitions
|
||||
):
|
||||
|
|
|
|||
|
|
@ -241,6 +241,10 @@ def _validate_formatter(
|
|||
variable_names = {var.name for var in parsed.variables}
|
||||
custom_function_names = {f"%{func.name}" for func in parsed.custom_functions}
|
||||
|
||||
for lambda_func in parsed.lambdas:
|
||||
if lambda_func in mock_script.function_names:
|
||||
custom_function_names.add(lambda_func.value)
|
||||
|
||||
if not variable_names.issubset(mock_script.variable_names):
|
||||
raise StringFormattingVariableNotFoundException(
|
||||
"contains the following variables that do not exist: "
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class TestLambdaFunction:
|
|||
Script(
|
||||
{
|
||||
"the_array": "{ ['a', 'B', 'c', 'D'] }",
|
||||
"output": "{ %array_apply(the_array, %lower) }",
|
||||
"output": "{ %array_apply(the_array, %custom_cap) }",
|
||||
"should_lower": "{%bool(True)}",
|
||||
"%custom_cap": """{
|
||||
%if(
|
||||
|
|
|
|||
Loading…
Reference in a new issue