# Path: misc/objects.py
# def str_object(obj):
#   if type(obj) in (list, np.ndarray):
#     return '[%s]' % ', '.join(str_object(item) for item in obj)
#   if type(obj) == tuple:
#     return '(%s)' % ', '.join(str_object(item) for item in obj)
#   if type(obj) == dict:
#     return '{%s}' % ', '.join(str_object(item) + ': ' +  str_object(obj[item])
#                               for item in sorted(obj.keys(), key=lambda k: str_object(k)))
#   if type(obj) in (set, frozenset):
#     return '{%s}' % ', '.join(sorted(str_object(item) for item in obj))
#   if type(obj) in (float, np.float64):
#     obj = round(obj, 3)
#     if obj == 0:
#       obj = 0 # NOTE - catches -0.0 bug
#     return '%.3f'%obj
#   if isinstance(obj, types.FunctionType):
#     return obj.__name__
#   return str(obj)


from .utils import *
from misc.objects import str_object

  def set_inactive(self):
    if not self.active: return

    self.active = False
    for vertex in self.vertices:
      vertex.update_inactive()

  def update_inactive(self): # TODO - this is really slow. Only search if not greedy and reached?
    if not self.active: return

    self.active = False # Temporarily set to inactive
    for edge in self.edges:
      edge.update_inactive()
      if edge.active:
        self.active = True
        return
    # Cannot find active parent node
    self.set_inactive()

  #def copy(self, rg):
  #  new_connector = type(self)(self.condition, rg)
  #  pass

  def __str__(self):
    return 'C(' + str(self.condition) + ')'
  __repr__ = __str__
  def node_str(self):
    node_str = self.condition.__class__.__name__
    for value in self.condition.__dict__['__hash_dict'].values():

# Path: misc/objects.py
# def str_object(obj):
#   if type(obj) in (list, np.ndarray):
#     return '[%s]' % ', '.join(str_object(item) for item in obj)
#   if type(obj) == tuple:
#     return '(%s)' % ', '.join(str_object(item) for item in obj)
#   if type(obj) == dict:
#     return '{%s}' % ', '.join(str_object(item) + ': ' +  str_object(obj[item])
#                               for item in sorted(obj.keys(), key=lambda k: str_object(k)))
#   if type(obj) in (set, frozenset):
#     return '{%s}' % ', '.join(sorted(str_object(item) for item in obj))
#   if type(obj) in (float, np.float64):
#     obj = round(obj, 3)
#     if obj == 0:
#       obj = 0 # NOTE - catches -0.0 bug
#     return '%.3f'%obj
#   if isinstance(obj, types.FunctionType):
#     return obj.__name__
#   return str(obj)


# Path: retired/planners/reachability_graph/connector.py
from .utils import *
from misc.objects import str_object


  def set_inactive(self):
    if not self.active: return

    self.active = False
    for vertex in self.vertices:
      vertex.update_inactive()

  def update_inactive(self): # TODO - this is really slow. Only search if not greedy and reached?
    if not self.active: return

    self.active = False # Temporarily set to inactive
    for edge in self.edges:
      edge.update_inactive()
      if edge.active:
        self.active = True
        return
    # Cannot find active parent node
    self.set_inactive()

  #def copy(self, rg):
  #  new_connector = type(self)(self.condition, rg)
  #  pass

  def __str__(self):
    return 'C(' + str(self.condition) + ')'
  __repr__ = __str__
  def node_str(self):
    node_str = self.condition.__class__.__name__
    for value in self.condition.__dict__['__hash_dict'].values():

      node_str += '\n' + str_object(value)