# Path: robograph/datamodel/base/graph.py
# class Graph:
#     def __init__(self, name, nodes=None):
#     def root_node(self):
#     def nodes(self):
#     def edges(self):
#     def nxgraph(self):
#     def name(self):
#     def add_node(self, node):
#     def add_nodes(self, sequence_of_nodes):
#     def remove_node(self, node):
#     def remove_nodes(self, sequence_of_nodes):
#     def connect(self, node_from, node_to, output_label):
#     def has_isles(self):
#     def execute(self, result_label="result"):
#     def reset(self):
#     def __repr__(self):
#     def __len__(self):
# 
# Path: robograph/datamodel/base/exceptions.py
# class NodeOutputLabelUndefinedError(Exception):
# class GraphError(Exception):
# class NodeConnectionError(GraphError):
# class NodeDeletionError(GraphError):
# class StopGraphExecutionSignal(Exception):
# class GraphExecutionError(GraphError):
# 
# Path: robograph/datamodel/nodes/lib/value.py
# class Value(node.Node):
#     def output(self):
# 
# Path: robograph/datamodel/nodes/lib/apply.py
# class Apply(node.Node):
#     def output(self):


from robograph.datamodel.base import graph, exceptions
from robograph.datamodel.nodes.lib import value, apply
# Demo on how to stop a graph execution



def execution_stop(number):

    def stop_here(value):
        if value >= 0:
            raise exceptions.StopGraphExecutionSignal('arg is positive')
        raise exceptions.StopGraphExecutionSignal('arg is negative')

    v = value.Value(value=number)

# Path: robograph/datamodel/base/graph.py
# class Graph:
#     def __init__(self, name, nodes=None):
#     def root_node(self):
#     def nodes(self):
#     def edges(self):
#     def nxgraph(self):
#     def name(self):
#     def add_node(self, node):
#     def add_nodes(self, sequence_of_nodes):
#     def remove_node(self, node):
#     def remove_nodes(self, sequence_of_nodes):
#     def connect(self, node_from, node_to, output_label):
#     def has_isles(self):
#     def execute(self, result_label="result"):
#     def reset(self):
#     def __repr__(self):
#     def __len__(self):
# 
# Path: robograph/datamodel/base/exceptions.py
# class NodeOutputLabelUndefinedError(Exception):
# class GraphError(Exception):
# class NodeConnectionError(GraphError):
# class NodeDeletionError(GraphError):
# class StopGraphExecutionSignal(Exception):
# class GraphExecutionError(GraphError):
# 
# Path: robograph/datamodel/nodes/lib/value.py
# class Value(node.Node):
#     def output(self):
# 
# Path: robograph/datamodel/nodes/lib/apply.py
# class Apply(node.Node):
#     def output(self):


# Path: robograph/sample_graphs/execution_stop.py
from robograph.datamodel.base import graph, exceptions
from robograph.datamodel.nodes.lib import value, apply

# Demo on how to stop a graph execution



def execution_stop(number):

    def stop_here(value):
        if value >= 0:
            raise exceptions.StopGraphExecutionSignal('arg is positive')
        raise exceptions.StopGraphExecutionSignal('arg is negative')

    v = value.Value(value=number)

    a = apply.Apply(function=stop_here)