Add 'if __name__ == "__main__":' to files already as a usable as a module.
This commit is contained in:
parent
9324526a76
commit
7a8c43ee6a
|
@ -194,5 +194,5 @@ def fixline(line):
|
|||
print line,
|
||||
return line
|
||||
|
||||
|
||||
main()
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -45,4 +45,5 @@ def main():
|
|||
except EOFError:
|
||||
pass
|
||||
|
||||
main()
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -141,4 +141,5 @@ def add(dict, key, item):
|
|||
else:
|
||||
dict[key] = [item]
|
||||
|
||||
main()
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -17,4 +17,5 @@ def makedirs(p):
|
|||
makedirs(head)
|
||||
os.mkdir(p, 0777)
|
||||
|
||||
main()
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -113,4 +113,5 @@ def tuple(list):
|
|||
i = len(list)/2
|
||||
return tuple(list[:i]) + tuple(list[i:])
|
||||
|
||||
test()
|
||||
if __name__ == "__main__":
|
||||
test()
|
||||
|
|
|
@ -120,4 +120,5 @@ def message(f, delimiter = ''):
|
|||
print
|
||||
return sts
|
||||
|
||||
main()
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -57,4 +57,5 @@ def makedirs(p):
|
|||
makedirs(head)
|
||||
os.mkdir(p, 0777)
|
||||
|
||||
main()
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -359,8 +359,8 @@ def main():
|
|||
createpage(rootpage, tree, '')
|
||||
print 'Done'
|
||||
|
||||
|
||||
main()
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
# That's all folks
|
||||
######################################################################
|
||||
|
|
|
@ -30,4 +30,5 @@ def output(d):
|
|||
# Flush so the output is seen immediately
|
||||
sys.stdout.flush()
|
||||
|
||||
main()
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -23,4 +23,5 @@ def primes(min, max):
|
|||
if i >= min: print i
|
||||
i = i+2
|
||||
|
||||
main()
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -103,4 +103,5 @@ def mkdate((year, month, day)):
|
|||
days = days + day
|
||||
return days
|
||||
|
||||
main()
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -88,4 +88,5 @@ def main():
|
|||
curfile = FileObj(filename)
|
||||
curfile.process(lineno, line[n:])
|
||||
|
||||
main()
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Reference in New Issue