Merge branch 'master' of git://git.assembla.com/fpdboz

This commit is contained in:
sqlcoder 2010-02-01 19:49:57 +00:00
commit 7e5f63ce89
6 changed files with 41 additions and 31 deletions

View File

@ -141,7 +141,7 @@ def valueSuitFromCard(card):
encodeCardList = {'2h': 1, '3h': 2, '4h': 3, '5h': 4, '6h': 5, '7h': 6, '8h': 7, '9h': 8, 'Th': 9, 'Jh': 10, 'Qh': 11, 'Kh': 12, 'Ah': 13, encodeCardList = {'2h': 1, '3h': 2, '4h': 3, '5h': 4, '6h': 5, '7h': 6, '8h': 7, '9h': 8, 'Th': 9, 'Jh': 10, 'Qh': 11, 'Kh': 12, 'Ah': 13,
'2d': 14, '3d': 15, '4d': 16, '5d': 17, '6d': 18, '7d': 19, '8d': 20, '9d': 21, 'Td': 22, 'Jd': 23, 'Qd': 24, 'Kd': 25, 'Ad': 26, '2d': 14, '3d': 15, '4d': 16, '5d': 17, '6d': 18, '7d': 19, '8d': 20, '9d': 21, 'Td': 22, 'Jd': 23, 'Qd': 24, 'Kd': 25, 'Ad': 26,
'2c': 27, '3c': 28, '4c': 29, '5c': 30, '6c': 31, '7c': 32, '8c': 33, '9c': 34, 'Tc': 35, 'Jc': 36, 'Qc': 27, 'Kc': 38, 'Ac': 39, '2c': 27, '3c': 28, '4c': 29, '5c': 30, '6c': 31, '7c': 32, '8c': 33, '9c': 34, 'Tc': 35, 'Jc': 36, 'Qc': 37, 'Kc': 38, 'Ac': 39,
'2s': 40, '3s': 41, '4s': 42, '5s': 43, '6s': 44, '7s': 45, '8s': 46, '9s': 47, 'Ts': 48, 'Js': 49, 'Qs': 50, 'Ks': 51, 'As': 52, '2s': 40, '3s': 41, '4s': 42, '5s': 43, '6s': 44, '7s': 45, '8s': 46, '9s': 47, 'Ts': 48, 'Js': 49, 'Qs': 50, 'Ks': 51, 'As': 52,
' ': 0 ' ': 0
} }

View File

@ -42,6 +42,8 @@ def to_utf8(s):
except UnicodeDecodeError: except UnicodeDecodeError:
sys.stderr.write('Could not convert: "%s"\n' % s) sys.stderr.write('Could not convert: "%s"\n' % s)
raise raise
except TypeError: # TypeError is raised when we give unicode() an already encoded string
return s
def to_db_utf8(s): def to_db_utf8(s):
if not_needed2: return s if not_needed2: return s
@ -62,4 +64,3 @@ def to_gui(s):
except UnicodeDecodeError: except UnicodeDecodeError:
sys.stderr.write('Could not convert: "%s"\n' % s) sys.stderr.write('Could not convert: "%s"\n' % s)
raise raise

View File

