configparser_check_options
- opthandler.configparser_check_options(config, known_options, sections=None, skip_missing_sec=False, case_sensitive=True, hyphens_are_underscores=False)[source]
Check if the options of a
ConfigParser
are contained in a list of known options.- Parameters:
config (
configparser.ConfigParser
) – TheConfigParser
instance whose options should be checked.known_options (
iterable
) – The list of known options. Note that the options of all given sections are checked against this list of known options.sections (
iterable
orstr
orNone
, optional) – The sections of config whose options should be checked. IfNone
, check all sections.skip_missing_sec (
bool
, optional) – IfTrue
, don’t raise an exception if a given section is not contained in config but instead simply skip this section.case_sensitive (
bool
, optional) – IfTrue
, respect the case (upper, lower, mixed) when comparing the options in config with the options in known_options.hyphens_are_underscores (
bool
, optional) – IfTrue
, don’t distinguish between hyphens ('-'
) and underscores ('_'
).
- Raises:
KeyError – If any section of config contains options that are not contained in known_options.