# 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: misc/functions.py
# def flatten(iterable_of_iterables):
#   return (item for iterables in iterable_of_iterables for item in iterables)


from .utils import *
from misc.objects import str_object
from misc.functions import flatten
    self.active = False
    for source_vertex, edge in self.sources:
      edge.update_inactive()
      #if source_vertex is not None:
      #  source_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 connector in self.connectors:
      connector.update_inactive()
      if connector.active:
        self.active = True
        return
    #for sink_vertex, _ in self.sinks:
    #  sink_vertex.update_inactive()
    #  if sink_vertex.active:
    #    self.active = True
    #    return
    # Cannot find active parent node
    self.set_inactive()
  """

  def __str__(self):
    return 'V(' + str(self.substate) + ')'
  __repr__ = __str__
  def node_str(self):
    #if len(self.substate) == 0: # If this happens, there is a problem...
    #  return 'EmptySet'

# 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: misc/functions.py
# def flatten(iterable_of_iterables):
#   return (item for iterables in iterable_of_iterables for item in iterables)


# Path: retired/planners/connectivity_graph/vertex.py
from .utils import *
from misc.objects import str_object
from misc.functions import flatten

    self.active = False
    for source_vertex, edge in self.sources:
      edge.update_inactive()
      #if source_vertex is not None:
      #  source_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 connector in self.connectors:
      connector.update_inactive()
      if connector.active:
        self.active = True
        return
    #for sink_vertex, _ in self.sinks:
    #  sink_vertex.update_inactive()
    #  if sink_vertex.active:
    #    self.active = True
    #    return
    # Cannot find active parent node
    self.set_inactive()
  """

  def __str__(self):
    return 'V(' + str(self.substate) + ')'
  __repr__ = __str__
  def node_str(self):
    #if len(self.substate) == 0: # If this happens, there is a problem...
    #  return 'EmptySet'

    return '\n'.join([str_object(variable) + '=' + str_object(value) for variable, value in self.substate])