diff --git a/python/dune/perftool/options.py b/python/dune/perftool/options.py index c3fffbc52f4a5fa53ddf06545e35ff9e24b33518..067d6da638b6c42101ace4ea2910bd66c0bd659b 100644 --- a/python/dune/perftool/options.py +++ b/python/dune/perftool/options.py @@ -123,21 +123,20 @@ def update_options_from_commandline(opt): def update_options_from_inifile(opt): """ Return an options array object with updated values from an inifile """ if opt.ini_file: - def parse_ini(section): + def parse_ini(section, opttype): def _fix_types(k, v): - if hasattr(type(opt), k) and getattr(type(opt), k).type is bool: + if hasattr(opttype, k) and getattr(opttype, k).type is bool: return bool(eval(v)) - if hasattr(type(opt), k): - return getattr(type(opt), k).type(v) + if hasattr(opttype, k): + return getattr(opttype, k).type(v) return v ini = parse_ini_file(opt.ini_file).get(section, {}) return {k: _fix_types(k, v) for k, v in ini.items()} - opt = opt.copy(**parse_ini("formcompiler")) - + opt = opt.copy(**parse_ini("formcompiler", PerftoolGlobalOptionsArray)) # Also parse form-specific options for form in [i.strip() for i in opt.operators.split(",")]: - _form_options[form] = PerftoolFormOptionsArray(**parse_ini("formcompiler.{}".format(form))) + _form_options[form] = PerftoolFormOptionsArray(**parse_ini("formcompiler.{}".format(form), PerftoolFormOptionsArray)) return opt