API Reference

Submodules

msa.config module

class msa.config.Config(config_file: str, sections: Dict[str, msa.config.Section])[source]

Bases: object

A wrapper class for storing and accessing multiple sections

exception msa.config.ConfigError(sec: str, key: str, val: str, msg: str, index: int = 0)[source]

Bases: Exception

A type of exception to be used when encountering invalid configuration settings

index() → int[source]
key() → str[source]
message() → str[source]
section() → str[source]
value() → str[source]
class msa.config.Section(name: str)[source]

Bases: object

Holds a group of keys, each key can have multiple or no values assigned

create_key(key: str) → None[source]
get_all(key: str) → List[str][source]

Returns a list of all values within a given key

get_entries() → List[str][source]

Returns a list of all existing keys, even if the keys are empty

has(key: str) → bool[source]
push(key: str, val: str) → None[source]

Adds a value to the end of a key, even if there are empty values

set(key: str, index: int, val: str) → None[source]
msa.config.load(filepath: str) → msa.config.Config[source]

Loads a configuration file into a Config object for use within the code

msa.config.save(config: msa.config.Config, filepath: str) → None[source]

Saves a Config object as a file to the provided file path

msa.var module

class msa.var.Expander[source]

Bases: object

Holds variables for substitution in strings

expand(text: str) → str[source]

Replaces any variables within a string to their values if any, variables are preceded by $

get_value(var: str) → str[source]
register_protected(var: str, val: str) → None[source]
register_var(var: str) → None[source]
set_value(var: str, val: str) → None[source]
unregister_protected(var: str) → None[source]
unregister_var(var: str) → None[source]

Module contents