Welcome to Python-flavored Magnum! Please note that, while already being rather stable, this functionality is still considered experimental and some APIs might get changed without preserving full backwards compatibility.

corrade.utility.Configuration class

Parser and writer for configuration files

Methods

def add_group(self, name: str) -> ConfigurationGroup
Add a group
def group(self, name: str) -> ConfigurationGroup
Group
def save(self, /) -> None
Save the configuration
def save(self, filename: str) -> None
Save the configuration

Special methods

def __getitem__(self, key: str) -> str
Value
def __init__(self, /) -> None
Construct an empty configuration
def __init__(self, filename: str) -> None
Parse a configuration file
def __setitem__(self, key: str, value: str) -> None
Set a value
def __setitem__(self, key: str, value: float) -> None
Set a value
def __setitem__(self, key: str, value: int) -> None
Set a value
def __setitem__(self, key: str, value: bool) -> None
Set a value

Properties

has_groups: bool get
Whether this group has any subgroups
has_values: bool get
Whether this group has any values

Method documentation

def corrade.utility.Configuration.save(self, /) -> None

Save the configuration

Exceptions
IOError If the file can’t be saved

def corrade.utility.Configuration.save(self, filename: str) -> None

Save the configuration

Exceptions
IOError If the file can’t be saved

def corrade.utility.Configuration.__init__(self, filename: str) -> None

Parse a configuration file

Exceptions
IOError If filename contains a parse error