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

This commit is contained in:
sqlcoder 2009-12-03 20:14:12 +00:00
commit 9dd09fe8a1
5 changed files with 124 additions and 16 deletions

37
pyfpdb/Anonymise.py Normal file
View File

@ -0,0 +1,37 @@
import os
import re
import codecs
import Options
import HandHistoryConverter
(options, argv) = Options.fpdb_options()
filter = options.hhc
filter_name = filter.replace("ToFpdb", "")
mod = __import__(filter)
obj = getattr(mod, filter_name, None)
hhc = obj(autostart=False)
if os.path.exists(options.infile):
in_fh = codecs.open(options.infile, 'r', "utf8")
filecontents = in_fh.read()
in_fh.close()
else:
print "Could not find file %s" % options.infile
exit(1)
m = hhc.re_PlayerInfo.finditer(filecontents)
players = []
for a in m:
players = players + [a.group('PNAME')]
uniq = set(players)
for i, name in enumerate(uniq, 1):
filecontents = filecontents.replace(name, 'Player%d' %i)
print filecontents

View File

@ -36,8 +36,11 @@ def fpdb_options():
action="store_true",
help="Indicates program was restarted with a different path (only allowed once).")
parser.add_option("-i", "--infile",
dest="config", default=None,
dest="infile", default="Slartibartfast",
help="Input file")
parser.add_option("-k", "--konverter",
dest="hhc", default="PokerStarsToFpdb",
help="Module name for Hand History Converter")
(options, argv) = parser.parse_args()
return (options, argv)

View File

@ -2572,7 +2572,7 @@ class Sql:
AND h.handStart < '<enddate_test>'
<limit_test>
AND hp.tourneysPlayersId IS NULL
GROUP BY h.handStart, hp.handId, hp.totalProfit
GROUP BY h.handStart, hp.handId, hp.sawShowdown, hp.totalProfit
ORDER BY h.handStart"""
####################################

View File

@ -0,0 +1,55 @@
***** Betfair Poker Hand History for Game 100000000 *****
PL $0.05/$0.10 Omaha - Sunday, October 18, 20:00:00 GMT 2009
Table Death 1 6-max (Real Money)
Seat 2 is the button
Total number of active players : 6
Seat 1: Player6 ( $1 )
Seat 2: Player3 ( $9.38 )
Seat 3: Player2 ( $2.82 )
Seat 4: Player4 ( $4.13 )
Seat 5: Player5 ( $28.77 )
Seat 6: Player1 ( $6.46 )
Player2 posts small blind [$0.05]
Player4 posts big blind [$0.10]
Player6 posts big blind [$0.10]
** Dealing down cards **
Dealt to Player6 [ 7c, 6c, 5h, Jh ]
Player5 folds
Player1 calls [$0.10]
Player6 checks
Player3 calls [$0.10]
Player2 raises to [$0.30]
Player4 calls [$0.20]
Player1 calls [$0.20]
Player6 goes all-in
Player6 raises to [$1]
Player3 calls [$0.90]
Player2 calls [$0.70]
Player4 calls [$0.70]
Player1 calls [$0.70]
** Dealing Flop ** [ 4d, 5d, 6d ]
Player2 checks
Player4 checks
Player1 checks
Player3 checks
** Dealing Turn ** [ 3s ]
Player2 checks
Player4 bets [$0.10]
Player1 calls [$0.10]
Player3 folds
Player2 folds
** Dealing River ** [ 4c ]
Player4 goes all-in
Player4 bets [$3.03]
Player1 calls [$3.03]
** Showdown **
Player6 shows [ 7c, 6c, 5h, Jh ] a straight, Seven to Three
Player4 shows [ 7d, 8c, 3d, 6h ] a straight flush, Seven to Three
Player1 shows [ 3h, 4h, Td, 4s ] four of a kind, Fours
** Hand Conclusion **
Player4 wins $6.26 from side pot #1 with a straight flush, Seven to Three
Player4 wins $4.44 from main pot with a straight flush, Seven to Three
************ Game 100000000 ends ************

View File

@ -1,21 +1,34 @@
# -*- coding: utf-8 -*-
import BetfairToFpdb
from Hand import *
import py
import Configuration
import Database
import SQL
import fpdb_import
def checkGameInfo(hhc, header, info):
assert hhc.determineGameType(header) == info
config = Configuration.Config(file = "HUD_config.test.xml")
db = Database.Database(config)
sql = SQL.Sql(db_server = 'sqlite')
def testGameInfo():
hhc = BetfairToFpdb.Betfair(autostart=False)
pairs = (
(u"""***** Betfair Poker Hand History for Game 472386869 *****
NL $0.02/$0.04 Texas Hold'em - Sunday, January 25, 10:10:42 GMT 2009
Table Rookie 191 6-max (Real Money)
Seat 1 is the button
Total number of active players : 6""",
{'type':'ring', 'base':"hold", 'category':'holdem', 'limitType':'nl', 'sb':'0.02', 'bb':'0.04', 'currency':'USD'}),
)
settings = {}
settings.update(config.get_db_parameters())
settings.update(config.get_tv_parameters())
settings.update(config.get_import_parameters())
settings.update(config.get_default_paths())
for (header, info) in pairs:
yield checkGameInfo, hhc, header, info
def testFlopImport():
db.recreate_tables()
importer = fpdb_import.Importer(False, settings, config)
importer.setDropIndexes("don't drop")
importer.setFailOnError(True)
importer.setThreads(-1)
importer.addBulkImportImportFileOrDir(
"""regression-test-files/cash/Betfair/Flop/PLO-6max-USD-0.05-0.10-200909.All.in.river.splitpot.txt""", site="Betfair")
importer.setCallHud(False)
(stored, dups, partial, errs, ttime) = importer.runImport()
importer.clearFileList()
# Should actually do some testing here
assert 1 == 1