Merge branch 'master' of git://git.assembla.com/fpdboz.git
This commit is contained in:
commit
fd210c028a
|
@ -1759,10 +1759,10 @@ class Database:
|
||||||
def getSqlPlayerIDs(self, pnames, siteid):
|
def getSqlPlayerIDs(self, pnames, siteid):
|
||||||
result = {}
|
result = {}
|
||||||
if(self.pcache == None):
|
if(self.pcache == None):
|
||||||
self.pcache = LambdaDict(lambda key:self.insertPlayer(key, siteid))
|
self.pcache = LambdaDict(lambda key:self.insertPlayer(key[0], key[1]))
|
||||||
|
|
||||||
for player in pnames:
|
for player in pnames:
|
||||||
result[player] = self.pcache[player]
|
result[player] = self.pcache[(player,siteid)]
|
||||||
# NOTE: Using the LambdaDict does the same thing as:
|
# NOTE: Using the LambdaDict does the same thing as:
|
||||||
#if player in self.pcache:
|
#if player in self.pcache:
|
||||||
# #print "DEBUG: cachehit"
|
# #print "DEBUG: cachehit"
|
||||||
|
|
|
@ -56,7 +56,6 @@ class DerivedStats():
|
||||||
self.handsplayers[player[1]]['stealAttemptChance'] = False
|
self.handsplayers[player[1]]['stealAttemptChance'] = False
|
||||||
self.handsplayers[player[1]]['stealAttempted'] = False
|
self.handsplayers[player[1]]['stealAttempted'] = False
|
||||||
self.handsplayers[player[1]]['foldBbToStealChance'] = False
|
self.handsplayers[player[1]]['foldBbToStealChance'] = False
|
||||||
self.handsplayers[player[1]]['foldBbToStealChance'] = False
|
|
||||||
self.handsplayers[player[1]]['foldSbToStealChance'] = False
|
self.handsplayers[player[1]]['foldSbToStealChance'] = False
|
||||||
self.handsplayers[player[1]]['foldedSbToSteal'] = False
|
self.handsplayers[player[1]]['foldedSbToSteal'] = False
|
||||||
self.handsplayers[player[1]]['foldedBbToSteal'] = False
|
self.handsplayers[player[1]]['foldedBbToSteal'] = False
|
||||||
|
@ -281,33 +280,37 @@ class DerivedStats():
|
||||||
def calcSteals(self, hand):
|
def calcSteals(self, hand):
|
||||||
"""Fills stealAttempt(Chance|ed, fold(Bb|Sb)ToSteal(Chance|)
|
"""Fills stealAttempt(Chance|ed, fold(Bb|Sb)ToSteal(Chance|)
|
||||||
|
|
||||||
Steal attemp - open raise on positions 2 1 0 S - i.e. MP3, CO, BU, SB
|
Steal attempt - open raise on positions 1 0 S - i.e. MP3, CO, BU, SB
|
||||||
Fold to steal - folding blind after steal attemp wo any other callers or raisers
|
Fold to steal - folding blind after steal attemp wo any other callers or raisers
|
||||||
"""
|
"""
|
||||||
steal_attemp = False
|
steal_attempt = False
|
||||||
steal_positions = ('2', '1', '0', 'S')
|
steal_positions = (1, 0, 'S')
|
||||||
if hand.gametype['base'] == 'stud':
|
if hand.gametype['base'] == 'stud':
|
||||||
steal_positions = ('2', '1', '0')
|
steal_positions = (2, 1, 0)
|
||||||
for action in hand.actions[hand.actionStreets[1]]:
|
for action in hand.actions[hand.actionStreets[1]]:
|
||||||
pname, act = action[0], action[1]
|
pname, act = action[0], action[1]
|
||||||
#print action[0], hp.position, steal_attemp, act
|
posn = self.handsplayers[pname]['position']
|
||||||
if self.handsplayers[pname]['position'] == 'B':
|
#print "\naction:", action[0], posn, type(posn), steal_attempt, act
|
||||||
|
if posn == 'B':
|
||||||
#NOTE: Stud games will never hit this section
|
#NOTE: Stud games will never hit this section
|
||||||
self.handsplayers[pname]['foldBbToStealChance'] = steal_attemp
|
self.handsplayers[pname]['foldBbToStealChance'] = steal_attempt
|
||||||
self.handsplayers[pname]['foldBbToSteal'] = self.handsplayers[pname]['foldBbToStealChance'] and act == 'folds'
|
self.handsplayers[pname]['foldedBbToSteal'] = steal_attempt and act == 'folds'
|
||||||
break
|
break
|
||||||
elif self.handsplayers[pname]['position'] == 'S':
|
elif posn == 'S':
|
||||||
self.handsplayers[pname]['foldSbToStealChance'] = steal_attemp
|
self.handsplayers[pname]['foldSbToStealChance'] = steal_attempt
|
||||||
self.handsplayers[pname]['foldSbToSteal'] = self.handsplayers[pname]['foldSbToStealChance'] and act == 'folds'
|
self.handsplayers[pname]['foldedSbToSteal'] = steal_attempt and act == 'folds'
|
||||||
|
|
||||||
if steal_attemp and act != 'folds':
|
if steal_attempt and act != 'folds':
|
||||||
break
|
break
|
||||||
|
|
||||||
if self.handsplayers[pname]['position'] in steal_positions and not steal_attemp:
|
if posn in steal_positions and not steal_attempt:
|
||||||
self.handsplayers[pname]['stealAttemptChance'] = True
|
self.handsplayers[pname]['stealAttemptChance'] = True
|
||||||
if act in ('bets', 'raises'):
|
if act in ('bets', 'raises'):
|
||||||
self.handsplayers[pname]['stealAttempted'] = True
|
self.handsplayers[pname]['stealAttempted'] = True
|
||||||
steal_attemp = True
|
steal_attempt = True
|
||||||
|
|
||||||
|
if posn not in steal_positions and act != 'folds':
|
||||||
|
break
|
||||||
|
|
||||||
def calc34BetStreet0(self, hand):
|
def calc34BetStreet0(self, hand):
|
||||||
"""Fills street0_(3|4)B(Chance|Done), other(3|4)BStreet0"""
|
"""Fills street0_(3|4)B(Chance|Done), other(3|4)BStreet0"""
|
||||||
|
|
|
@ -35,9 +35,6 @@ import traceback
|
||||||
|
|
||||||
(options, argv) = Options.fpdb_options()
|
(options, argv) = Options.fpdb_options()
|
||||||
|
|
||||||
if not options.errorsToConsole:
|
|
||||||
print "Note: error output is being logged. Any major error will be reported there _only_."
|
|
||||||
|
|
||||||
import thread
|
import thread
|
||||||
import time
|
import time
|
||||||
import string
|
import string
|
||||||
|
@ -79,6 +76,14 @@ class HUD_main(object):
|
||||||
log = Configuration.get_logger("logging.conf", "hud", log_dir=self.config.dir_log)
|
log = Configuration.get_logger("logging.conf", "hud", log_dir=self.config.dir_log)
|
||||||
log.info("HUD_main starting")
|
log.info("HUD_main starting")
|
||||||
log.info("Using db name = %s" % (db_name))
|
log.info("Using db name = %s" % (db_name))
|
||||||
|
|
||||||
|
if not options.errorsToConsole:
|
||||||
|
fileName = os.path.join(self.config.dir_log, 'HUD-errors.txt')
|
||||||
|
print "Note: error output is being diverted to\n"+fileName \
|
||||||
|
+ "\nAny major error will be reported there _only_.\n"
|
||||||
|
errorFile = open(fileName, 'w', 0)
|
||||||
|
sys.stderr = errorFile
|
||||||
|
|
||||||
self.hud_dict = {}
|
self.hud_dict = {}
|
||||||
self.hud_params = self.config.get_hud_ui_parameters()
|
self.hud_params = self.config.get_hud_ui_parameters()
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ class PokerStars(HandHistoryConverter):
|
||||||
re.MULTILINE|re.VERBOSE)
|
re.MULTILINE|re.VERBOSE)
|
||||||
|
|
||||||
re_HandInfo = re.compile("""
|
re_HandInfo = re.compile("""
|
||||||
^Table\s\'(?P<TABLE>[-\ a-zA-Z\d]+)\'\s
|
^Table\s\'(?P<TABLE>[-\ \#a-zA-Z\d]+)\'\s
|
||||||
((?P<MAX>\d+)-max\s)?
|
((?P<MAX>\d+)-max\s)?
|
||||||
(?P<PLAY>\(Play\sMoney\)\s)?
|
(?P<PLAY>\(Play\sMoney\)\s)?
|
||||||
(Seat\s\#(?P<BUTTON>\d+)\sis\sthe\sbutton)?""",
|
(Seat\s\#(?P<BUTTON>\d+)\sis\sthe\sbutton)?""",
|
||||||
|
|
|
@ -53,7 +53,7 @@ if os.name == 'nt':
|
||||||
raw_input("Press ENTER to continue.")
|
raw_input("Press ENTER to continue.")
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
print "Python " + sys.version[0:3] + '...\n'
|
print "Python " + sys.version[0:3] + '...'
|
||||||
|
|
||||||
import traceback
|
import traceback
|
||||||
import threading
|
import threading
|
||||||
|
@ -62,12 +62,6 @@ import string
|
||||||
cl_options = string.join(sys.argv[1:])
|
cl_options = string.join(sys.argv[1:])
|
||||||
(options, argv) = Options.fpdb_options()
|
(options, argv) = Options.fpdb_options()
|
||||||
|
|
||||||
if not options.errorsToConsole:
|
|
||||||
print "Note: error output is being diverted to fpdb-error-log.txt and HUD-error.txt. Any major error will be reported there _only_."
|
|
||||||
errorFile = open('fpdb-error-log.txt', 'w', 0)
|
|
||||||
sys.stderr = errorFile
|
|
||||||
|
|
||||||
#import logging
|
|
||||||
import logging, logging.config
|
import logging, logging.config
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -910,6 +904,13 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
|
||||||
self.window.show()
|
self.window.show()
|
||||||
self.load_profile()
|
self.load_profile()
|
||||||
|
|
||||||
|
if not options.errorsToConsole:
|
||||||
|
fileName = os.path.join(self.config.dir_log, 'fpdb-errors.txt')
|
||||||
|
print "\nNote: error output is being diverted to fpdb-errors.txt and HUD-errors.txt in\n" \
|
||||||
|
+ self.config.dir_log + "Any major error will be reported there _only_.\n"
|
||||||
|
errorFile = open(fileName, 'w', 0)
|
||||||
|
sys.stderr = errorFile
|
||||||
|
|
||||||
self.statusIcon = gtk.StatusIcon()
|
self.statusIcon = gtk.StatusIcon()
|
||||||
if os.path.exists(os.path.join(sys.path[0], '../gfx/fpdb-cards.png')):
|
if os.path.exists(os.path.join(sys.path[0], '../gfx/fpdb-cards.png')):
|
||||||
self.statusIcon.set_from_file(os.path.join(sys.path[0], '../gfx/fpdb-cards.png'))
|
self.statusIcon.set_from_file(os.path.join(sys.path[0], '../gfx/fpdb-cards.png'))
|
||||||
|
|
|
@ -451,7 +451,7 @@ class Importer:
|
||||||
to_hud.append(hand.dbid_hands)
|
to_hud.append(hand.dbid_hands)
|
||||||
else: # TODO: Treat empty as an error, or just ignore?
|
else: # TODO: Treat empty as an error, or just ignore?
|
||||||
log.error("Hand processed but empty")
|
log.error("Hand processed but empty")
|
||||||
self.database.commit()
|
|
||||||
# Call hudcache update if not in bulk import mode
|
# Call hudcache update if not in bulk import mode
|
||||||
# FIXME: Need to test for bulk import that isn't rebuilding the cache
|
# FIXME: Need to test for bulk import that isn't rebuilding the cache
|
||||||
if self.callHud:
|
if self.callHud:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user