Refactor HHC call a bit, make sure out_fh gets closed

This commit is contained in:
Worros
2009-03-13 00:31:29 +09:00
parent c523fce123
commit 2d849c69e7
2 changed files with 16 additions and 18 deletions
+4
View File
@@ -116,6 +116,7 @@ Otherwise, finish at eof..."""
if not self.sanityCheck():
print "Cowardly refusing to continue after failed sanity check"
return
if self.follow:
numHands = 0
for handText in self.tailHands():
@@ -129,6 +130,9 @@ Otherwise, finish at eof..."""
numHands= len(handsList)
endtime = time.time()
print "Processed %d hands in %.3f seconds" % (numHands, endtime - starttime)
if self.out_fh != sys.stdout:
self.out_fh.close()
def tailHands(self):
"""Generator of handTexts from a tailed file: