Add 'if __name__ == "__main__":' to files already as a usable as a module.

This commit is contained in:
Johannes Gijsbers 2004-09-11 16:34:35 +00:00
parent 9324526a76
commit 7a8c43ee6a
13 changed files with 29 additions and 18 deletions

View File

@ -194,5 +194,5 @@ def fixline(line):
print line,
return line
main()
if __name__ == "__main__":
main()

View File

@ -45,4 +45,5 @@ def main():
except EOFError:
pass
main()
if __name__ == "__main__":
main()

View File

@ -141,4 +141,5 @@ def add(dict, key, item):
else:
dict[key] = [item]
main()
if __name__ == "__main__":
main()

View File

@ -103,7 +103,8 @@ def makestatus(name, thisuser):
lines.append('lpq exit status %r' % (sts,))
return string.joinfields(lines, ': ')
try:
main()
except KeyboardInterrupt:
pass
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
pass

View File

@ -17,4 +17,5 @@ def makedirs(p):
makedirs(head)
os.mkdir(p, 0777)
main()
if __name__ == "__main__":
main()

View File

@ -113,4 +113,5 @@ def tuple(list):
i = len(list)/2
return tuple(list[:i]) + tuple(list[i:])
test()
if __name__ == "__main__":
test()

View File

@ -120,4 +120,5 @@ def message(f, delimiter = ''):
print
return sts
main()
if __name__ == "__main__":
main()

View File

@ -57,4 +57,5 @@ def makedirs(p):
makedirs(head)
os.mkdir(p, 0777)
main()
if __name__ == "__main__":
main()

View File

@ -359,8 +359,8 @@ def main():
createpage(rootpage, tree, '')
print 'Done'
main()
if __name__ == "__main__":
main()
# That's all folks
######################################################################

View File

@ -30,4 +30,5 @@ def output(d):
# Flush so the output is seen immediately
sys.stdout.flush()
main()
if __name__ == "__main__":
main()

View File

@ -23,4 +23,5 @@ def primes(min, max):
if i >= min: print i
i = i+2
main()
if __name__ == "__main__":
main()

View File

@ -103,4 +103,5 @@ def mkdate((year, month, day)):
days = days + day
return days
main()
if __name__ == "__main__":
main()

View File

@ -88,4 +88,5 @@ def main():
curfile = FileObj(filename)
curfile.process(lineno, line[n:])
main()
if __name__ == "__main__":
main()