parameters: (data, results)
docstring: Merge multiprocessing results for covered lines.
  
    The data is mutated, the results are merged into it in place.
  
    Args:
      data: Existing coverage data from json file containing all instrumented
            lines.
      results: List of results as returned by get_covered_lines.
docstring_summary: Merge multiprocessing results for covered lines.
docstring_tokens: Merge multiprocessing results for covered lines .
function: def merge_covered_line_results(data, results):
    """Merge multiprocessing results for covered lines.
  
    The data is mutated, the results are merged into it in place.
  
    Args:
      data: Existing coverage data from json file containing all instrumented
            lines.
      results: List of results as returned by get_covered_lines.
    """
  
    # List of executables and mapping to the test bit mask. The number of
    # tests is restricted to 52, to allow javascript JSON parsing of
    # the bitsets encoded as numbers. JS max safe int is (1 << 53) - 1.
    exe_list = data['tests']
    assert len(exe_list) <= 52, 'Max 52 different tests are supported.'
    test_bit_masks = {exe:1<<i for i, exe in enumerate(exe_list)}
  
    def merge_lines(old_lines, new_lines, mask):
      """Merge the coverage data of a list of lines.
  
      Args:
        old_lines: Lines as list of pairs with line number and test bit mask.
                   The new lines will be merged into the list in place.
        new_lines: List of new (covered) lines (sorted).
        mask: The bit to be set for covered lines. The bit index is the test
              index of the executable that covered the line.
      """
      i = 0
      # Iterate over old and new lines, both are sorted.
      for l in new_lines:
        while old_lines[i][0] < l:
          # Forward instrumented lines not present in this coverage data.
          i += 1
          # TODO: Add more context to the assert message.
          assert i < len(old_lines), 'Covered line %d not in input file.' % l
        assert old_lines[i][0] == l, 'Covered line %d not in input file.' % l
  
        # Add coverage information to the line.
        old_lines[i][1] |= mask
  
    def merge_files(data, result):
      """Merge result into data.
  
      The data is mutated in place.
  
      Args:
        data: Merged coverage data from the previous reduce step.
        result: New result to be merged in. The type is as returned by
                get_covered_lines.
      """
      file_map, executable = result
      files = data['files']
      for file_name, lines in file_map.iteritems():
        merge_lines(files[file_name], lines, test_bit_masks[executable])
      return data
  
    reduce(merge_files, results, data)
function_tokens: def merge_covered_line_results ( data , results ) : # List of executables and mapping to the test bit mask. The number of # tests is restricted to 52, to allow javascript JSON parsing of # the bitsets encoded as numbers. JS max safe int is (1 << 53) - 1. exe_list = data [ 'tests' ] assert len ( exe_list ) <= 52 , 'Max 52 different tests are supported.' test_bit_masks = { exe : 1 << i for i , exe in enumerate ( exe_list ) } def merge_lines ( old_lines , new_lines , mask ) : """Merge the coverage data of a list of lines.
  
      Args:
        old_lines: Lines as list of pairs with line number and test bit mask.
                   The new lines will be merged into the list in place.
        new_lines: List of new (covered) lines (sorted).
        mask: The bit to be set for covered lines. The bit index is the test
              index of the executable that covered the line.
      """ i = 0 # Iterate over old and new lines, both are sorted. for l in new_lines : while old_lines [ i ] [ 0 ] < l : # Forward instrumented lines not present in this coverage data. i += 1 # TODO: Add more context to the assert message. assert i < len ( old_lines ) , 'Covered line %d not in input file.' % l assert old_lines [ i ] [ 0 ] == l , 'Covered line %d not in input file.' % l # Add coverage information to the line. old_lines [ i ] [ 1 ] |= mask def merge_files ( data , result ) : """Merge result into data.
  
      The data is mutated in place.
  
      Args:
        data: Merged coverage data from the previous reduce step.
        result: New result to be merged in. The type is as returned by
                get_covered_lines.
      """ file_map , executable = result files = data [ 'files' ] for file_name , lines in file_map . iteritems ( ) : merge_lines ( files [ file_name ] , lines , test_bit_masks [ executable ] ) return data reduce ( merge_files , results , data )