cleanup ParseNames fix dumb error in parsepositions cleanup

This commit is contained in:
eblade 2009-03-26 17:27:52 -04:00
parent cb542d9b3e
commit a210453cd2

View File

@ -1079,17 +1079,13 @@ def parseHandStartTime(topline, site):
#end def parseHandStartTime #end def parseHandStartTime
#parses the names out of the given lines and returns them as an array #parses the names out of the given lines and returns them as an array
def findName(line):
pos1 = line.find(":") + 2
pos2 = line.rfind("(") - 1
return unicode(line[pos1:pos2], "latin-1")
def parseNames(lines): def parseNames(lines):
result = [] return [findName(line) for line in lines]
for i in xrange (len(lines)):
pos1=lines[i].find(":")+2
pos2=lines[i].rfind("(")-1
tmp=lines[i][pos1:pos2]
#print "parseNames, tmp original:",tmp
tmp=unicode(tmp,"latin-1")
#print "parseNames, tmp after unicode latin-1 conversion:",tmp
result.append(tmp)
return result
#end def parseNames #end def parseNames
def parsePositions(hand, names): def parsePositions(hand, names):
@ -1158,7 +1154,7 @@ def parsePositions(hand, names):
arraypos-=1 arraypos-=1
distFromBtn+=1 distFromBtn+=1
if -1 in names: if any(p == -1 for p in positions):
print "parsePositions names:",names print "parsePositions names:",names
print "result:",positions print "result:",positions
raise FpdbError ("failed to read positions") raise FpdbError ("failed to read positions")