diff --git a/python-libs/poulpe/basics.py b/python-libs/poulpe/basics.py index 3707fc8075fe8ac041abef03c5fd500eced66e74_cHl0aG9uLWxpYnMvcG91bHBlL2Jhc2ljcy5weQ==..e5db5ad56616ad3737ee248f59533162a78c8da7_cHl0aG9uLWxpYnMvcG91bHBlL2Jhc2ljcy5weQ== 100644 --- a/python-libs/poulpe/basics.py +++ b/python-libs/poulpe/basics.py @@ -64,10 +64,10 @@ print(f"{indent}{k} = {v}") -def get_one_value(data, key): +def get_one_value(data, key, default=None): key_path = key.split('.') sub = data for k in key_path: sub = sub.get(k) if sub is None: break @@ -68,9 +68,11 @@ key_path = key.split('.') sub = data for k in key_path: sub = sub.get(k) if sub is None: break + if sub is None: + sub = default return sub diff --git a/python-libs/poulpe/benchmarks.py b/python-libs/poulpe/benchmarks.py index 3707fc8075fe8ac041abef03c5fd500eced66e74_cHl0aG9uLWxpYnMvcG91bHBlL2JlbmNobWFya3MucHk=..e5db5ad56616ad3737ee248f59533162a78c8da7_cHl0aG9uLWxpYnMvcG91bHBlL2JlbmNobWFya3MucHk= 100644 --- a/python-libs/poulpe/benchmarks.py +++ b/python-libs/poulpe/benchmarks.py @@ -66,8 +66,8 @@ def name(self): return self._data['meta']['name'] - def get_var(self, key): - return poulpe.get_one_value(self._data, key) + def get_var(self, key, default=None): + return poulpe.get_one_value(self._data, key, default=default) @property def selected_variants(self):