Commit 78c82e25 authored by Pierre Paleo's avatar Pierre Paleo
Browse files

Remove unsupported params from nabu config

parent 6880ebdd
......@@ -153,6 +153,7 @@ def validate_nabu_config(config):
if isinstance(config, str):
config = NabuConfigParser(config).conf_dict
res_config = {}
to_remove = []
for section, section_content in config.items():
# Ignore the "other" section
if section.lower() == "other":
......@@ -168,20 +169,27 @@ def validate_nabu_config(config):
continue # deleted key
if opt is None:
raise ValueError("Unknown option '%s' in section [%s]" % (key, section_updated))
if nabu_config[section_updated][key]["type"] == "unsupported":
to_remove.append((section_updated, key))
continue
validator = nabu_config[section_updated][key]["validator"]
if section_updated not in res_config: # missing section - handled later
continue
res_config[section_updated][key] = validator(section_updated, key, value)
# Remove 'unsupported' params
for param in to_remove:
res_config[param[0]].pop(param[1])
# Handle sections missing in config
for section in (set(nabu_config.keys()) - set(res_config.keys())):
res_config[section] = _extract_nabuconfig_section(section)
for key, value in res_config[section].items():
if nabu_config[section][key]["type"] == "unsupported":
continue
validator = nabu_config[section][key]["validator"]
res_config[section][key] = validator(section, key, value)
return res_config
def convert_dict_values(dic, val_replacements, bytes_tostring=False):
"""
Modify a dictionary to be able to export it with silx.io.dicttoh5
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment