def processHand(self, handText): if self.isPartial(handText): raise FpdbHandPartial( _("Could not identify as a %s hand") % self.sitename) if self.copyGameHeader: gametype = self.parseHeader( handText, self.whole_file.replace('\r\n', '\n').replace(u'\xa0', u' ')) else: gametype = self.determineGameType(handText) hand = None l = None if gametype is None: gametype = "unmatched" # TODO: not ideal, just trying to not error. Throw ParseException? self.numErrors += 1 else: if gametype['category'] in self.import_parameters['importFilters']: raise FpdbHandSkipped("Skipped %s hand" % gametype['type']) # See if gametype is supported. if 'mix' not in gametype: gametype['mix'] = 'none' if 'ante' not in gametype: gametype['ante'] = 0 if 'buyinType' not in gametype: gametype['buyinType'] = 'regular' if 'fast' not in gametype: gametype['fast'] = False if 'newToGame' not in gametype: gametype['newToGame'] = False if 'homeGame' not in gametype: gametype['homeGame'] = False if 'split' not in gametype: gametype['split'] = False type = gametype['type'] base = gametype['base'] limit = gametype['limitType'] l = [type] + [base] + [limit] if l in self.readSupportedGames(): if gametype['base'] == 'hold': hand = Hand.HoldemOmahaHand(self.config, self, self.sitename, gametype, handText) elif gametype['base'] == 'stud': hand = Hand.StudHand(self.config, self, self.sitename, gametype, handText) elif gametype['base'] == 'draw': hand = Hand.DrawHand(self.config, self, self.sitename, gametype, handText) else: log.error( _("%s Unsupported game type: %s") % (self.sitename, gametype)) raise FpdbParseError if hand: #hand.writeHand(self.out_fh) return hand else: log.error( _("%s Unsupported game type: %s") % (self.sitename, gametype))
def processHand(self, handText, showKnown, fastFold, separateTablesByMaxSeats): if not self.isPartial(handText): gametype = self.determineGameType(handText) hand = None l = None if gametype is None: gametype = "unmatched" else: if 'mix' not in gametype: gametype['mix'] = 'none' if 'ante' not in gametype: gametype['ante'] = 0 if 'buyinType' not in gametype: gametype['buyinType'] = 'regular' if 'fast' not in gametype: gametype['fast'] = False if 'newToGame' not in gametype: gametype['newToGame'] = False if 'homeGame' not in gametype: gametype['homeGame'] = False type = gametype['type'] base = gametype['base'] limit = gametype['limitType'] l = [type] + [base] + [limit] if l in self.readSupportedGames(): if gametype['base'] == 'hold': if gametype['fast'] == True: hand = Hand.HoldemOmahaHand(None, self, self.sitename, gametype, handText, showKnown, fastFold, separateTablesByMaxSeats) else: hand = Hand.HoldemOmahaHand(None, self, self.sitename, gametype, handText, showKnown, False, separateTablesByMaxSeats) elif gametype['base'] == 'stud': hand = Hand.StudHand(None, self, self.sitename, gametype, handText) elif gametype['base'] == 'draw': hand = Hand.DrawHand(None, self, self.sitename, gametype, handText) else: print(("%s Unsupported game type: %s") % (self.sitename, gametype)) #raise FpdbParseError return if hand: return hand else: print(("%s Unsupported game type: %s") % (self.sitename, gametype))
def processHand(self, handText): if self.copyGameHeader: gametype = self.determineGameType(self.whole_file) if 'mix' in gametype: gametype = self.determineGameType(handText) else: gametype = self.determineGameType(handText) hand = None l = None if gametype is None: gametype = "unmatched" # TODO: not ideal, just trying to not error. Throw ParseException? self.numErrors += 1 else: # See if gametype is supported. if 'mix' not in gametype: gametype['mix'] = 'none' if 'ante' not in gametype: gametype['ante'] = 0 type = gametype['type'] base = gametype['base'] limit = gametype['limitType'] l = [type] + [base] + [limit] if l in self.readSupportedGames(): if gametype['base'] == 'hold': hand = Hand.HoldemOmahaHand(self.config, self, self.sitename, gametype, handText) elif gametype['base'] == 'stud': hand = Hand.StudHand(self.config, self, self.sitename, gametype, handText) elif gametype['base'] == 'draw': hand = Hand.DrawHand(self.config, self, self.sitename, gametype, handText) else: log.error( _("%s Unsupported game type: %s") % (self.sitename, gametype)) raise FpdbParseError if hand: #hand.writeHand(self.out_fh) return hand else: log.error( _("%s Unsupported game type: %s") % (self.sitename, gametype))