# Path: hyperengine/spec/nodes.py
# class BaseNode(object):
#   def __init__(self, name=None):
#     super(BaseNode, self).__init__()
#     self._domain_value = None
#     self._name = name
# 
#   def value(self):
#     return self._domain_value
# 
#   def name(self):
#     return self._name
# 
#   def with_name(self, name):
#     self._name = name
#     return self
# 
#   def describe(self):
#     return None
# 
#   def __add__(self, other):  return _op2(self, other, operator.add)
#   def __radd__(self, other): return _op2(self, other, operator.add, rev=True)
# 
#   def __sub__(self, other):  return _op2(self, other, operator.sub)
#   def __rsub__(self, other): return _op2(self, other, operator.sub, rev=True)
# 
#   def __mul__(self, other):  return _op2(self, other, operator.mul)
#   def __rmul__(self, other): return _op2(self, other, operator.mul, rev=True)
# 
#   def __div__(self, other):  return _op2(self, other, operator.div)
#   def __rdiv__(self, other): return _op2(self, other, operator.div, rev=True)
# 
#   def __mod__(self, other):  return _op2(self, other, operator.mod)
#   def __rmod__(self, other): return _op2(self, other, operator.mod, rev=True)
# 
#   def __floordiv__(self, other):  return _op2(self, other, operator.floordiv)
#   def __rfloordiv__(self, other): return _op2(self, other, operator.floordiv, rev=True)
# 
#   def __truediv__(self, other):  return _op2(self, other, operator.truediv)
#   def __rtruediv__(self, other): return _op2(self, other, operator.truediv, rev=True)
# 
#   def __pow__(self, other):  return _op2(self, other, operator.pow)
#   def __rpow__(self, other): return _op2(self, other, operator.pow, rev=True)
# 
#   def __and__(self, other):  return _op2(self, other, operator.and_)
#   def __rand__(self, other):  return _op2(self, other, operator.and_, rev=True)
# 
#   def __or__(self, other):  return _op2(self, other, operator.or_)
#   def __ror__(self, other):  return _op2(self, other, operator.or_, rev=True)
# 
#   def __xor__(self, other):  return _op2(self, other, operator.__xor__)
#   def __rxor__(self, other):  return _op2(self, other, operator.__xor__, rev=True)
# 
#   def __lshift__(self, other):  return _op2(self, other, operator.lshift)
#   def __rlshift__(self, other): return _op2(self, other, operator.lshift, rev=True)
# 
#   def __rshift__(self, other):  return _op2(self, other, operator.rshift)
#   def __rrshift__(self, other): return _op2(self, other, operator.rshift, rev=True)
# 
#   def __neg__(self):  return _op1(self, operator.neg)
#   def __pos__(self):  return _op1(self, operator.pos)
#   def __abs__(self):  return _op1(self, operator.abs)
#   def __invert__(self):  return _op1(self, operator.invert)
# 
# class AcceptsInputNode(BaseNode):
#   def __init__(self):
#     super(AcceptsInputNode, self).__init__()
#     self._point = None
# 
#   def set_point(self, point):
#     self._point = point
#     self._domain_value = self.to_domain_value(point)
# 
#   def to_domain_value(self, point):
#     raise NotImplementedError()
# 
# class JointNode(BaseNode):
#   def __init__(self, *children):
#     super(JointNode, self).__init__()
#     self._children = children


import copy
import numbers
import numpy as np
from six import iteritems
from .nodes import BaseNode, AcceptsInputNode, JointNode
    for node, index in iteritems(self._input_nodes):
      node.set_point(points[index])

    spec_copy = copy.deepcopy(self._spec)
    spec_copy = self._traverse_and_replace(spec_copy)
    return spec_copy

  def get_names(self):
    return {index: node.name() for node, index in iteritems(self._input_nodes)}

  def _traverse_nodes(self, spec):
    self._visited = set()
    self._traverse_nodes_recursive(spec)
    self._visited = None

  def _visit(self, obj):
    if isinstance(obj, object) and hasattr(obj, '__dict__'):
      id_ = id(obj)
      if id_ in self._visited:
        return True
      self._visited.add(id_)
    return False

  def _traverse_nodes_recursive(self, spec, *path):
    if self._visit(spec):
      return

    if isinstance(spec, BaseNode):
      node = spec


