Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tomotools
Nabu
Commits
78c82e25
Commit
78c82e25
authored
May 11, 2021
by
Pierre Paleo
Browse files
Remove unsupported params from nabu config
parent
6880ebdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
nabu/io/config.py
View file @
78c82e25
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment