xoa.cfgm.filter_section
- xoa.cfgm.filter_section(sec, cfgfilter, default=False)[source]
Recursively filter a section according to a dict of specifications
When encountering an option of
sec
, it removed if its value incfgfilter
is set to False. When not found, it default to the__default__
key ofcfgfilter
. And if the__default__
is not found, it defaults toFalse
(filtered out). When an option is a section and its value incfgfilter
is a dictionary, this subsection is filtered in the same way with the value as restrictions (cfgfilter[subsection]
).- Parameters:
sec – A
configobj.Section
instance.cfgfilter – A dictionary tree with the same structure as
sec
.