make use of the fact that an empty list is False, and use extend() to copy an array instead of doing it by hand
This commit is contained in:
parent
a210453cd2
commit
c3517bd53b
|
@ -496,12 +496,13 @@ def convertBlindBet(actionTypes, actionAmounts):
|
||||||
blinds=[]
|
blinds=[]
|
||||||
bets=[]
|
bets=[]
|
||||||
for k in xrange(len(actionTypes[i][j])):
|
for k in xrange(len(actionTypes[i][j])):
|
||||||
if (actionTypes[i][j][k]=="blind"):
|
if actionTypes[i][j][k] == "blind":
|
||||||
blinds.append((i,j,k))
|
blinds.append((i,j,k))
|
||||||
|
|
||||||
if (len(blinds)>0 and actionTypes[i][j][k]=="bet"):
|
if blinds and actionTypes[i][j][k] == "bet":
|
||||||
|
# if (len(blinds)>0 and actionTypes[i][j][k]=="bet"):
|
||||||
bets.append((i,j,k))
|
bets.append((i,j,k))
|
||||||
if (len(bets)==1):
|
if len(bets) == 1:
|
||||||
blind_amount=actionAmounts[blinds[0][0]][blinds[0][1]][blinds[0][2]]
|
blind_amount=actionAmounts[blinds[0][0]][blinds[0][1]][blinds[0][2]]
|
||||||
bet_amount=actionAmounts[bets[0][0]][bets[0][1]][bets[0][2]]
|
bet_amount=actionAmounts[bets[0][0]][bets[0][1]][bets[0][2]]
|
||||||
actionAmounts[bets[0][0]][bets[0][1]][bets[0][2]]=bet_amount-blind_amount
|
actionAmounts[bets[0][0]][bets[0][1]][bets[0][2]]=bet_amount-blind_amount
|
||||||
|
@ -755,7 +756,8 @@ def isActionLine(line):
|
||||||
elif (line.startswith("Uncalled bet")):
|
elif (line.startswith("Uncalled bet")):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return len( [ x for x in ActionLines if x in line]) > 0
|
return any(x for x in ActionLines if x in line)
|
||||||
|
# return bool([ x for x in ActionLines if x in line])
|
||||||
# ret = any(True for searchstr in ActionLines if searchstr in line)
|
# ret = any(True for searchstr in ActionLines if searchstr in line)
|
||||||
# ret = len( [ x for x in ActionLines if line.find(x) > -1] ) > 0
|
# ret = len( [ x for x in ActionLines if line.find(x) > -1] ) > 0
|
||||||
# ret = any(searchstr in line for searchstr in ActionLines)
|
# ret = any(searchstr in line for searchstr in ActionLines)
|
||||||
|
@ -785,7 +787,7 @@ WinLines = ( "wins the pot", "ties for the ", "wins side pot", "wins the low mai
|
||||||
"wins the high pot", "wins the high side pot", "wins the main pot", "wins the side pot", "collected" )
|
"wins the high pot", "wins the high side pot", "wins the main pot", "wins the side pot", "collected" )
|
||||||
#returns boolean whether the passed line is a win line
|
#returns boolean whether the passed line is a win line
|
||||||
def isWinLine(line):
|
def isWinLine(line):
|
||||||
return len( [ x for x in WinLines if x in line ] ) > 0
|
return any(x for x in WinLines if x in line)
|
||||||
#end def isWinLine
|
#end def isWinLine
|
||||||
|
|
||||||
#returns the amount of cash/chips put into the put in the given action line
|
#returns the amount of cash/chips put into the put in the given action line
|
||||||
|
@ -2234,7 +2236,7 @@ def storeHudCache(cursor, base, category, gametypeId, playerIds, hudImportData):
|
||||||
except TypeError:
|
except TypeError:
|
||||||
row=[]
|
row=[]
|
||||||
|
|
||||||
if (len(row)==0):
|
if not row:
|
||||||
#print "new huddata row"
|
#print "new huddata row"
|
||||||
doInsert=True
|
doInsert=True
|
||||||
row=[]
|
row=[]
|
||||||
|
@ -2247,9 +2249,11 @@ def storeHudCache(cursor, base, category, gametypeId, playerIds, hudImportData):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
doInsert=False
|
doInsert=False
|
||||||
|
# This is making a copy of the original list, although i really don't see any reason it's being done?
|
||||||
newrow=[]
|
newrow=[]
|
||||||
for i in xrange(len(row)):
|
newrow.extend(row)
|
||||||
newrow.append(row[i])
|
# for i in xrange(len(row)):
|
||||||
|
# newrow.append(row[i])
|
||||||
row=newrow
|
row=newrow
|
||||||
|
|
||||||
if base=="hold":
|
if base=="hold":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user