Merge branch 'steffen'

This commit is contained in:
Mika Bostrom 2010-08-04 19:06:50 +03:00
commit 7056d271d6
10 changed files with 10425 additions and 23 deletions

View File

@ -1371,6 +1371,7 @@ class Database:
# hmmm, tested by commenting out rollback in grapher. lock seems to work but
# then drop still hangs :-( does work in some tests though??
# will leave code here for now pending further tests/enhancement ...
c.execute("BEGIN TRANSACTION")
c.execute( "lock table %s in exclusive mode nowait" % (fk['fktab'],) )
#print "after lock, status:", c.statusmessage
#print "alter table %s drop constraint %s_%s_fkey" % (fk['fktab'], fk['fktab'], fk['fkcol'])
@ -1381,6 +1382,7 @@ class Database:
if "does not exist" not in str(sys.exc_value):
print "warning: drop pg fk %s_%s_fkey failed: %s, continuing ..." \
% (fk['fktab'], fk['fkcol'], str(sys.exc_value).rstrip('\n') )
c.execute("END TRANSACTION")
except:
print "warning: constraint %s_%s_fkey not dropped: %s, continuing ..." \
% (fk['fktab'],fk['fkcol'], str(sys.exc_value).rstrip('\n'))

View File

@ -292,7 +292,7 @@ class DerivedStats():
# hand.players includes people that are sitting out on some sites.
# Those that posted an ante should have been deal cards.
p_in = set([x[0] for x in hand.actions['BLINDSANTES']])
p_in = set([x[0] for x in hand.actions['BLINDSANTES']] + [x[0] for x in hand.actions['PREFLOP']])
for (i, street) in enumerate(hand.actionStreets):
actions = hand.actions[street]

View File

@ -58,7 +58,7 @@ class Everleaf(HandHistoryConverter):
self.re_HeroCards = re.compile(ur"^Dealt to %s \[ (?P<CARDS>.*) \]$" % player_re, re.MULTILINE)
# ^%s(?P<ATYPE>: bets| checks| raises| calls| folds)(\s\[(?:\$| €|) (?P<BET>[.,\d]+) (USD|EURO|Chips)\])?
self.re_Action = re.compile(ur"^%s(?P<ATYPE>: bets| checks| raises| calls| folds)(\s\[(?:[$€]?) (?P<BET>[.,\d]+)\s?(USD|EURO|Chips|)\])?" % player_re, re.MULTILINE)
self.re_ShowdownAction = re.compile(ur"^%s shows \[ (?P<CARDS>.*) \]$" % player_re, re.MULTILINE)
self.re_ShowdownAction = re.compile(ur"^%s shows \[ (?P<CARDS>.*) \]" % player_re, re.MULTILINE)
self.re_CollectPot = re.compile(ur"^%s wins (?:[$€]?)\s?(?P<POT>[.\d]+) (USD|EURO|chips)(.*?\[ (?P<CARDS>.*?) \])?" % player_re, re.MULTILINE)
self.re_SitsOut = re.compile(ur"^%s sits out" % player_re, re.MULTILINE)

View File

@ -556,22 +556,26 @@ Left-Drag to Move"
<popup_windows>
<pu pu_name="default">
<pu_stat pu_stat_name="playername"> </pu_stat>
<pu_stat pu_stat_name="totalprofit"> </pu_stat>
<pu_stat pu_stat_name="profit100"> </pu_stat>
<pu_stat pu_stat_name="n"> </pu_stat>
<pu_stat pu_stat_name="vpip"> </pu_stat>
<pu_stat pu_stat_name="pfr"> </pu_stat>
<pu_stat pu_stat_name="three_B_0"> </pu_stat>
<pu_stat pu_stat_name="steal"> </pu_stat>
<pu_stat pu_stat_name="f_steal"> </pu_stat>
<pu_stat pu_stat_name="f_BB_steal"> </pu_stat>
<pu_stat pu_stat_name="f_SB_steal"> </pu_stat>
<pu_stat pu_stat_name="wmsd"> </pu_stat>
<pu_stat pu_stat_name="wtsd"> </pu_stat>
<pu_stat pu_stat_name="WMsF"> </pu_stat>
<pu_stat pu_stat_name="agg_fact"> </pu_stat>
<pu_stat pu_stat_name="a_freq1"> </pu_stat>
<pu_stat pu_stat_name="a_freq2"> </pu_stat>
<pu_stat pu_stat_name="a_freq3"> </pu_stat>
<pu_stat pu_stat_name="a_freq4"> </pu_stat>
<pu_stat pu_stat_name="agg_freq"> </pu_stat>
<pu_stat pu_stat_name="agg_fact"> </pu_stat>
<pu_stat pu_stat_name="cbet"> </pu_stat>
<pu_stat pu_stat_name="cb1"> </pu_stat>
<pu_stat pu_stat_name="cb2"> </pu_stat>

