tributary.lazy package

Submodules

class tributary.lazy.graph.LazyGraph(*args, **kwargs)[source]

Bases: object

Wrapper class around a collection of lazy nodes.

node(name, readonly=False, nullable=True, value=None)[source]

method to create a lazy node attached to a graph.

Parameters:
  • name (str) – name to represent the node
  • readonly (bool) – whether the node should be settable
  • nullable (bool) – whether node can have value None
  • value (any) – initial value for node
Returns:

the newly constructed lazy node

Return type:

BaseNode

class tributary.lazy.node.Node(value=None, name='?', derived=False, readonly=False, nullable=False, callable=None, callable_args=None, callable_kwargs=None, callable_is_method=False, always_dirty=False, **kwargs)[source]

Bases: object

Class to represent an operation that is lazy

abs()
acos()
asin()
atan()
average(*others)
ceil()
cos()
dagre()
erf()
exp()
expire(second=None, minute=None, hour=None, day=None, day_of_week=None, week=None, month=None, maxsize=128)
float()
floor()
graph()
graphviz()
if_(satisfied_node, unsatisfied_node=None, *elseifs)

Node to return satisfied if if_node else unsatisfied

Parameters:
  • if_node (Node) – input booleans
  • satisfied_node (Node) – input to return if true
  • unsatisfied_node (Node) – input to return if False
  • elseifs (Tuple(Node)) – input of boolean/value pairs to evaluate as else if statements
inputs(name='')[source]

get node inputs, optionally by name

int()
interval(seconds=0, minutes=0, hours=0, days=0, weeks=0, months=0, years=0, maxsize=128)
invert()
isDirty()[source]
log()
print()
round(ndigits=0)
set(*args, **kwargs)[source]
setValue(value)[source]
sin()
sqrt()
sum(*others)
tan()
value()[source]
tributary.lazy.node.node(meth, memoize=True, **default_attrs)[source]

Convert a method into a lazy node

Since self is not defined at the point of method creation, you can pass in extra kwargs which represent attributes of the future self. These will be converted to node args during instantiation

The format is:

@node(my_existing_attr_as_an_arg=”_attribute_name”): def my_method(self):

pass
this will be converted into a graph of the form:
self._attribute_name -> my_method

e.g. as if self._attribute_name was passed as an argument to my_method, and converted to a node in the usual manner

tributary.lazy.utils.Expire(node, second=None, minute=None, hour=None, day=None, day_of_week=None, week=None, month=None, maxsize=128)[source]
tributary.lazy.utils.Interval(node, seconds=0, minutes=0, hours=0, days=0, weeks=0, months=0, years=0, maxsize=128)[source]