Util API

The Util API, located under the bonobo.util namespace, contains helpers functions and decorators to work with and inspect transformations, graphs, and nodes.

class bonobo.util.ValueHolder(value)[source]

Bases: object

Decorator holding a value in a given memory adress, effectively allowing to “hold” even an immutable typed value as the state of a node, allowing different actors to mutate it durably.

For the sake of concistency, all operator methods have been implemented (see https://docs.python.org/3/reference/datamodel.html) or at least all in a certain category, but it feels like a more correct method should exist, like with a getattr-something on the value. Let’s see later.

get()[source]
set(new_value)[source]
value
bonobo.util.get_attribute_or_create(obj, attr, default)[source]
bonobo.util.get_name(mixed)[source]
bonobo.util.inspect_node(mixed, *, _partial=None)[source]

If the given argument is somehow a bonobo.config.Configurable object (either a subclass, an instance, or a partially configured instance), then it will return a ConfigurableInspection namedtuple, used to inspect the configurable metadata (options). If you want to get the option values, you don’t need this, it is only usefull to perform introspection on a configurable.

If it’s not looking like a configurable, it will raise a TypeError.

Parameters:mixed
Returns:ConfigurableInspection
Raise:TypeError
bonobo.util.isbag(mixed)[source]

Check if the given argument is an instance of a bonobo.Bag.

Parameters:mixed
Returns:bool
bonobo.util.isconfigurable(mixed)[source]

Check if the given argument is an instance of bonobo.config.Configurable.

Parameters:mixed
Returns:bool
bonobo.util.isconfigurabletype(mixed)[source]

Check if the given argument is an instance of bonobo.config.ConfigurableMeta, meaning it has all the plumbery necessary to build bonobo.config.Configurable-like instances.

Parameters:mixed
Returns:bool
bonobo.util.iscontextprocessor(x)[source]

Check if the given argument is an instance of bonobo.config.ContextProcessor.

Parameters:mixed
Returns:bool
bonobo.util.iserrorbag(mixed)[source]

Check if the given argument is an instance of an bonobo.ErrorBag.

Parameters:mixed
Returns:bool
bonobo.util.isloopbackbag(mixed)[source]

Check if the given argument is an instance of a bonobo.Bag, marked for loopback behaviour.

Parameters:mixed
Returns:bool
bonobo.util.ismethod(mixed)[source]

Check if the given argument is an instance of bonobo.config.Method.

Parameters:mixed
Returns:bool
bonobo.util.isoption(mixed)[source]

Check if the given argument is an instance of bonobo.config.Option.

Parameters:mixed
Returns:bool
bonobo.util.istype(mixed)[source]

Check if the given argument is a type object.

Parameters:mixed
Returns:bool