original_docstring: Internally adds the object.
  
          There is a node in the dependency graph for each call of the
          DynamicItem. Each call may return multiple keys and depend on multiple
          keys. An internal dict maps key to the id of the node that produces it.
          
docstring: Internally adds the object.
  There is a node in the dependency graph for each call of the
  DynamicItem. Each call may return multiple keys and depend on multiple
  keys. An internal dict maps key to the id of the node that produces it.
docstring_tokens: Internally adds the object . There is a node in the dependency graph for each call of the DynamicItem . Each call may return multiple keys and depend on multiple keys . An internal dict maps key to the id of the node that produces it .
code: def _add_dynamic_item_object(self, obj):
          """Internally adds the object.
  
          There is a node in the dependency graph for each call of the
          DynamicItem. Each call may return multiple keys and depend on multiple
          keys. An internal dict maps key to the id of the node that produces it.
          """
          if not obj.provides:
              raise ValueError(
                  "Won't add redundant dynamic item which doesn't "
                  "provide anything."
              )
          depended = []
          for key in obj.takes:
              # Might not be accounted for, yet:
              if key not in self.key_to_node:
                  dependee_keys = self.unaccounted_keys.setdefault(key, [])
                  dependee_keys.extend(obj.next_provides())
              else:
                  depended.append(self.key_to_node[key])
          for provided in obj.provided_in_order():
              node_id = self.dg.add_node(data=obj)
              for key in provided:
                  self.key_to_node[key] = node_id
                  # This key may also be unaccounted for, so account for it now:
                  if key in self.unaccounted_keys:
                      for dependee_key in self.unaccounted_keys[key]:
                          dependee_node = self.key_to_node[dependee_key]
                          self.dg.add_edge(dependee_node, node_id)
                      del self.unaccounted_keys[key]  # Now accounted for!
              for dep_id in depended:
                  self.dg.add_edge(node_id, dep_id)
              # Next call will depend on this call:
              depended = [node_id]
          # Keep a reference to the item in this object, as well:
          self.dynamic_items.append(obj)
code_tokens: def _add_dynamic_item_object ( self , obj ) : if not obj . provides : raise ValueError ( "Won't add redundant dynamic item which doesn't " "provide anything." ) depended = [ ] for key in obj . takes : if key not in self . key_to_node : dependee_keys = self . unaccounted_keys . setdefault ( key , [ ] ) dependee_keys . extend ( obj . next_provides ( ) ) else : depended . append ( self . key_to_node [ key ] ) for provided in obj . provided_in_order ( ) : node_id = self . dg . add_node ( data = obj ) for key in provided : self . key_to_node [ key ] = node_id if key in self . unaccounted_keys : for dependee_key in self . unaccounted_keys [ key ] : dependee_node = self . key_to_node [ dependee_key ] self . dg . add_edge ( dependee_node , node_id ) del self . unaccounted_keys [ key ] for dep_id in depended : self . dg . add_edge ( node_id , dep_id ) depended = [ node_id ] self . dynamic_items . append ( obj )
short_docstring: Internally adds the object.
short_docstring_tokens: Internally adds the object .
comment: """Internally adds the object.
  
          There is a node in the dependency graph for each call of the
          DynamicItem. Each call may return multiple keys and depend on multiple
          keys. An internal dict maps key to the id of the node that produces it.
          """$SEP$# Might not be accounted for, yet:$SEP$# This key may also be unaccounted for, so account for it now:$SEP$# Now accounted for!$SEP$# Next call will depend on this call:$SEP$# Keep a reference to the item in this object, as well: