cleanup
This commit is contained in:
parent
d008eceaef
commit
a5de7c9b6b
|
@ -150,9 +150,9 @@ Otherwise, finish at EOF.
|
||||||
for handText in self.tailHands():
|
for handText in self.tailHands():
|
||||||
try:
|
try:
|
||||||
self.processHand(handText)
|
self.processHand(handText)
|
||||||
numHands+=1
|
numHands += 1
|
||||||
except FpdbParseError, e:
|
except FpdbParseError, e:
|
||||||
numErrors+=1
|
numErrors += 1
|
||||||
log.warning("Failed to convert hand %s" % e.hid)
|
log.warning("Failed to convert hand %s" % e.hid)
|
||||||
log.debug(handText)
|
log.debug(handText)
|
||||||
else:
|
else:
|
||||||
|
@ -166,7 +166,7 @@ Otherwise, finish at EOF.
|
||||||
try:
|
try:
|
||||||
self.processedHands.append(self.processHand(handText))
|
self.processedHands.append(self.processHand(handText))
|
||||||
except FpdbParseError, e:
|
except FpdbParseError, e:
|
||||||
numErrors+=1
|
numErrors += 1
|
||||||
log.warning("Failed to convert hand %s" % e.hid)
|
log.warning("Failed to convert hand %s" % e.hid)
|
||||||
log.debug(handText)
|
log.debug(handText)
|
||||||
numHands = len(handsList)
|
numHands = len(handsList)
|
||||||
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user