@ -285,6 +285,10 @@ or None if we fail to get the info """
# hand.addShownCards(cards=None, player=m.group('PNAME'), holeandboard=cards) # hand.addShownCards(cards=None, player=m.group('PNAME'), holeandboard=cards)
hand.addShownCards(cards=cards, player=m.group('PNAME')) hand.addShownCards(cards=cards, player=m.group('PNAME'))
@staticmethod
def getTableTitleRe(type, table_name=None, tournament = None, table_number=None):
return "^%s -" % (table_name)
if __name__ == "__main__": if __name__ == "__main__":
@ -305,4 +309,3 @@ if __name__ == "__main__":
logging.basicConfig(filename=LOG_FILENAME,level=options.verbosity) logging.basicConfig(filename=LOG_FILENAME,level=options.verbosity)
e = Everleaf(in_path = options.ipath, out_path = options.opath, follow = options.follow, autostart=True) e = Everleaf(in_path = options.ipath, out_path = options.opath, follow = options.follow, autostart=True)

View File

@ -137,7 +137,7 @@ class Fulltilt(HandHistoryConverter):
self.re_ShowdownAction = re.compile(r"^%s shows \[(?P<CARDS>.*)\]" % player_re, re.MULTILINE) self.re_ShowdownAction = re.compile(r"^%s shows \[(?P<CARDS>.*)\]" % player_re, re.MULTILINE)
self.re_CollectPot = re.compile(r"^Seat (?P<SEAT>[0-9]+): %s (\(button\) |\(small blind\) |\(big blind\) )?(collected|showed \[.*\] and won) \(\$?(?P<POT>[.,\d]+)\)(, mucked| with.*)" % player_re, re.MULTILINE) self.re_CollectPot = re.compile(r"^Seat (?P<SEAT>[0-9]+): %s (\(button\) |\(small blind\) |\(big blind\) )?(collected|showed \[.*\] and won) \(\$?(?P<POT>[.,\d]+)\)(, mucked| with.*)" % player_re, re.MULTILINE)
self.re_SitsOut = re.compile(r"^%s sits out" % player_re, re.MULTILINE) self.re_SitsOut = re.compile(r"^%s sits out" % player_re, re.MULTILINE)
self.re_ShownCards = re.compile(r"^Seat (?P<SEAT>[0-9]+): %s \(.*\) showed \[(?P<CARDS>.*)\].*" % player_re, re.MULTILINE) self.re_ShownCards = re.compile(r"^Seat (?P<SEAT>[0-9]+): %s (\(button\) |\(small blind\) |\(big blind\) )?(?P<ACT>showed|mucked) \[(?P<CARDS>.*)\].*" % player_re, re.MULTILINE)
def readSupportedGames(self): def readSupportedGames(self):
return [["ring", "hold", "nl"], return [["ring", "hold", "nl"],
@ -390,9 +390,10 @@ class Fulltilt(HandHistoryConverter):
def readShownCards(self,hand): def readShownCards(self,hand):
for m in self.re_ShownCards.finditer(hand.handText): for m in self.re_ShownCards.finditer(hand.handText):
if m.group('CARDS') is not None: if m.group('CARDS') is not None:
cards = m.group('CARDS') if m.group('ACT'):
cards = cards.split(' ') hand.addShownCards(cards=m.group('CARDS').split(' '), player=m.group('PNAME'), shown = False, mucked = True)
hand.addShownCards(cards=cards, player=m.group('PNAME')) else:
hand.addShownCards(cards=m.group('CARDS').split(' '), player=m.group('PNAME'), shown = True, mucked = False)
def guessMaxSeats(self, hand): def guessMaxSeats(self, hand):
"""Return a guess at max_seats when not specified in HH.""" """Return a guess at max_seats when not specified in HH."""

View File

@ -89,7 +89,8 @@ class GuiBulkImport():
for selection in selected: for selection in selected:
self.importer.addBulkImportImportFileOrDir(selection, site = sitename) self.importer.addBulkImportImportFileOrDir(selection, site = sitename)
self.importer.setCallHud(False) self.importer.setCallHud(self.cb_testmode.get_active())
self.importer.bHudTest = self.cb_testmode.get_active()
starttime = time() starttime = time()
# try: # try:
(stored, dups, partial, errs, ttime) = self.importer.runImport() (stored, dups, partial, errs, ttime) = self.importer.runImport()
@ -228,6 +229,10 @@ class GuiBulkImport():
ypadding=0, yoptions=gtk.SHRINK) ypadding=0, yoptions=gtk.SHRINK)
self.cb_dropindexes.show() self.cb_dropindexes.show()
self.cb_testmode = gtk.CheckButton('HUD Test mode')
self.table.attach(self.cb_testmode, 0, 1, 2, 3, xpadding=10, ypadding=0, yoptions=gtk.SHRINK)
self.cb_testmode.show()
# label - filter # label - filter
self.lab_filter = gtk.Label("Site filter:") self.lab_filter = gtk.Label("Site filter:")
self.table.attach(self.lab_filter, 1, 2, 2, 3, xpadding=0, ypadding=0, self.table.attach(self.lab_filter, 1, 2, 2, 3, xpadding=0, ypadding=0,

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sqlite3 import sqlite3
import fpdb_db import Database
import math import math
# Should probably use our wrapper classes - creating sqlite db in memory # Should probably use our wrapper classes - creating sqlite db in memory
@ -14,11 +14,11 @@ con.isolation_level = None
con.create_function("floor", 1, math.floor) con.create_function("floor", 1, math.floor)
#Mod function #Mod function
tmp = fpdb_db.sqlitemath() tmp = Database.sqlitemath()
con.create_function("mod", 2, tmp.mod) con.create_function("mod", 2, tmp.mod)
# Aggregate function VARIANCE() # Aggregate function VARIANCE()
con.create_aggregate("variance", 1, fpdb_db.VARIANCE) con.create_aggregate("variance", 1, Database.VARIANCE)
cur = con.cursor() cur = con.cursor()