This commit is contained in:
unknown 2009-11-03 15:14:20 -05:00
parent d008eceaef
commit a5de7c9b6b

View File

@ -195,7 +195,8 @@ This requires a regex that greedily groups and matches the 'splitter' between ha
which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py. which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py.
""" """
if self.in_path == '-': raise StopIteration if self.in_path == '-':
raise StopIteration
interval = 1.0 # seconds to sleep between reads for new data interval = 1.0 # seconds to sleep between reads for new data
fd = codecs.open(self.in_path,'r', self.codepage) fd = codecs.open(self.in_path,'r', self.codepage)
data = '' data = ''
@ -396,7 +397,7 @@ or None if we fail to get the info """
if True: # basically.. I don't know if True: # basically.. I don't know
sane = True sane = True
if(self.in_path != '-' and self.out_path == self.in_path): if self.in_path != '-' and self.out_path == self.in_path:
print "HH Sanity Check: output and input files are the same, check config" print "HH Sanity Check: output and input files are the same, check config"
sane = False sane = False
@ -417,16 +418,19 @@ or None if we fail to get the info """
for l in list: for l in list:
# print "'" + l + "'" # print "'" + l + "'"
hands = hands + [Hand.Hand(self.sitename, self.gametype, l)] hands = hands + [Hand.Hand(self.sitename, self.gametype, l)]
# TODO: This looks like it could be replaced with a list comp.. ?
return hands return hands
def __listof(self, x): def __listof(self, x):
if isinstance(x, list) or isinstance(x, tuple): return x if isinstance(x, list) or isinstance(x, tuple):
else: return [x] return x
else:
return [x]
def readFile(self): def readFile(self):
"""Open in_path according to self.codepage. Exceptions caught further up""" """Open in_path according to self.codepage. Exceptions caught further up"""
if(self.filetype == "text"): if self.filetype == "text":
if self.in_path == '-': if self.in_path == '-':
# read from stdin # read from stdin
log.debug("Reading stdin with %s" % self.codepage) # is this necessary? or possible? or what? log.debug("Reading stdin with %s" % self.codepage) # is this necessary? or possible? or what?
@ -446,7 +450,7 @@ or None if we fail to get the info """
pass pass
else: else:
print "unable to read file with any codec in list!", self.in_path print "unable to read file with any codec in list!", self.in_path
elif(self.filetype == "xml"): elif self.filetype == "xml":
doc = xml.dom.minidom.parse(filename) doc = xml.dom.minidom.parse(filename)
self.doc = doc self.doc = doc
@ -474,7 +478,8 @@ or None if we fail to get the info """
def maxOccSeat(self, hand): def maxOccSeat(self, hand):
max = 0 max = 0
for player in hand.players: for player in hand.players:
if player[0] > max: max = player[0] if player[0] > max:
max = player[0]
return max return max
def getStatus(self): def getStatus(self):