mrpt.containers
mrpt-containers Python API — YAML configuration container.
Package Contents
- class mrpt.containers.YAML
Powerful YAML/JSON container for nested structured data.
Thread safety: Not thread-safe. Concurrent reads are safe when no writer is active; any concurrent write requires external synchronization (same policy as std::map / std::vector).
- append(value: Any) None
Append any Python value (str/int/float/bool/dict/list) to a sequence
- as_bool() bool
Extract scalar value as bool
- as_float() float
Extract scalar value as float
- as_int() int
Extract scalar value as int
- as_str() str
Extract scalar value as string
- clear() None
Clear all contents
- empty() bool
True if node is empty
- get_bool(key: str, default: bool = False) bool
Get bool value for key, with optional default
- get_float(key: str, default: float = 0.0) float
Get float value for key, with optional default
- get_int(key: str, default: int = 0) int
Get int value for key, with optional default
- get_str(key: str, default: str = '') str
Get string value for key, with optional default
- has(arg0: str) bool
Check if a key exists in a map node
- isMap() bool
True if this node is a map (dict-like)
- isNullNode() bool
True if this node is null/empty
- isScalar() bool
True if this node holds a scalar value
- isSequence() bool
True if this node is a sequence (list-like)
- items() list
Return list of (key, YAML) pairs
- keys() list[str]
Return list of map keys
- push_back(value: float) None
Append a numeric value to a sequence node
- push_back_str(value: str) None
Append a string value to a sequence node
- save_to_file(fileName: str) None
Save YAML to a file
- size() int
Number of elements
- to_dict() Any
Recursively convert a map node to a Python dict
- to_list() Any
Recursively convert a sequence node to a Python list
- to_string() str
Dump YAML to string
- values() list
Return list of map values as YAML nodes