parameters: (self, project, name, prop_set, sources, only_one=False)
return_statement: return (consumed, bypassed)
docstring: Attempts to convert 'source' to the types that this generator can
              handle. The intention is to produce the set of targets can should be
              used when generator is run.
              only_one:   convert 'source' to only one of source types
                          if there's more that one possibility, report an
                          error.
                          
              Returns a pair:
                  consumed: all targets that can be consumed. 
                  bypassed: all targets that cannot be consumed.
docstring_summary: Attempts to convert 'source' to the types that this generator can
              handle. The intention is to produce the set of targets can should be
              used when generator is run.
              only_one:   convert 'source' to only one of source types
                          if there's more that one possibility, report an
                          error.
                          
              Returns a pair:
                  consumed: all targets that can be consumed. 
                  bypassed: all targets that cannot be consumed.
docstring_tokens: Attempts to convert source to the types that this generator can handle . The intention is to produce the set of targets can should be used when generator is run . only_one : convert source to only one of source types if there s more that one possibility report an error . Returns a pair : consumed : all targets that can be consumed . bypassed : all targets that cannot be consumed .
function: def convert_to_consumable_types (self, project, name, prop_set, sources, only_one=False):
          """ Attempts to convert 'source' to the types that this generator can
              handle. The intention is to produce the set of targets can should be
              used when generator is run.
              only_one:   convert 'source' to only one of source types
                          if there's more that one possibility, report an
                          error.
                          
              Returns a pair:
                  consumed: all targets that can be consumed. 
                  bypassed: all targets that cannot be consumed.
          """
          consumed = []
          bypassed = []
          missing_types = [] 
  
          if len (sources) > 1:
              # Don't know how to handle several sources yet. Just try 
              # to pass the request to other generator
              missing_types = self.source_types_
  
          else:
              (c, m) = self.consume_directly (sources [0])
              consumed += c
              missing_types += m
          
          # No need to search for transformation if
          # some source type has consumed source and
          # no more source types are needed.
          if only_one and consumed:
              missing_types = []
              
          #TODO: we should check that only one source type
          #if create of 'only_one' is true.
          # TODO: consider if consuned/bypassed separation should
          # be done by 'construct_types'.
                      
          if missing_types:
              transformed = construct_types (project, name, missing_types, prop_set, sources)
                                  
              # Add targets of right type to 'consumed'. Add others to
              # 'bypassed'. The 'generators.construct' rule has done
              # its best to convert everything to the required type.
              # There's no need to rerun it on targets of different types.
                  
              # NOTE: ignoring usage requirements
              for t in transformed[1]:
                  if t.type() in missing_types:
                      consumed.append(t)
  
                  else:
                      bypassed.append(t)
          
          consumed = unique(consumed)
          bypassed = unique(bypassed)
          
          # remove elements of 'bypassed' that are in 'consumed'
          
          # Suppose the target type of current generator, X is produced from 
          # X_1 and X_2, which are produced from Y by one generator.
          # When creating X_1 from Y, X_2 will be added to 'bypassed'
          # Likewise, when creating X_2 from Y, X_1 will be added to 'bypassed'
          # But they are also in 'consumed'. We have to remove them from
          # bypassed, so that generators up the call stack don't try to convert
          # them. 
  
          # In this particular case, X_1 instance in 'consumed' and X_1 instance
          # in 'bypassed' will be the same: because they have the same source and
          # action name, and 'virtual-target.register' won't allow two different
          # instances. Therefore, it's OK to use 'set.difference'.
          
          bypassed = set.difference(bypassed, consumed)
  
          return (consumed, bypassed)
function_tokens: def convert_to_consumable_types ( self , project , name , prop_set , sources , only_one = False ) : consumed = [ ] bypassed = [ ] missing_types = [ ] if len ( sources ) > 1 : # Don't know how to handle several sources yet. Just try  # to pass the request to other generator missing_types = self . source_types_ else : ( c , m ) = self . consume_directly ( sources [ 0 ] ) consumed += c missing_types += m # No need to search for transformation if # some source type has consumed source and # no more source types are needed. if only_one and consumed : missing_types = [ ] #TODO: we should check that only one source type #if create of 'only_one' is true. # TODO: consider if consuned/bypassed separation should # be done by 'construct_types'. if missing_types : transformed = construct_types ( project , name , missing_types , prop_set , sources ) # Add targets of right type to 'consumed'. Add others to # 'bypassed'. The 'generators.construct' rule has done # its best to convert everything to the required type. # There's no need to rerun it on targets of different types. # NOTE: ignoring usage requirements for t in transformed [ 1 ] : if t . type ( ) in missing_types : consumed . append ( t ) else : bypassed . append ( t ) consumed = unique ( consumed ) bypassed = unique ( bypassed ) # remove elements of 'bypassed' that are in 'consumed' # Suppose the target type of current generator, X is produced from  # X_1 and X_2, which are produced from Y by one generator. # When creating X_1 from Y, X_2 will be added to 'bypassed' # Likewise, when creating X_2 from Y, X_1 will be added to 'bypassed' # But they are also in 'consumed'. We have to remove them from # bypassed, so that generators up the call stack don't try to convert # them.  # In this particular case, X_1 instance in 'consumed' and X_1 instance # in 'bypassed' will be the same: because they have the same source and # action name, and 'virtual-target.register' won't allow two different # instances. Therefore, it's OK to use 'set.difference'. bypassed = set . difference ( bypassed , consumed ) return ( consumed , bypassed )