# Path: hyperengine/spec/nodes.py
# class BaseNode(object):
#   def __init__(self, name=None):
#     super(BaseNode, self).__init__()
#     self._domain_value = None
#     self._name = name
# 
#   def value(self):
#     return self._domain_value
# 
#   def name(self):
#     return self._name
# 
#   def with_name(self, name):
#     self._name = name
#     return self
# 
#   def describe(self):
#     return None
# 
#   def __add__(self, other):  return _op2(self, other, operator.add)
#   def __radd__(self, other): return _op2(self, other, operator.add, rev=True)
# 
#   def __sub__(self, other):  return _op2(self, other, operator.sub)
#   def __rsub__(self, other): return _op2(self, other, operator.sub, rev=True)
# 
#   def __mul__(self, other):  return _op2(self, other, operator.mul)
#   def __rmul__(self, other): return _op2(self, other, operator.mul, rev=True)
# 
#   def __div__(self, other):  return _op2(self, other, operator.div)
#   def __rdiv__(self, other): return _op2(self, other, operator.div, rev=True)
# 
#   def __mod__(self, other):  return _op2(self, other, operator.mod)
#   def __rmod__(self, other): return _op2(self, other, operator.mod, rev=True)
# 
#   def __floordiv__(self, other):  return _op2(self, other, operator.floordiv)
#   def __rfloordiv__(self, other): return _op2(self, other, operator.floordiv, rev=True)
# 
#   def __truediv__(self, other):  return _op2(self, other, operator.truediv)
#   def __rtruediv__(self, other): return _op2(self, other, operator.truediv, rev=True)
# 
#   def __pow__(self, other):  return _op2(self, other, operator.pow)
#   def __rpow__(self, other): return _op2(self, other, operator.pow, rev=True)
# 
#   def __and__(self, other):  return _op2(self, other, operator.and_)
#   def __rand__(self, other):  return _op2(self, other, operator.and_, rev=True)
# 
#   def __or__(self, other):  return _op2(self, other, operator.or_)
#   def __ror__(self, other):  return _op2(self, other, operator.or_, rev=True)
# 
#   def __xor__(self, other):  return _op2(self, other, operator.__xor__)
#   def __rxor__(self, other):  return _op2(self, other, operator.__xor__, rev=True)
# 
#   def __lshift__(self, other):  return _op2(self, other, operator.lshift)
#   def __rlshift__(self, other): return _op2(self, other, operator.lshift, rev=True)
# 
#   def __rshift__(self, other):  return _op2(self, other, operator.rshift)
#   def __rrshift__(self, other): return _op2(self, other, operator.rshift, rev=True)
# 
#   def __neg__(self):  return _op1(self, operator.neg)
#   def __pos__(self):  return _op1(self, operator.pos)
#   def __abs__(self):  return _op1(self, operator.abs)
#   def __invert__(self):  return _op1(self, operator.invert)
# 
# class AcceptsInputNode(BaseNode):
#   def __init__(self):
#     super(AcceptsInputNode, self).__init__()
#     self._point = None
# 
#   def set_point(self, point):
#     self._point = point
#     self._domain_value = self.to_domain_value(point)
# 
#   def to_domain_value(self, point):
#     raise NotImplementedError()
# 
# class JointNode(BaseNode):
#   def __init__(self, *children):
#     super(JointNode, self).__init__()
#     self._children = children


# Path: hyperengine/spec/parsed_spec.py
import copy
import numbers
import numpy as np
from six import iteritems
from .nodes import BaseNode, AcceptsInputNode, JointNode

    for node, index in iteritems(self._input_nodes):
      node.set_point(points[index])

    spec_copy = copy.deepcopy(self._spec)
    spec_copy = self._traverse_and_replace(spec_copy)
    return spec_copy

  def get_names(self):
    return {index: node.name() for node, index in iteritems(self._input_nodes)}

  def _traverse_nodes(self, spec):
    self._visited = set()
    self._traverse_nodes_recursive(spec)
    self._visited = None

  def _visit(self, obj):
    if isinstance(obj, object) and hasattr(obj, '__dict__'):
      id_ = id(obj)
      if id_ in self._visited:
        return True
      self._visited.add(id_)
    return False

  def _traverse_nodes_recursive(self, spec, *path):
    if self._visit(spec):
      return

    if isinstance(spec, BaseNode):
      node = spec


      if isinstance(node, JointNode):