Merge branch 'master' of git://github.com/swolchok/fpdb into scott
Conflicts: pyfpdb/Database.py pyfpdb/decimal_wrapper.py
This commit is contained in:
commit
99a0e04e3e
|
@ -17,7 +17,7 @@
|
|||
|
||||
#TODO: gettextify if file is used again
|
||||
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
|
||||
from sqlalchemy import types
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
|
|
|
@ -23,7 +23,7 @@ This package contains all classes to be mapped and mappers themselves
|
|||
|
||||
import logging
|
||||
import re
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
from sqlalchemy.orm import mapper, relation, reconstructor
|
||||
from sqlalchemy.sql import select
|
||||
from collections import defaultdict
|
||||
|
|
|
@ -53,7 +53,7 @@ _ = L10n.get_translation()
|
|||
import sys
|
||||
import logging
|
||||
from HandHistoryConverter import *
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
|
||||
|
||||
class Carbon(HandHistoryConverter):
|
||||
|
|
|
@ -38,12 +38,7 @@ import sys
|
|||
import traceback
|
||||
from datetime import datetime, date, time, timedelta
|
||||
from time import time, strftime, sleep
|
||||
|
||||
try:
|
||||
from cdecimal import *
|
||||
except ImportError:
|
||||
from decimal import *
|
||||
|
||||
from decimal_wrapper import Decimal
|
||||
import string
|
||||
import re
|
||||
import Queue
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#fpdb modules
|
||||
import Card
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
|
||||
import logging
|
||||
# logging has been set up in fpdb.py or HUD_main.py, use their settings:
|
||||
|
|
|
@ -25,7 +25,7 @@ _ = L10n.get_translation()
|
|||
import sys
|
||||
import logging
|
||||
from HandHistoryConverter import *
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
|
||||
|
||||
class Everest(HandHistoryConverter):
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import L10n
|
||||
_ = L10n.get_translation()
|
||||
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
import datetime
|
||||
|
||||
from Exceptions import FpdbParseError
|
||||
|
|
|
@ -25,7 +25,7 @@ import sys
|
|||
import traceback
|
||||
import os
|
||||
import os.path
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
import operator
|
||||
import time,datetime
|
||||
from copy import deepcopy
|
||||
|
|
|
@ -26,7 +26,7 @@ import os
|
|||
import os.path
|
||||
import xml.dom.minidom
|
||||
import codecs
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
import operator
|
||||
from xml.dom.minidom import Node
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ log = logging.getLogger("parser")
|
|||
|
||||
import Configuration
|
||||
from HandHistoryConverter import *
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
|
||||
# OnGame HH Format
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import L10n
|
||||
_ = L10n.get_translation()
|
||||
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
import datetime
|
||||
|
||||
from Exceptions import FpdbParseError
|
||||
|
|
|
@ -25,7 +25,7 @@ _ = L10n.get_translation()
|
|||
|
||||
import sys
|
||||
from HandHistoryConverter import *
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
|
||||
# PokerStars HH Format
|
||||
|
||||
|
@ -131,34 +131,29 @@ class PokerStars(HandHistoryConverter):
|
|||
# revised re including timezone (not currently used):
|
||||
#re_DateTime = re.compile("""(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})[\- ]+(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+) \(?(?P<TZ>[A-Z0-9]+)""", re.MULTILINE)
|
||||
|
||||
def compilePlayerRegexs(self, hand):
|
||||
players = set([player[1] for player in hand.players])
|
||||
if not players <= self.compiledPlayers: # x <= y means 'x is subset of y'
|
||||
# we need to recompile the player regexs.
|
||||
# TODO: should probably rename re_HeroCards and corresponding method,
|
||||
# since they are used to find all cards on lines starting with "Dealt to:"
|
||||
# They still identify the hero.
|
||||
self.compiledPlayers = players
|
||||
player_re = "(?P<PNAME>" + "|".join(map(re.escape, players)) + ")"
|
||||
subst = {'PLYR': player_re, 'CUR': self.sym[hand.gametype['currency']]}
|
||||
log.debug("player_re: " + player_re)
|
||||
self.re_PostSB = re.compile(r"^%(PLYR)s: posts small blind %(CUR)s(?P<SB>[.0-9]+)" % subst, re.MULTILINE)
|
||||
self.re_PostBB = re.compile(r"^%(PLYR)s: posts big blind %(CUR)s(?P<BB>[.0-9]+)" % subst, re.MULTILINE)
|
||||
self.re_Antes = re.compile(r"^%(PLYR)s: posts the ante %(CUR)s(?P<ANTE>[.0-9]+)" % subst, re.MULTILINE)
|
||||
self.re_BringIn = re.compile(r"^%(PLYR)s: brings[- ]in( low|) for %(CUR)s(?P<BRINGIN>[.0-9]+)" % subst, re.MULTILINE)
|
||||
self.re_PostBoth = re.compile(r"^%(PLYR)s: posts small \& big blinds %(CUR)s(?P<SBBB>[.0-9]+)" % subst, re.MULTILINE)
|
||||
self.re_HeroCards = re.compile(r"^Dealt to %(PLYR)s(?: \[(?P<OLDCARDS>.+?)\])?( \[(?P<NEWCARDS>.+?)\])" % subst, re.MULTILINE)
|
||||
self.re_Action = re.compile(r"""
|
||||
# These used to be compiled per player, but regression tests say
|
||||
# we don't have to, and it makes life faster.
|
||||
short_subst = {'PLYR': r'(?P<PNAME>.+?)', 'CUR': '\$?'}
|
||||
re_PostSB = re.compile(r"^%(PLYR)s: posts small blind %(CUR)s(?P<SB>[.0-9]+)" % short_subst, re.MULTILINE)
|
||||
re_PostBB = re.compile(r"^%(PLYR)s: posts big blind %(CUR)s(?P<BB>[.0-9]+)" % short_subst, re.MULTILINE)
|
||||
re_Antes = re.compile(r"^%(PLYR)s: posts the ante %(CUR)s(?P<ANTE>[.0-9]+)" % short_subst, re.MULTILINE)
|
||||
re_BringIn = re.compile(r"^%(PLYR)s: brings[- ]in( low|) for %(CUR)s(?P<BRINGIN>[.0-9]+)" % short_subst, re.MULTILINE)
|
||||
re_PostBoth = re.compile(r"^%(PLYR)s: posts small \& big blinds %(CUR)s(?P<SBBB>[.0-9]+)" % short_subst, re.MULTILINE)
|
||||
re_HeroCards = re.compile(r"^Dealt to %(PLYR)s(?: \[(?P<OLDCARDS>.+?)\])?( \[(?P<NEWCARDS>.+?)\])" % short_subst, re.MULTILINE)
|
||||
re_Action = re.compile(r"""
|
||||
^%(PLYR)s:(?P<ATYPE>\sbets|\schecks|\sraises|\scalls|\sfolds|\sdiscards|\sstands\spat)
|
||||
(\s(%(CUR)s)?(?P<BET>[.\d]+))?(\sto\s%(CUR)s(?P<BETTO>[.\d]+))? # the number discarded goes in <BET>
|
||||
\s*(and\sis\sall.in)?
|
||||
(and\shas\sreached\sthe\s[%(CUR)s\d\.]+\scap)?
|
||||
(\scards?(\s\[(?P<DISCARDED>.+?)\])?)?\s*$"""
|
||||
% subst, re.MULTILINE|re.VERBOSE)
|
||||
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]+): %(PLYR)s (\(button\) |\(small blind\) |\(big blind\) |\(button\) \(small blind\) |\(button\) \(big blind\) )?(collected|showed \[.*\] and won) \(%(CUR)s(?P<POT>[.\d]+)\)(, mucked| with.*|)" % subst, re.MULTILINE)
|
||||
self.re_sitsOut = re.compile("^%s sits out" % player_re, re.MULTILINE)
|
||||
self.re_ShownCards = re.compile("^Seat (?P<SEAT>[0-9]+): %s (\(.*\) )?(?P<SHOWED>showed|mucked) \[(?P<CARDS>.*)\].*" % player_re, re.MULTILINE)
|
||||
% short_subst, re.MULTILINE|re.VERBOSE)
|
||||
re_ShowdownAction = re.compile(r"^%s: shows \[(?P<CARDS>.*)\]" % short_subst['PLYR'], re.MULTILINE)
|
||||
re_sitsOut = re.compile("^%s sits out" % short_subst['PLYR'], re.MULTILINE)
|
||||
re_ShownCards = re.compile("^Seat (?P<SEAT>[0-9]+): %s (\(.*\) )?(?P<SHOWED>showed|mucked) \[(?P<CARDS>.*)\].*" % short_subst['PLYR'], re.MULTILINE)
|
||||
re_CollectPot = re.compile(r"Seat (?P<SEAT>[0-9]+): %(PLYR)s (\(button\) |\(small blind\) |\(big blind\) |\(button\) \(small blind\) |\(button\) \(big blind\) )?(collected|showed \[.*\] and won) \(%(CUR)s(?P<POT>[.\d]+)\)(, mucked| with.*|)" % short_subst, re.MULTILINE)
|
||||
|
||||
def compilePlayerRegexs(self, hand):
|
||||
pass
|
||||
|
||||
def readSupportedGames(self):
|
||||
return [["ring", "hold", "nl"],
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import L10n
|
||||
_ = L10n.get_translation()
|
||||
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
import datetime
|
||||
|
||||
from Exceptions import FpdbParseError
|
||||
|
|
|
@ -28,7 +28,7 @@ import traceback
|
|||
import logging
|
||||
import os
|
||||
import os.path
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
import operator
|
||||
import time,datetime
|
||||
from copy import deepcopy
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
import L10n
|
||||
_ = L10n.get_translation()
|
||||
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
import datetime
|
||||
from BeautifulSoup import BeautifulSoup
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import logging
|
|||
|
||||
import Configuration
|
||||
from HandHistoryConverter import *
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
import time
|
||||
|
||||
# Winamax HH Format
|
||||
|
|
4
pyfpdb/decimal_wrapper.py
Normal file
4
pyfpdb/decimal_wrapper.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
try:
|
||||
from cdecimal import *
|
||||
except ImportError:
|
||||
from decimal import *
|
|
@ -46,7 +46,7 @@ _ = L10n.get_translation()
|
|||
import sys
|
||||
import logging
|
||||
from HandHistoryConverter import *
|
||||
from decimal import Decimal
|
||||
from decimal_wrapper import Decimal
|
||||
|
||||
|
||||
class iPoker(HandHistoryConverter):
|
||||
|
|
Loading…
Reference in New Issue
Block a user