mrpt.config

mrpt-config Python API.

Package Contents

class mrpt.config.CConfigFile(arg0: str)

C++ API: class mrpt::config::CConfigFile

CConfigFile

Bases: CConfigFileBase

This class allows loading and storing values and vectors of different types from “.ini” files easily.

discardSavingChanges() → None

Discards saving changes to the physical file.

getAssociatedFile() → str

Returns the associated file name.

setFileName(arg0: str) → None

Associates the object with a file.

writeNow() → None

Writes changes to the physical file immediately.

class mrpt.config.CConfigFileBase

C++ API: class mrpt::config::CConfigFileBase

Base class of configuration files (INI-like or YAML), with sections and key/value pairs.

clear() → None

Empties the config file.

getAllKeys(arg0: str) → list[str]

Returns a list with all keys in a section.

getAllSections() → list[str]

Returns a list with all section names.

getContentAsYAML() → str

Returns content as a YAML block.

keyExists(arg0: str, arg1: str) → bool

Checks if a key exists in a section.

read_bool(section: str, name: str, defValue: bool, failIfNotFound: bool = False) → bool

Reads a bool value with an optional default value.

read_double(section: str, name: str, defValue: float, failIfNotFound: bool = False) → float

Reads a double value with an optional default value.

read_float(section: str, name: str, defValue: float, failIfNotFound: bool = False) → float

Reads a float value with an optional default value.

read_int(section: str, name: str, defValue: int, failIfNotFound: bool = False) → int

Reads an integer value with an optional default value.

read_string(section: str, name: str, defValue: str = '', failIfNotFound: bool = False) → str

Reads a string value with an optional default value.

read_string_first_word(section: str, name: str, defValue: str = '', failIfNotFound: bool = False) → str

Reads the first word of a string value with an optional default value.

read_uint32_t(section: str, name: str, defValue: int, failIfNotFound: bool = False) → int

Reads a 32-bit unsigned integer value with an optional default value.

read_uint64_t(section: str, name: str, defValue: int, failIfNotFound: bool = False) → int

Reads a 64-bit unsigned integer value with an optional default value.

sectionExists(arg0: str) → bool

Checks if a section exists.

setContentFromYAML(arg0: str) → None

Sets content from a YAML block.

write(section: str, name: str, value: float, name_padding_width: int = -1, value_padding_width: int = -1, comment: str = '') → None
write(section: str, name: str, value: str, name_padding_width: int = -1, value_padding_width: int = -1, comment: str = '') → None

Writes a string value into the given section and key.

class mrpt.config.CConfigFileMemory

C++ API: class mrpt::config::CConfigFileMemory

CConfigFileMemory(arg0: list[str]) CConfigFileMemory(arg0: str)

Bases: CConfigFileBase

A configuration file kept in memory, initialized from a text string.

getContent() → str

Returns the current content.

setContent(arg0: list[str]) → None
setContent(arg0: str) → None

Sets content from a single string.

class mrpt.config.CLoadableOptions

C++ API: class mrpt::config::CLoadableOptions

This is a virtual base class for sets of options than can be loaded from and/or saved to configuration plain-text files.

dumpToConsole() → None

Dumps options to the console.

dumpToString() → str

Returns the options as human-readable text, as dumpToConsole() prints them.

loadFromConfigFile(source: CConfigFileBase, section: str) → None

Loads options from a configuration file section.

loadFromConfigFileName(arg0: str, arg1: str) → None

Loads options directly from a file name.

saveToConfigFile(target: CConfigFileBase, section: str) → None

Saves options to a configuration file section.

saveToConfigFileName(arg0: str, arg1: str) → None

Saves options directly to a file name.

mrpt.config.MRPT_SAVE_NAME_PADDING() → int

Default padding for names.

mrpt.config.MRPT_SAVE_VALUE_PADDING() → int

Default padding for values.

mrpt.config.config_parser(arg0: str) → str

Parses a configuration document.