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
4 changed files with 4 additions and 5 deletions
Showing only changes of commit 2d4ba343ae - Show all commits

View file

@ -83,8 +83,8 @@ class NotFoundError(Exception):
## ---- specific exceptions ----
class VariableCalculationDependencyError(Exception):
"""When an 'optional=true' attribute is set, and
the target variable doesn't exists.
"""When an attribute is set, and
the target of this attribute doesn't exists.
"""
gremond marked this conversation as resolved Outdated

This comment should be more generic, maybe in future we will use it for a new attribute.

This comment should be more generic, maybe in future we will use it for a new attribute.
def __init__(self, msg, errno, xmlfiles):
if xmlfiles:

View file

@ -432,9 +432,6 @@ class _VariableCalculation(Calculation):
if self.optional:
msg = f'the dependent variable was not found "{self.optional}" for variable "{self.path}"'
raise VariableCalculationDependencyError(msg, 90, self.xmlfiles)
else:
msg = f'Variable not found "{self.variable}" for attribute "{self.attribute_name}" for variable "{self.path}"'
raise DictConsistencyError(msg, 88, self.xmlfiles)
if not isinstance(variable, objectspace.variable):
# FIXME remove the pfff
raise Exception("pfff it's a family")

View file

@ -1,3 +1,4 @@
---
gremond marked this conversation as resolved Outdated

"---" missing

"---" missing
version: 1.1
#my_variable:
# multi: true

View file

@ -1,3 +1,4 @@
---
gremond marked this conversation as resolved Outdated

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing

"---" missing
version: 1.1

"---" missing

"---" missing
my_variable:
multi: true