YAML#
The Python bindings exposed part of the public functionality described in the YAML cpp reference.
In particular, for classes
Behavior,
BehaviorModulation,
Kinematics,
Disc,
LineSegment,
Neighbor
you can load objects of class T using T.load(...) or load_<t>(...):
Load a behavior from a YAML string.
- Parameters:
value – the YAML string.
- Returns:
The loaded behavior or
Noneif loading fails.- Return type:
Behavior| None
Load a modulation from a YAML string.
- Parameters:
value – the YAML string.
- Returns:
The loaded modulation or
Noneif loading fails.- Return type:
BehaviorModulation| None
Load a kinematics from a YAML string.
- Parameters:
value – the YAML string.
- Returns:
The loaded kinematics or
Noneif loading fails.- Return type:
Kinematics| None
Load a disc from a YAML string.
- Parameters:
value – the YAML string.
- Returns:
The loaded disc or
Noneif loading fails.- Return type:
Disc| None
Load a line from a YAML string.
- Parameters:
value – the YAML string.
- Returns:
The loaded line or
Noneif loading fails.- Return type:
LineSegment| None
Load a neighbor from a YAML string.
- Parameters:
value – the YAML string.
- Returns:
The loaded neighbor or
Noneif loading fails.- Return type:
Neighbor| None
You can dump objects of the same classes to YAML using T.dump() or
Dumps the object to a YAML-string.
- Returns:
The YAML representation
- Return type:
Schema#
Moreover, we expose methods that return JSON Schema for all supported types (Class.schema, Component.register_schema), and a function that generate the bundle schema used for validation in validate.
Register a custom JSON-schema for a class
Use it as:
>>> class MyClass(Class, name=...): >>> >>> @schema.register >>> def modifier(schema: navground.core.schema.Schema) -> None: >>> ...
- Parameters:
modifier – A modifier
- Returns:
The registered static method
- Return type:
staticmethod
bundle_schema() -> navground.core.schema.Schema
Returns the bundle json-schema
- Returns:
json-schema
- Return type: