cherry picking around a patch that didn't work for me

This commit is contained in:
Eric Blade 2010-08-29 22:56:00 -04:00
parent 82d96b43ee
commit 65642e37df

211
pyfpdb/Stats.py Executable file → Normal file
View File

@ -154,10 +154,10 @@ def vpip(stat_dict, player):
_('Voluntarily Put In Pot Pre-Flop%') _('Voluntarily Put In Pot Pre-Flop%')
) )
except: return (stat, except: return (stat,
'%3.1f' % (0) + '%', 'NA',
'v=%3.1f' % (0) + '%', 'v=NA',
'vpip=%3.1f' % (0) + '%', 'vpip=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('Voluntarily Put In Pot Pre-Flop%') _('Voluntarily Put In Pot Pre-Flop%')
) )
@ -175,10 +175,10 @@ def pfr(stat_dict, player):
) )
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'p=%3.1f' % (0) + '%', 'p=NA',
'pfr=%3.1f' % (0) + '%', 'pfr=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('Pre-Flop Raise %') _('Pre-Flop Raise %')
) )
@ -196,10 +196,10 @@ def wtsd(stat_dict, player):
) )
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'w=%3.1f' % (0) + '%', 'w=NA',
'wtsd=%3.1f' % (0) + '%', 'wtsd=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('% went to showdown') _('% went to showdown')
) )
@ -217,10 +217,10 @@ def wmsd(stat_dict, player):
) )
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'w=%3.1f' % (0) + '%', 'w=NA',
'wmsd=%3.1f' % (0) + '%', 'wmsd=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('% won money at showdown') _('% won money at showdown')
) )
@ -239,10 +239,10 @@ def profit100(stat_dict, player):
except: except:
print _("exception calcing p/100: 100 * %d / %d") % (stat_dict[player]['net'], stat_dict[player]['n']) print _("exception calcing p/100: 100 * %d / %d") % (stat_dict[player]['net'], stat_dict[player]['n'])
return (stat, return (stat,
'%.0f' % (0.0), 'NA',
'p=%.0f' % (0.0), 'p=NA',
'p/100=%.0f' % (0.0), 'p/100=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('profit/100hands') _('profit/100hands')
) )
@ -261,10 +261,10 @@ def bbper100(stat_dict, player):
except: except:
log.info("exception calcing bb/100: "+str(stat_dict[player])) log.info("exception calcing bb/100: "+str(stat_dict[player]))
return (stat, return (stat,
'%.0f' % (0), 'NA',
'bb100=%.0f' % (0), 'bb100=NA',
'bb100=%.0f' % (0), 'bb100=NA',
'(%f)' % (0), '(--)',
_('big blinds/100 hands') _('big blinds/100 hands')
) )
@ -283,10 +283,10 @@ def BBper100(stat_dict, player):
except: except:
log.info(_("exception calcing BB/100: ")+str(stat_dict[player])) log.info(_("exception calcing BB/100: ")+str(stat_dict[player]))
return (stat, return (stat,
'%.0f' % (0.0), 'NA',
'BB100=%.0f' % (0.0), 'BB100=NA',
'BB100=%.0f' % (0.0), 'BB100=NA',
'(%f)' % (0.0), '(--)',
_('Big Bets/100 hands') _('Big Bets/100 hands')
) )
@ -305,13 +305,11 @@ def saw_f(stat_dict, player):
) )
except: except:
stat = 0.0 stat = 0.0
num = 0
den = 0
return (stat, return (stat,
'%3.1f' % (stat) + '%', 'NA',
'sf=%3.1f' % (stat) + '%', 'sf=NA',
'saw_f=%3.1f' % (stat) + '%', 'saw_f=NA',
'(%d/%d)' % (num, den), '(0/0)',
_('Flop Seen %') _('Flop Seen %')
) )
@ -338,6 +336,7 @@ def n(stat_dict, player):
_('number hands seen') _('number hands seen')
) )
except: except:
# Number of hands shouldn't ever be "NA"; zeroes are better here
return (0, return (0,
'%d' % (0), '%d' % (0),
'n=%d' % (0), 'n=%d' % (0),
@ -360,10 +359,10 @@ def fold_f(stat_dict, player):
) )
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'ff=%3.1f' % (0) + '%', 'ff=NA',
'fold_f=%3.1f' % (0) + '%', 'fold_f=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('folded flop/4th') _('folded flop/4th')
) )
@ -455,10 +454,10 @@ def three_B(stat_dict, player):
_('% 3/4 Bet preflop/3rd')) _('% 3/4 Bet preflop/3rd'))
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'3B=%3.1f' % (0) + '%', '3B=NA',
'3B_pf=%3.1f' % (0) + '%', '3B_pf=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('% 3/4 Bet preflop/3rd')) _('% 3/4 Bet preflop/3rd'))
def WMsF(stat_dict, player): def WMsF(stat_dict, player):
@ -474,10 +473,10 @@ def WMsF(stat_dict, player):
_('% won$/saw flop/4th')) _('% won$/saw flop/4th'))
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'wf=%3.1f' % (0) + '%', 'wf=NA',
'w_w_f=%3.1f' % (0) + '%', 'w_w_f=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('% won$/saw flop/4th')) _('% won$/saw flop/4th'))
def a_freq1(stat_dict, player): def a_freq1(stat_dict, player):
@ -493,10 +492,10 @@ def a_freq1(stat_dict, player):
_('Aggression Freq flop/4th')) _('Aggression Freq flop/4th'))
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'a1=%3.1f' % (0) + '%', 'a1=NA',
'a_fq_1=%3.1f' % (0) + '%', 'a_fq_1=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('Aggression Freq flop/4th')) _('Aggression Freq flop/4th'))
def a_freq2(stat_dict, player): def a_freq2(stat_dict, player):
@ -512,10 +511,10 @@ def a_freq2(stat_dict, player):
_('Aggression Freq turn/5th')) _('Aggression Freq turn/5th'))
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'a2=%3.1f' % (0) + '%', 'a2=NA',
'a_fq_2=%3.1f' % (0) + '%', 'a_fq_2=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('Aggression Freq turn/5th')) _('Aggression Freq turn/5th'))
def a_freq3(stat_dict, player): def a_freq3(stat_dict, player):
@ -531,10 +530,10 @@ def a_freq3(stat_dict, player):
_('Aggression Freq river/6th')) _('Aggression Freq river/6th'))
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'a3=%3.1f' % (0) + '%', 'a3=NA',
'a_fq_3=%3.1f' % (0) + '%', 'a_fq_3=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('Aggression Freq river/6th')) _('Aggression Freq river/6th'))
def a_freq4(stat_dict, player): def a_freq4(stat_dict, player):
@ -550,10 +549,10 @@ def a_freq4(stat_dict, player):
_('Aggression Freq 7th')) _('Aggression Freq 7th'))
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'a4=%3.1f' % (0) + '%', 'a4=NA',
'a_fq_4=%3.1f' % (0) + '%', 'a_fq_4=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('Aggression Freq 7th')) _('Aggression Freq 7th'))
def a_freq_123(stat_dict, player): def a_freq_123(stat_dict, player):
@ -576,10 +575,10 @@ def a_freq_123(stat_dict, player):
_('Post-Flop Aggression Freq')) _('Post-Flop Aggression Freq'))
except: except:
return (stat, return (stat,
'%2.0f' % (0) + '%', 'NA',
'a3=%2.0f' % (0) + '%', 'a3=NA',
'a_fq_3=%2.0f' % (0) + '%', 'a_fq_3=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('Post-Flop Aggression Freq')) _('Post-Flop Aggression Freq'))
def agg_freq(stat_dict, player): def agg_freq(stat_dict, player):
@ -604,10 +603,10 @@ def agg_freq(stat_dict, player):
_('Aggression Freq')) _('Aggression Freq'))
except: except:
return (stat, return (stat,
'%2.1f' % (0) + '%', 'NA',
'af=%3.1f' % (0) + '%', 'af=NA',
'agg_f=%3.1f' % (0) + '%', 'agg_f=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('Aggression Freq')) _('Aggression Freq'))
def agg_fact(stat_dict, player): def agg_fact(stat_dict, player):
@ -630,10 +629,10 @@ def agg_fact(stat_dict, player):
_('Aggression Factor')) _('Aggression Factor'))
except: except:
return (stat, return (stat,
'%2.2f' % (0) , 'NA',
'afa=%2.2f' % (0) , 'afa=NA',
'agg_fa=%2.2f' % (0), 'agg_fa=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('Aggression Factor')) _('Aggression Factor'))
def cbet(stat_dict, player): def cbet(stat_dict, player):
@ -654,10 +653,10 @@ def cbet(stat_dict, player):
_('% continuation bet ')) _('% continuation bet '))
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'cbet=%3.1f' % (0) + '%', 'cbet=NA',
'cbet=%3.1f' % (0) + '%', 'cbet=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('% continuation bet ')) _('% continuation bet '))
def cb1(stat_dict, player): def cb1(stat_dict, player):
@ -673,10 +672,10 @@ def cb1(stat_dict, player):
_('% continuation bet flop/4th')) _('% continuation bet flop/4th'))
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'cb1=%3.1f' % (0) + '%', 'cb1=NA',
'cb_1=%3.1f' % (0) + '%', 'cb_1=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('% continuation bet flop/4th')) _('% continuation bet flop/4th'))
def cb2(stat_dict, player): def cb2(stat_dict, player):
@ -692,10 +691,10 @@ def cb2(stat_dict, player):
_('% continuation bet turn/5th')) _('% continuation bet turn/5th'))
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'cb2=%3.1f' % (0) + '%', 'cb2=NA',
'cb_2=%3.1f' % (0) + '%', 'cb_2=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('% continuation bet turn/5th')) _('% continuation bet turn/5th'))
def cb3(stat_dict, player): def cb3(stat_dict, player):
@ -711,10 +710,10 @@ def cb3(stat_dict, player):
_('% continuation bet river/6th')) _('% continuation bet river/6th'))
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'cb3=%3.1f' % (0) + '%', 'cb3=NA',
'cb_3=%3.1f' % (0) + '%', 'cb_3=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('% continuation bet river/6th')) _('% continuation bet river/6th'))
def cb4(stat_dict, player): def cb4(stat_dict, player):
@ -730,10 +729,10 @@ def cb4(stat_dict, player):
_('% continuation bet 7th')) _('% continuation bet 7th'))
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'cb4=%3.1f' % (0) + '%', 'cb4=NA',
'cb_4=%3.1f' % (0) + '%', 'cb_4=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('% continuation bet 7th')) _('% continuation bet 7th'))
def ffreq1(stat_dict, player): def ffreq1(stat_dict, player):
@ -768,10 +767,10 @@ def ffreq2(stat_dict, player):
_('% fold frequency turn/5th')) _('% fold frequency turn/5th'))
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'ff2=%3.1f' % (0) + '%', 'ff2=NA',
'ff_2=%3.1f' % (0) + '%', 'ff_2=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('% fold frequency turn/5th')) _('% fold frequency turn/5th'))
def ffreq3(stat_dict, player): def ffreq3(stat_dict, player):
@ -787,10 +786,10 @@ def ffreq3(stat_dict, player):
_('% fold frequency river/6th')) _('% fold frequency river/6th'))
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'ff3=%3.1f' % (0) + '%', 'ff3=NA',
'ff_3=%3.1f' % (0) + '%', 'ff_3=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('% fold frequency river/6th')) _('% fold frequency river/6th'))
def ffreq4(stat_dict, player): def ffreq4(stat_dict, player):
@ -806,10 +805,10 @@ def ffreq4(stat_dict, player):
_('% fold frequency 7th')) _('% fold frequency 7th'))
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', 'NA',
'ff4=%3.1f' % (0) + '%', 'ff4=NA',
'ff_4=%3.1f' % (0) + '%', 'ff_4=NA',
'(%d/%d)' % (0, 0), '(0/0)',
_('% fold frequency 7th')) _('% fold frequency 7th'))
if __name__== "__main__": if __name__== "__main__":