Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0b7b4b8

Browse files
committed
satisfy the tabnanny
1 parent 9082cdd commit 0b7b4b8

3 files changed

Lines changed: 358 additions & 358 deletions

File tree

Tools/scripts/eptags.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,33 @@
2424
def treat_file(file, outfp):
2525
"""Append tags found in file named 'file' to the open file 'outfp'"""
2626
try:
27-
fp = open(file, 'r')
27+
fp = open(file, 'r')
2828
except:
29-
sys.stderr.write('Cannot open %s\n'%file)
30-
return
29+
sys.stderr.write('Cannot open %s\n'%file)
30+
return
3131
charno = 0
3232
lineno = 0
3333
tags = []
3434
size = 0
3535
while 1:
36-
line = fp.readline()
37-
if not line: break
38-
lineno = lineno + 1
39-
m = matcher.search(line)
40-
if m:
41-
tag = m.group(0) + '\177%d,%d\n'%(lineno,charno)
42-
tags.append(tag)
43-
size = size + len(tag)
44-
charno = charno + len(line)
36+
line = fp.readline()
37+
if not line:
38+
break
39+
lineno = lineno + 1
40+
m = matcher.search(line)
41+
if m:
42+
tag = m.group(0) + '\177%d,%d\n'%(lineno,charno)
43+
tags.append(tag)
44+
size = size + len(tag)
45+
charno = charno + len(line)
4546
outfp.write('\f\n%s,%d\n'%(file,size))
4647
for tag in tags:
47-
outfp.write(tag)
48+
outfp.write(tag)
4849

4950
def main():
5051
outfp = open('TAGS', 'w')
5152
for file in sys.argv[1:]:
52-
treat_file(file, outfp)
53+
treat_file(file, outfp)
5354

5455
if __name__=="__main__":
5556
main()

Tools/scripts/parseentities.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ def parse(text,pos=0,endpos=None):
2121

2222
pos = 0
2323
if endpos is None:
24-
endpos = len(text)
24+
endpos = len(text)
2525
d = {}
2626
while 1:
27-
m = entityRE.search(text,pos,endpos)
28-
if not m:
29-
break
30-
name,charcode,comment = m.groups()
31-
d[name] = charcode,comment
32-
pos = m.end()
27+
m = entityRE.search(text,pos,endpos)
28+
if not m:
29+
break
30+
name,charcode,comment = m.groups()
31+
d[name] = charcode,comment
32+
pos = m.end()
3333
return d
3434

3535
def writefile(f,defs):
@@ -38,27 +38,27 @@ def writefile(f,defs):
3838
items = defs.items()
3939
items.sort()
4040
for name,(charcode,comment) in items:
41-
if charcode[:2] == '&#':
42-
code = int(charcode[2:-1])
43-
if code < 256:
44-
charcode = "'\%o'" % code
45-
else:
46-
charcode = repr(charcode)
47-
else:
48-
charcode = repr(charcode)
49-
comment = TextTools.collapse(comment)
50-
f.write(" '%s':\t%s, \t# %s\n" % (name,charcode,comment))
41+
if charcode[:2] == '&#':
42+
code = int(charcode[2:-1])
43+
if code < 256:
44+
charcode = "'\%o'" % code
45+
else:
46+
charcode = repr(charcode)
47+
else:
48+
charcode = repr(charcode)
49+
comment = TextTools.collapse(comment)
50+
f.write(" '%s':\t%s, \t# %s\n" % (name,charcode,comment))
5151
f.write('\n}\n')
5252

5353
if __name__ == '__main__':
5454
if len(sys.argv) > 1:
55-
infile = open(sys.argv[1])
55+
infile = open(sys.argv[1])
5656
else:
57-
infile = sys.stdin
57+
infile = sys.stdin
5858
if len(sys.argv) > 2:
59-
outfile = open(sys.argv[2],'w')
59+
outfile = open(sys.argv[2],'w')
6060
else:
61-
outfile = sys.stdout
61+
outfile = sys.stdout
6262
text = infile.read()
6363
defs = parse(text)
6464
writefile(outfile,defs)

0 commit comments

Comments
 (0)