Graph Parameters

This submodule handles the variable flow part of BLUMYCELIUM. This is what allows BLUMYCELIUM to derive the set of instructions necessary to compte a vriable.

Graph Parameters

class blumycelium.graph_parameters.CodeBlock(init_code=None, return_statement=None)[source]

a code block of python code to run


replace the name of variables by their myc_back_variables references


run the code block


return a dictionary version of the code block

exception blumycelium.graph_parameters.ExecutionError(code)[source]
class blumycelium.graph_parameters.GraphParameter(uid=None)[source]

A graph of Parameters


add dependencies (other GraphParaemters) needed to compute the value

classmethod build_from_traversal(trav: dict, pull_origin_function=None)[source]

build a parameter from a traversal dictionary

make(visited_nodes=None, is_root=False)[source]

compute the value of the paraneter and return it

pp_traverse(full_representation=False, representation_attributes=['value', 'code_block', 'uid', 'python_id'], print_it=True)[source]

a pretty print of the graph representation with dependencies representation_attributes: list of field to print

set_code_block(init_code, return_statement, **dependencies)[source]

set the code block of the parameter

set_origin(uid, pull_origin_function=None)[source]

set the origin (address) of the parameter and function to retreive the value from the origin


set the function to pull jvalue form the origin


set the static value of the parameter

to_dict(reccursive=False, visited_nodes=None, copy_values=True)[source]

return a dict representation of the parameter recursively if asked to

traverse(visited_nodes=None, is_root=True, root_uid=None, to_dict=True)[source]

traverse the graph dependency tree and return a dictionary representing it

class blumycelium.graph_parameters.Value(*args, **kwargs)[source]

A wrapper for a graph parameter


compute a return the value represented by the Value object

pp_traverse(*args, **kwargs)[source]

pretty print the value and it’s dependencies

set_code_block(*args, **kwargs)[source]

set the code block to run


set the static value

to_dict(*args, **kwargs)[source]

return a dictionary representing the value

traverse(*args, **kwargs)[source]

return a dictionary representing the value and it’s dependencies