From: Olivier Matz Date: Fri, 15 Jun 2012 13:06:09 +0000 (+0200) Subject: cosmetic: rename {in,out}putfile to {in,out}put_file X-Git-Tag: v1.0~12 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d05f862c931ab68b43c85f4e4ebdf36d6f52cfc2;p=diff2html.git cosmetic: rename {in,out}putfile to {in,out}put_file Signed-off-by: Sergey Satskiy Signed-off-by: Olivier Matz --- diff --git a/diff2html.py b/diff2html.py index d616a5e..1b95cf5 100644 --- a/diff2html.py +++ b/diff2html.py @@ -38,8 +38,8 @@ import sys, re, htmlentitydefs, getopt # LINESIZE characters linesize = 20 tabsize = 8 -inputfile = sys.stdin -outputfile = sys.stdout +input_file = sys.stdin +output_file = sys.stdout exclude_headers = False show_CR = False show_hunk_infos = False @@ -207,21 +207,21 @@ def convert(s, linesize=0, ponct=0): def add_comment(s): - outputfile.write('%s\n'%convert(s)) + output_file.write('%s\n'%convert(s)) def add_filename(f1, f2): - outputfile.write("%s"%convert(f1, linesize=linesize)) - outputfile.write("%s\n"%convert(f2, linesize=linesize)) + output_file.write("%s"%convert(f1, linesize=linesize)) + output_file.write("%s\n"%convert(f2, linesize=linesize)) def add_hunk(): global hunk_off1, hunk_size1, hunk_off2, hunk_size2 global show_hunk_infos if show_hunk_infos: - outputfile.write('Offset %d, %d lines modified'%(hunk_off1, hunk_size1)) - outputfile.write('Offset %d, %d lines modified\n'%(hunk_off2, hunk_size2)) + output_file.write('Offset %d, %d lines modified'%(hunk_off1, hunk_size1)) + output_file.write('Offset %d, %d lines modified\n'%(hunk_off2, hunk_size2)) else: # ⋮ - vertical ellipsis - outputfile.write('⋮⋮') + output_file.write('⋮⋮') def add_line(s1, s2): @@ -240,26 +240,26 @@ def add_line(s1, s2): type_name = "changed" s1, s2 = linediff(s1, s2) - outputfile.write('' % type_name) + output_file.write('' % type_name) if s1 != None and s1 != "": - outputfile.write('%d ' % line1) - outputfile.write('') - outputfile.write(convert(s1, linesize=linesize, ponct=1)) - outputfile.write('') + output_file.write('%d ' % line1) + output_file.write('') + output_file.write(convert(s1, linesize=linesize, ponct=1)) + output_file.write('') else: s1 = "" - outputfile.write(' ') + output_file.write(' ') if s2 != None and s2 != "": - outputfile.write('%d '%line2) - outputfile.write('') - outputfile.write(convert(s2, linesize=linesize, ponct=1)) - outputfile.write('') + output_file.write('%d '%line2) + output_file.write('') + output_file.write(convert(s2, linesize=linesize, ponct=1)) + output_file.write('') else: s2 = "" - outputfile.write('') + output_file.write('') - outputfile.write('\n') + output_file.write('\n') if s1 != "": line1 += 1 @@ -302,11 +302,11 @@ def parse_input(): global hunk_off1, hunk_size1, hunk_off2, hunk_size2 if not exclude_headers: - outputfile.write(html_hdr) - outputfile.write(table_hdr) + output_file.write(html_hdr) + output_file.write(table_hdr) while True: - l = inputfile.readline() + l = input_file.readline() if l == "": break @@ -314,7 +314,7 @@ def parse_input(): if m: empty_buffer() file1 = m.groups()[0] - l = inputfile.readline() + l = input_file.readline() m = re.match('^\+\+\+ ([^\s]*)', l) if m: file2 = m.groups()[0] @@ -359,9 +359,9 @@ def parse_input(): add_comment(l) empty_buffer() - outputfile.write(table_footer) + output_file.write(table_footer) if not exclude_headers: - outputfile.write(html_footer) + output_file.write(html_footer) def usage(): @@ -384,7 +384,7 @@ page on stdout. def main(): global linesize, tabsize - global inputfile, outputfile + global input_file, output_file global exclude_headers, show_CR, show_hunk_infos try: @@ -403,9 +403,9 @@ def main(): usage() sys.exit() elif o in ("-i", "--input"): - inputfile = open(a, "r") + input_file = open(a, "r") elif o in ("-o", "--output"): - outputfile = open(a, "w") + output_file = open(a, "w") elif o in ("-x", "--exclude-html-headers"): exclude_headers = True elif o in ("-t", "--tabsize"):