From 375e0ed7c9a089a2a2a7c5f6dc01ec0f7baf4d6d Mon Sep 17 00:00:00 2001 From: eblade Date: Thu, 19 Mar 2009 03:30:44 -0400 Subject: [PATCH] fpdb_parse_logic: fix possible breakage i might've made to tournament parse fpdb_simple: more usage of 'any' operator where appropriate --- pyfpdb/fpdb_parse_logic.py | 3 +-- pyfpdb/fpdb_simple.py | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/pyfpdb/fpdb_parse_logic.py b/pyfpdb/fpdb_parse_logic.py index a58aba78..7d518e94 100644 --- a/pyfpdb/fpdb_parse_logic.py +++ b/pyfpdb/fpdb_parse_logic.py @@ -141,8 +141,7 @@ def mainParser(backend, db, cursor, site, category, hand, config): , actionTypes, actionAmounts, antes) if isTourney: - ranks = [] - map(lambda x: 0, names) # create an array of 0's equal to the length of names + ranks = map(lambda x: 0, names) # create an array of 0's equal to the length of names payin_amounts = fpdb_simple.calcPayin(len(names), buyin, fee) if base == "hold": diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py index d94e4658..a4c440c1 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -1864,9 +1864,8 @@ sure to also change the following storage method and table_viewer.prepare_data i #flop stuff street=1 if myStreet1Seen: - for count in xrange(len(action_types[street][player])): - if action_types[street][player][count]=="bet": - myStreet1Aggr=True + if any(actiontype == "bet" for actiontype in action_types[street][player]): + myStreet1Aggr = True for otherPlayer in xrange(len(player_ids)): if player==otherPlayer: @@ -1882,9 +1881,8 @@ sure to also change the following storage method and table_viewer.prepare_data i #turn stuff - copy of flop with different vars street=2 if myStreet2Seen: - for count in xrange(len(action_types[street][player])): - if action_types[street][player][count]=="bet": - myStreet2Aggr=True + if any(actiontype == "bet" for actiontype in action_types[street][player]): + myStreet2Aggr = True for otherPlayer in xrange(len(player_ids)): if player==otherPlayer: @@ -1900,9 +1898,8 @@ sure to also change the following storage method and table_viewer.prepare_data i #river stuff - copy of flop with different vars street=3 if myStreet3Seen: - for count in xrange(len(action_types[street][player])): - if action_types[street][player][count]=="bet": - myStreet3Aggr=True + if any(actiontype == "bet" for actiontype in action_types[street][player]): + myStreet3Aggr = True for otherPlayer in xrange(len(player_ids)): if player==otherPlayer: @@ -1918,9 +1915,8 @@ sure to also change the following storage method and table_viewer.prepare_data i #stud river stuff - copy of flop with different vars street=4 if myStreet4Seen: - for count in xrange(len(action_types[street][player])): - if action_types[street][player][count]=="bet": - myStreet4Aggr=True + if any(actiontype == "bet" for actiontype in action_types[street][player]): + myStreet4Aggr=True for otherPlayer in xrange(len(player_ids)): if player==otherPlayer: @@ -1933,9 +1929,9 @@ sure to also change the following storage method and table_viewer.prepare_data i if action_types[street][player][countOtherFold]=="fold": myFoldToOtherRaisedStreet4=True - if winnings[player]!=0: + if winnings[player] != 0: if myStreet1Seen: - myWonWhenSeenStreet1=winnings[player]/float(totalWinnings) + myWonWhenSeenStreet1 = winnings[player] / float(totalWinnings) if mySawShowdown: myWonAtSD=myWonWhenSeenStreet1