From 11f50765c9ac78f92bbb6e620f07710dbf71d582 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sat, 24 Oct 2009 12:16:26 +0100 Subject: [PATCH 1/3] fix main --- pyfpdb/Stats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/Stats.py b/pyfpdb/Stats.py index 614f48ed..3a08e470 100755 --- a/pyfpdb/Stats.py +++ b/pyfpdb/Stats.py @@ -657,9 +657,9 @@ def ffreq4(stat_dict, player): if __name__== "__main__": c = Configuration.Config() - db_connection = Database.Database(c, 'fpdb', 'holdem') + db_connection = Database.Database(c) h = db_connection.get_last_hand() - stat_dict = db_connection.get_stats_from_hand(h) + stat_dict = db_connection.get_stats_from_hand(h, "ring") for player in stat_dict.keys(): print "player = ", player, do_stat(stat_dict, player = player, stat = 'vpip') From d39a34686ef0ea6ee1098f7d07c495ae3a2bea29 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sat, 24 Oct 2009 12:41:51 +0100 Subject: [PATCH 2/3] tidy up main() output --- pyfpdb/Stats.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pyfpdb/Stats.py b/pyfpdb/Stats.py index 3a08e470..d54ccf12 100755 --- a/pyfpdb/Stats.py +++ b/pyfpdb/Stats.py @@ -93,7 +93,7 @@ def do_stat(stat_dict, player = 24, stat = 'vpip'): # functions that return individual stats def totalprofit(stat_dict, player): - """ Total Profit.""" + """ Total Profit.""" if stat_dict[player]['net'] != 0: stat = float(stat_dict[player]['net']) / 100 return (stat, '$%.2f' % stat, 'tp=$%.2f' % stat, 'totalprofit=$%.2f' % stat, str(stat), 'Total Profit') @@ -663,11 +663,9 @@ if __name__== "__main__": for player in stat_dict.keys(): print "player = ", player, do_stat(stat_dict, player = player, stat = 'vpip') - print "player = ", player, do_stat(stat_dict, player = player, stat = 'vpip_0') print "player = ", player, do_stat(stat_dict, player = player, stat = 'pfr') - print "player = ", player, do_stat(stat_dict, player = player, stat = 'pfr_0') print "player = ", player, do_stat(stat_dict, player = player, stat = 'wtsd') - print "player = ", player, do_stat(stat_dict, player = player, stat = 'profit100_0') + print "player = ", player, do_stat(stat_dict, player = player, stat = 'profit100') print "player = ", player, do_stat(stat_dict, player = player, stat = 'saw_f') print "player = ", player, do_stat(stat_dict, player = player, stat = 'n') print "player = ", player, do_stat(stat_dict, player = player, stat = 'fold_f') @@ -675,14 +673,13 @@ if __name__== "__main__": print "player = ", player, do_stat(stat_dict, player = player, stat = 'steal') print "player = ", player, do_stat(stat_dict, player = player, stat = 'f_SB_steal') print "player = ", player, do_stat(stat_dict, player = player, stat = 'f_BB_steal') - print "player = ", player, do_stat(stat_dict, player = player, stat = 'three_B_0') + print "player = ", player, do_stat(stat_dict, player = player, stat = 'three_B') print "player = ", player, do_stat(stat_dict, player = player, stat = 'WMsF') print "player = ", player, do_stat(stat_dict, player = player, stat = 'a_freq1') print "player = ", player, do_stat(stat_dict, player = player, stat = 'a_freq2') print "player = ", player, do_stat(stat_dict, player = player, stat = 'a_freq3') print "player = ", player, do_stat(stat_dict, player = player, stat = 'a_freq4') print "player = ", player, do_stat(stat_dict, player = player, stat = 'a_freq_123') - print "player = ", player, do_stat(stat_dict, player = player, stat = 'a_freq_123_0') print "player = ", player, do_stat(stat_dict, player = player, stat = 'cb1') print "player = ", player, do_stat(stat_dict, player = player, stat = 'cb2') print "player = ", player, do_stat(stat_dict, player = player, stat = 'cb3') @@ -694,13 +691,15 @@ if __name__== "__main__": print "\n" print "\n\nLegal stats:" + print "(add _0 to name to display with 0 decimal places, _1 to display with 1, etc)\n" for attr in dir(): if attr.startswith('__'): continue if attr in ("Configuration", "Database", "GInitiallyUnowned", "gtk", "pygtk", "player", "c", "db_connection", "do_stat", "do_tip", "stat_dict", - "h"): continue + "h", "re", "re_Percent", "re_Places"): continue print "%-14s %s" % (attr, eval("%s.__doc__" % (attr))) # print " " % (attr) + print db_connection.close_connection From b1d65dbadd5ce5a93ca98669773c0d076bb58838 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sat, 24 Oct 2009 20:01:24 +0100 Subject: [PATCH 3/3] default all values in hud_params when not passed into get_stats_from_hand --- pyfpdb/Database.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index bb9739ec..1533c05c 100755 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -427,7 +427,8 @@ class Database: print "***Error: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1]) def get_stats_from_hand( self, hand, type # type is "ring" or "tour" - , hud_params = {'aggregate_tour':False, 'aggregate_ring':False, 'hud_style':'A', 'agg_bb_mult':100} + , hud_params = {'aggregate_tour':False, 'aggregate_ring':False, 'hud_style':'A', 'hud_days':30, 'agg_bb_mult':100 + ,'h_aggregate_tour':False, 'h_aggregate_ring':False, 'h_hud_style':'S', 'h_hud_days':30, 'h_agg_bb_mult':100} , hero_id = -1 ): aggregate = hud_params['aggregate_tour'] if type == "tour" else hud_params['aggregate_ring']