View File

@ -79,13 +79,13 @@ class Hand(object):
self.fee = None # the Database code is looking for this one .. ?
self.level = None
self.mixed = None
self.speed = "Normal"
self.isRebuy = False
self.isAddOn = False
self.isKO = False
self.speed = None
self.isRebuy = None
self.isAddOn = None
self.isKO = None
self.koBounty = None
self.isMatrix = False
self.isShootout = False
self.isMatrix = None
self.isShootout = None
self.added = None
self.addedCurrency = None
self.tourneyComment = None

View File

@ -433,9 +433,9 @@ or None if we fail to get the info """
try:
in_fh = codecs.open(self.in_path, 'r', kodec)
whole_file = in_fh.read()
in_fh.close()
self.obs = whole_file[self.index:]
self.index = len(whole_file)
in_fh.close()
break
except:
pass

View File

@ -72,7 +72,7 @@ class PokerStars(HandHistoryConverter):
(Tournament\s\# # open paren of tournament info
(?P<TOURNO>\d+),\s
# here's how I plan to use LS
(?P<BUYIN>(?P<BIAMT>[%(LS)s\d\.]+)?\+?(?P<BOUNTY>[%(LS)s\d\.]+)?\+?(?P<BIRAKE>[%(LS)s\d\.]+)\s?(?P<TOUR_ISO>%(LEGAL_ISO)s)?|Freeroll)\s+)?
(?P<BUYIN>(?P<BIAMT>[%(LS)s\d\.]+)?\+?(?P<BIRAKE>[%(LS)s\d\.]+)?\+?(?P<BOUNTY>[%(LS)s\d\.]+)?\s?(?P<TOUR_ISO>%(LEGAL_ISO)s)?|Freeroll)\s+)?
# close paren of tournament info
(?P<MIXED>HORSE|8\-Game|HOSE)?\s?\(?
(?P<GAME>Hold\'em|Razz|RAZZ|7\sCard\sStud|7\sCard\sStud\sHi/Lo|Omaha|Omaha\sHi/Lo|Badugi|Triple\sDraw\s2\-7\sLowball|5\sCard\sDraw)\s
@ -251,17 +251,26 @@ class PokerStars(HandHistoryConverter):
#FIXME: handle other currencies, FPP, play money
raise FpdbParseError("failed to detect currency")
info['BIAMT'] = info['BIAMT'].strip(u'$€FPP')
if hand.buyinCurrency!="PSFP":
hand.buyin = int(100*Decimal(info['BIAMT'][1:]))
if info['BIRAKE'][0]!="$": #we have a non-bounty game
info['BOUNTY']=info['BOUNTY']+info['BIRAKE'] #TODO remove this dirty dirty hack by fixing regex
hand.fee = int(100*Decimal(info['BOUNTY'][1:]))
else:
hand.fee = int(100*Decimal(info['BIRAKE'][1:]))
if info['BOUNTY'] != None:
# There is a bounty, Which means we need to switch BOUNTY and BIRAKE values
tmp = info['BOUNTY']
info['BOUNTY'] = info['BIRAKE']
info['BIRAKE'] = tmp
info['BOUNTY'] = info['BOUNTY'].strip(u'$€') # Strip here where it isn't 'None'
hand.koBounty = int(100*Decimal(info['BOUNTY']))
hand.isKO = True
hand.koBounty = int(100*Decimal(info['BOUNTY'][1:]))
else:
hand.buyin = int(Decimal(info[key][0:-3]))
hand.isKO = False
info['BIRAKE'] = info['BIRAKE'].strip(u'$€')
hand.buyin = int(100*Decimal(info['BIAMT']))
hand.fee = int(100*Decimal(info['BIRAKE']))
else:
hand.buyin = int(Decimal(info['BIAMT']))
hand.fee = 0
if key == 'LEVEL':
hand.level = info[key]

View File

@ -589,8 +589,8 @@ def agg_fact(stat_dict, player):
def cbet(stat_dict, player):
""" Flop continuation bet."""
""" Continuation bet % = (times made a continuation bet on the flop) * 100 / (number of opportunities to make a continuation bet on the flop) """
""" Total continuation bet."""
""" Continuation bet % = (times made a continuation bet on any street) * 100 / (number of opportunities to make a continuation bet on any street) """
stat = 0.0
try:

View File

@ -464,8 +464,11 @@ class Importer:
#pipe the Hands.id out to the HUD
for hid in to_hud:
try:
print "fpdb_import: sending hand to hud", hand.dbid_hands, "pipe =", self.caller.pipe_to_hud
self.caller.pipe_to_hud.stdin.write("%s" % (hid) + os.linesep)
except IOError, e:
log.error("Failed to send hand to HUD: %s" % e)
errors = getattr(hhc, 'numErrors')
stored = getattr(hhc, 'numHands')

File diff suppressed because it is too large Load Diff