labscript_utils.labconfig.LabConfig¶
- class labscript_utils.labconfig.LabConfig(config_path=PosixPath('/home/docs/labscript-suite/labconfig/build-19742703-project-24586-labscript-utils.ini'), required_params=None, defaults=None)[source]¶
Bases:
configparser.ConfigParser
- __init__(config_path=PosixPath('/home/docs/labscript-suite/labconfig/build-19742703-project-24586-labscript-utils.ini'), required_params=None, defaults=None)[source]¶
Methods
__init__
([config_path, required_params, ...])add_section
(section)Create a new section in the configuration.
clear
()defaults
()get
(section, option, *[, raw, vars, fallback])Get an option value for a given section.
getboolean
(section, option, *[, raw, vars, ...])getfloat
(section, option, *[, raw, vars, ...])getint
(section, option, *[, raw, vars, fallback])has_option
(section, option)Check for the existence of a given option in a given section. If the specified `section' is None or an empty string, DEFAULT is assumed. If the specified `section' does not exist, returns False.
has_section
(section)Indicate whether the named section is present in the configuration.
items
([section, raw, vars])Return a list of (name, value) tuples for each option in a section.
keys
()options
(section)Return a list of option names for the given section name.
optionxform
(optionstr)pop
(k[,d])If key is not found, d is returned if given, otherwise KeyError is raised.
popitem
()Remove a section from the parser and return it as a (section_name, section_proxy) tuple.
read
(filenames[, encoding])Read and parse a filename or an iterable of filenames.
read_dict
(dictionary[, source])Read configuration from a dictionary.
read_file
(f[, source])Like read() but the argument must be a file-like object.
read_string
(string[, source])Read configuration from a given string.
readfp
(fp[, filename])Deprecated, use read_file instead.
remove_option
(section, option)Remove an option.
remove_section
(section)Remove a file section.
sections
()Return a list of section names, excluding [DEFAULT]
set
(section, option[, value])Set an option.
setdefault
(k[,d])update
([E, ]**F)If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
values
()write
(fp[, space_around_delimiters])Write an .ini-format representation of the configuration state.
Attributes
BOOLEAN_STATES
NONSPACECRE
OPTCRE
OPTCRE_NV
SECTCRE
converters
- exception NoOptionError(option, section)¶
Bases:
configparser.Error
A requested option was not found.
- exception NoSectionError(section)¶
Bases:
configparser.Error
Raised when no section matches a requested option.