parameters: (keep, coverage_dir, file_map, cpus)
return_statement: return inputs
docstring: Generate inputs for multiprocessed merging.
  
    Splits the sancov files into several buckets, so that each bucket can be
    merged in a separate process. We have only few executables in total with
    mostly lots of associated files. In the general case, with many executables
    we might need to avoid splitting buckets of executables with few files.
  
    Returns: List of args as expected by merge above.
docstring_summary: Generate inputs for multiprocessed merging.
docstring_tokens: Generate inputs for multiprocessed merging .
function: def generate_inputs(keep, coverage_dir, file_map, cpus):
    """Generate inputs for multiprocessed merging.
  
    Splits the sancov files into several buckets, so that each bucket can be
    merged in a separate process. We have only few executables in total with
    mostly lots of associated files. In the general case, with many executables
    we might need to avoid splitting buckets of executables with few files.
  
    Returns: List of args as expected by merge above.
    """
    inputs = []
    for executable, files in file_map.iteritems():
      # What's the bucket size for distributing files for merging? E.g. with
      # 2 cpus and 9 files we want bucket size 5.
      n = max(2, int(math.ceil(len(files) / float(cpus))))
  
      # Chop files into buckets.
      buckets = [files[i:i+n] for i in range(0, len(files), n)]
  
      # Inputs for multiprocessing. List of tuples containing:
      # Keep-files option, base path, executable name, index of bucket,
      # list of files.
      inputs.extend([(keep, coverage_dir, executable, i, b)
                     for i, b in enumerate(buckets)])
    return inputs
function_tokens: def generate_inputs ( keep , coverage_dir , file_map , cpus ) : inputs = [ ] for executable , files in file_map . iteritems ( ) : # What's the bucket size for distributing files for merging? E.g. with # 2 cpus and 9 files we want bucket size 5. n = max ( 2 , int ( math . ceil ( len ( files ) / float ( cpus ) ) ) ) # Chop files into buckets. buckets = [ files [ i : i + n ] for i in range ( 0 , len ( files ) , n ) ] # Inputs for multiprocessing. List of tuples containing: # Keep-files option, base path, executable name, index of bucket, # list of files. inputs . extend ( [ ( keep , coverage_dir , executable , i , b ) for i , b in enumerate ( buckets ) ] ) return inputs