parameters: (self, path, lines, lnotab, lines_hit)
return_statement: return n_hits, n_lines
docstring: Return a coverage results file in path.
docstring_summary: Return a coverage results file in path.
docstring_tokens: Return a coverage results file in path .
function: def write_results_file(self, path, lines, lnotab, lines_hit):
          """Return a coverage results file in path."""
  
          try:
              outfile = open(path, "w")
          except IOError, err:
              print >> sys.stderr, ("trace: Could not open %r for writing: %s"
                                    "- skipping" % (path, err))
              return 0, 0
  
          n_lines = 0
          n_hits = 0
          for i, line in enumerate(lines):
              lineno = i + 1
              # do the blank/comment match to try to mark more lines
              # (help the reader find stuff that hasn't been covered)
              if lineno in lines_hit:
                  outfile.write("%5d: " % lines_hit[lineno])
                  n_hits += 1
                  n_lines += 1
              elif rx_blank.match(line):
                  outfile.write("       ")
              else:
                  # lines preceded by no marks weren't hit
                  # Highlight them if so indicated, unless the line contains
                  # #pragma: NO COVER
                  if lineno in lnotab and not PRAGMA_NOCOVER in lines[i]:
                      outfile.write(">>>>>> ")
                      n_lines += 1
                  else:
                      outfile.write("       ")
              outfile.write(lines[i].expandtabs(8))
          outfile.close()
  
          return n_hits, n_lines
function_tokens: def write_results_file ( self , path , lines , lnotab , lines_hit ) : try : outfile = open ( path , "w" ) except IOError , err : print >> sys . stderr , ( "trace: Could not open %r for writing: %s" "- skipping" % ( path , err ) ) return 0 , 0 n_lines = 0 n_hits = 0 for i , line in enumerate ( lines ) : lineno = i + 1 # do the blank/comment match to try to mark more lines # (help the reader find stuff that hasn't been covered) if lineno in lines_hit : outfile . write ( "%5d: " % lines_hit [ lineno ] ) n_hits += 1 n_lines += 1 elif rx_blank . match ( line ) : outfile . write ( "       " ) else : # lines preceded by no marks weren't hit # Highlight them if so indicated, unless the line contains # #pragma: NO COVER if lineno in lnotab and not PRAGMA_NOCOVER in lines [ i ] : outfile . write ( ">>>>>> " ) n_lines += 1 else : outfile . write ( "       " ) outfile . write ( lines [ i ] . expandtabs ( 8 ) ) outfile . close ( ) return n_hits , n_lines