Resources

This is the base class for all resources in Graphbook. All Resources must inherit from this class.

See also

Decorator graphbook.resource() to create resources in a functional way.

class graphbook.resources.DictResource(val)

Bases: Resource

The list resource. This will parse the incoming value as a list of string.

class graphbook.resources.FunctionResource(val)

Bases: Resource

The function resource. This will parse the incoming value as a function.

class graphbook.resources.ListResource(val)

Bases: Resource

The list resource. This will parse the incoming value as a list of string.

class graphbook.resources.NumberResource(val)

Bases: Resource

The number resource. This will parse the incoming value as a float.

class graphbook.resources.Resource(val='')

Bases: object

The base class for all resources in Graphbook. All resources should be a descendant from this class. Also acts as the resource for string values.

log(msg, type='info')

Logs the value of the resource.

set_context(**context)

Sets the context of the step. This is useful for setting the node_id and node_name of the step.

Parameters:

**context – The context to set