# Path: taskflow/engines/action_engine/compiler.py
# LOG = logging.getLogger(__name__)
# TASK = 'task'
# RETRY = 'retry'
# FLOW = 'flow'
# FLOW_END = 'flow_end'
# ATOMS = (TASK, RETRY)
# FLOWS = (FLOW, FLOW_END)
#     TASK = TASK
#     RETRY = RETRY
#     FLOW = FLOW
#     FLOW_END = FLOW_END
# class Terminator(object):
# class Compilation(object):
# class TaskCompiler(object):
# class FlowCompiler(object):
# class PatternCompiler(object):
#     def __init__(self, flow):
#     def flow(self):
#     def name(self):
#     def __str__(self):
#     def __init__(self, execution_graph, hierarchy):
#     def execution_graph(self):
#     def hierarchy(self):
# def _overlap_occurrence_detector(to_graph, from_graph):
# def _add_update_edges(graph, nodes_from, nodes_to, attr_dict=None):
#     def compile(self, task, parent=None):
#     def __init__(self, deep_compiler_func):
#     def compile(self, flow, parent=None):
#     def __init__(self, root, freeze=True):
#     def _compile(self, item, parent=None):
#     def _pre_item_compile(self, item):
#     def _post_item_compile(self, item, graph, node):
#     def _pre_compile(self):
#     def _post_compile(self, graph, node):
#     def compile(self):


import collections
import enum
from taskflow.engines.action_engine import compiler as co
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.




class Direction(enum.Enum):
    """Traversal direction enum."""

    #: Go through successors.
    FORWARD = 1

    #: Go through predecessors.
    BACKWARD = 2


def _extract_connectors(execution_graph, starting_node, direction,
                        through_flows=True, through_retries=True,
                        through_tasks=True):
    if direction == Direction.FORWARD:
        connected_iter = execution_graph.successors
    else:
        connected_iter = execution_graph.predecessors
    connected_to_functors = {}
    if through_flows:

# Path: taskflow/engines/action_engine/compiler.py
# LOG = logging.getLogger(__name__)
# TASK = 'task'
# RETRY = 'retry'
# FLOW = 'flow'
# FLOW_END = 'flow_end'
# ATOMS = (TASK, RETRY)
# FLOWS = (FLOW, FLOW_END)
#     TASK = TASK
#     RETRY = RETRY
#     FLOW = FLOW
#     FLOW_END = FLOW_END
# class Terminator(object):
# class Compilation(object):
# class TaskCompiler(object):
# class FlowCompiler(object):
# class PatternCompiler(object):
#     def __init__(self, flow):
#     def flow(self):
#     def name(self):
#     def __str__(self):
#     def __init__(self, execution_graph, hierarchy):
#     def execution_graph(self):
#     def hierarchy(self):
# def _overlap_occurrence_detector(to_graph, from_graph):
# def _add_update_edges(graph, nodes_from, nodes_to, attr_dict=None):
#     def compile(self, task, parent=None):
#     def __init__(self, deep_compiler_func):
#     def compile(self, flow, parent=None):
#     def __init__(self, root, freeze=True):
#     def _compile(self, item, parent=None):
#     def _pre_item_compile(self, item):
#     def _post_item_compile(self, item, graph, node):
#     def _pre_compile(self):
#     def _post_compile(self, graph, node):
#     def compile(self):


# Path: taskflow/engines/action_engine/traversal.py
import collections
import enum
from taskflow.engines.action_engine import compiler as co

#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.




class Direction(enum.Enum):
    """Traversal direction enum."""

    #: Go through successors.
    FORWARD = 1

    #: Go through predecessors.
    BACKWARD = 2


def _extract_connectors(execution_graph, starting_node, direction,
                        through_flows=True, through_retries=True,
                        through_tasks=True):
    if direction == Direction.FORWARD:
        connected_iter = execution_graph.successors
    else:
        connected_iter = execution_graph.predecessors
    connected_to_functors = {}
    if through_flows:

        connected_to_functors[co.FLOW] = connected_iter