more string cleaning

This commit is contained in:
Steffen Schaumburg 2011-04-08 13:39:56 +02:00
parent e5cdf881a7
commit 398a2609ef
24 changed files with 51 additions and 51 deletions

View File

@ -321,7 +321,7 @@ class Absolute(HandHistoryConverter):
hand.involved = False
def readStudPlayerCards(self, hand, street):
logging.warning(_("Absolute cannot read all stud/razz hands yet."))
logging.warning(_("%s cannot read all stud/razz hands yet.") % hand.sitename)
def readAction(self, hand, street):
logging.debug("readAction (%s)" % street)
@ -345,7 +345,7 @@ class Absolute(HandHistoryConverter):
bet = action.group('BET').replace(',', '')
hand.addComplete( street, action.group('PNAME'), bet)
else:
logging.debug(_("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
logging.debug(_("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
def readShowdownActions(self, hand):

View File

@ -196,7 +196,7 @@ class Betfair(HandHistoryConverter):
elif action.group('ATYPE') == 'checks':
hand.addCheck( street, action.group('PNAME'))
else:
sys.stderr.write(_("DEBUG: ") + _("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
sys.stderr.write(_("DEBUG:") + " " + _("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
def readShowdownActions(self, hand):

View File

@ -264,7 +264,7 @@ or None if we fail to get the info """
elif action.group('ATYPE') == 'ALL_IN':
hand.addAllIn(street, player, action.group('BET'))
else:
logging.debug(_("Unimplemented readAction: '%s' '%s'") % (action.group('PSEAT'), action.group('ATYPE')))
logging.debug(_("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PSEAT'), action.group('ATYPE')))
def readShowdownActions(self, hand):
for shows in self.re_ShowdownAction.finditer(hand.handText):

View File

@ -40,10 +40,10 @@ def to_utf8(s):
_out = unicode(s, Configuration.LOCALE_ENCODING).encode('utf-8')
return _out
except UnicodeDecodeError:
sys.stderr.write(_('Could not convert: "%s"\n') % s)
sys.stderr.write(_('Could not convert: "%s"') % (s+"\n"))
raise
except UnicodeEncodeError:
sys.stderr.write(_('Could not encode: "%s"\n') % s)
sys.stderr.write(_('Could not encode: "%s"') % (s+"\n"))
raise
except TypeError: # TypeError is raised when we give unicode() an already encoded string
return s
@ -55,10 +55,10 @@ def to_db_utf8(s):
(_out, _len) = encoder_to_utf.encode(unicode(s))
return _out
except UnicodeDecodeError:
sys.stderr.write(_('Could not convert: "%s"\n') % s)
sys.stderr.write(_('Could not convert: "%s"') % (s+"\n"))
raise
except UnicodeEncodeError:
sys.stderr.write(_('Could not encode: "%s"\n') % s)
sys.stderr.write(_('Could not encode: "%s"') % (s+"\n"))
raise
def to_gui(s):
@ -70,8 +70,8 @@ def to_gui(s):
(_out, _len) = encoder_to_sys.encode(s, 'replace')
return _out
except UnicodeDecodeError:
sys.stderr.write(_('Could not convert: "%s"\n') % s)
sys.stderr.write(_('Could not convert: "%s"') % (s+"\n"))
raise
except UnicodeEncodeError:
sys.stderr.write(_('Could not encode: "%s"\n') % s)
sys.stderr.write(_('Could not encode: "%s"') % (s+"\n"))
raise

View File

@ -108,14 +108,14 @@ def get_config(file_name, fallback = True):
try:
shutil.copyfile(example_path, config_path)
example_copy = True
msg = _("Config file has been created at %s.\n") % config_path
msg = _("Config file has been created at %s.") % (config_path+"\n")
logging.info(msg)
except IOError:
try:
example_path = file_name + '.example'
shutil.copyfile(example_path, config_path)
example_copy = True
msg = _("Config file has been created at %s.\n") % config_path
msg = _("Config file has been created at %s.") % (config_path+"\n")
logging.info(msg)
except IOError:
pass
@ -130,7 +130,7 @@ def get_config(file_name, fallback = True):
shutil.copyfile(example_path, config_path)
example_copy = True
msg = _("No %s found\n in %s\n or %s\n") % (file_name, exec_dir, default_dir) \
+ _("Config file has been created at %s.\n") % config_path
+ _("Config file has been created at %s.") % (config_path+"\n")
print msg
logging.info(msg)
except:

View File

@ -2976,7 +2976,7 @@ if __name__=="__main__":
hero = db_connection.get_player_id(c, 'PokerStars', 'nutOmatic')
if hero:
print _("nutOmatic is id_player = %d") % hero
print "nutOmatic player_id", hero
# example of displaying query plan in sqlite:
if db_connection.backend == 4:

View File

@ -231,8 +231,8 @@ class Everest(HandHistoryConverter):
elif action.group('ATYPE') in ('FOLD', 'SIT_OUT'):
hand.addFold(street, player)
else:
print (_("Unimplemented readAction: '%s' '%s'") % (action.group('PSEAT'), action.group('ATYPE')))
logging.debug(_("Unimplemented readAction: '%s' '%s'") % (action.group('PSEAT'), action.group('ATYPE')))
print (_("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PSEAT'), action.group('ATYPE')))
logging.debug(_("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PSEAT'), action.group('ATYPE')))
def readShowdownActions(self, hand):
for shows in self.re_ShowdownAction.finditer(hand.handText):

View File

@ -271,7 +271,7 @@ or None if we fail to get the info """
def readStudPlayerCards(self, hand, street):
logging.warning(_("Everleaf cannot read all stud/razz hands yet."))
logging.warning(_("%s cannot read all stud/razz hands yet.") % hand.sitename)
def readAction(self, hand, street):
@ -292,7 +292,7 @@ or None if we fail to get the info """
elif action.group('ATYPE') == ' complete to':
hand.addComplete( street, action.group('PNAME'), action.group('BET'))
else:
logging.debug(_("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
logging.debug(_("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
def readShowdownActions(self, hand):
@ -301,7 +301,7 @@ or None if we fail to get the info """
for shows in self.re_ShowdownAction.finditer(hand.handText):
cards = shows.group('CARDS')
cards = cards.split(', ')
logging.debug(_("readShowdownActions %s %s") % (cards, shows.group('PNAME')))
logging.debug("readShowdownActions %s %s" % (cards, shows.group('PNAME')))
hand.addShownCards(cards, shows.group('PNAME'))

View File

@ -77,7 +77,7 @@ class Filters(threading.Thread):
self.mainVBox = gtk.VBox(False, 0)
self.sw.add_with_viewport(self.mainVBox)
self.sw.show()
print(_("DEBUG: ") + _("New packing box created!"))
#print(_("DEBUG:") + _("New packing box created!"))
self.found = {'nl':False, 'fl':False, 'pl':False, 'cn':False, 'ring':False, 'tour':False}
self.label = {}

View File

@ -440,7 +440,7 @@ class Fulltilt(HandHistoryConverter):
hand.buttonpos = int(self.re_Button.search(hand.handText).group('BUTTON'))
except AttributeError, e:
# FTP has no indication that a hand is cancelled.
raise FpdbParseError(_("readButton: Failed to detect button (hand #%s cancelled?)") % hand.handid)
raise FpdbParseError(_("%s Failed to detect button (hand #%s cancelled?)") % ("readButton:", hand.handid))
def readHeroCards(self, hand):
# streets PREFLOP, PREDRAW, and THIRD are special cases beacause
@ -498,7 +498,7 @@ class Fulltilt(HandHistoryConverter):
elif action.group('ATYPE') == ' stands pat':
hand.addStandsPat( street, action.group('PNAME'), action.group('CARDS'))
else:
print (_("DEBUG: ") + " " + _("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
print (_("DEBUG:") + " " + _("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
def readShowdownActions(self, hand):

View File

@ -200,7 +200,7 @@ class GuiAutoImport (threading.Thread):
for site in the_sites:
params = self.config.get_site_parameters(site)
if params['enabled'] == True:
print (_("DEBUG: ") + _("Detecting hh directory for site: '%s'") % site)
print (_("DEBUG:") + " " + _("Detecting hand history directory for site: '%s'") % site)
if os.name == 'posix':
if self.posix_detect_hh_dirs(site):
#data[1].set_text(dia_chooser.get_filename())
@ -240,7 +240,7 @@ class GuiAutoImport (threading.Thread):
# - Ideally we want to release the lock if the auto-import is killed by some
# kind of exception - is this possible?
if self.settings['global_lock'].acquire(wait=False, source="AutoImport"): # returns false immediately if lock not acquired
self.addText(_("\nGlobal lock taken ... Auto Import Started.\n"))
self.addText("\n" + _("Global lock taken ... Auto Import Started.")+"\n")
self.doAutoImportBool = True
self.startButton.set_label(_(u'Stop _Auto Import'))
while gtk.events_pending(): # change the label NOW don't wait for the pipe to open

View File

@ -134,7 +134,7 @@ class GuiPositionalStats (threading.Thread):
def toggleCallback(self, widget, data=None):
# print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
self.activesite = data
print (_("DEBUG: ") + _("activesite set to %s") % (self.activesite))
print (_("DEBUG:") + " " + _("activesite set to %s") % (self.activesite))
def refreshStats(self, widget, data):
try: self.stats_vbox.destroy()

View File

@ -218,25 +218,25 @@ Against the range: {
self.outputlabel.set_text(string)
def set_board_flop(self, caller, widget):
print (_("DEBUG: ") + _("called set_board_flop: '%s' '%s'") % (caller ,widget))
print (_("DEBUG:") + " " + _("called") + " set_board_flop: '%s' '%s'" % (caller ,widget))
self.boardtext = widget.get_text()
def set_hero_cards_flop(self, caller, widget):
print (_("DEBUG: ") + _("called set_hero_cards_flop"))
print (_("DEBUG:") + " " + _("called") + " set_hero_cards_flop")
self.herorange = widget.get_text()
def set_villain_cards_flop(self, caller, widget):
print (_("DEBUG: ") + _("called set_villain_cards_flop"))
print (_("DEBUG:") + " " + _("called") + " set_villain_cards_flop")
self.villainrange = widget.get_text()
def update_flop_output_pane(self, caller, widget):
print (_("DEBUG: ") + _("called update_flop_output_pane"))
print (_("DEBUG:") + " " + _("called") + " update_flop_output_pane")
self.stove.set_board_string(self.boardtext)
self.stove.set_hero_cards_string(self.herorange)
self.stove.set_villain_range_string(self.villainrange)
print (_("DEBUG:") + ("odds_for_range"))
self.ev = Stove.odds_for_range(self.stove)
print (_("DEBUG: ") + ("set_output_label"))
print (_("DEBUG:") + " " + ("set_output_label"))
self.set_output_label(self.ev.output)

View File

@ -488,8 +488,8 @@ If a player has None chips he won't be added."""
def checkPlayerExists(self,player):
if player not in [p[1] for p in self.players]:
print (_("DEBUG: ") + _("checkPlayerExists: %s fail on hand number %s") % (player, self.handid))
raise FpdbParseError(_("checkPlayerExists: %s fail on hand number %s") % (player, self.handid))
print (_("DEBUG:") + " checkPlayerExists: " + _("%s fail on hand number %s") % (player, self.handid))
raise FpdbParseError("checkPlayerExists: " + _("%s fail on hand number %s") % (player, self.handid))
def setCommunityCards(self, street, cards):
log.debug("setCommunityCards %s %s" %(street, cards))
@ -1706,7 +1706,7 @@ class Pot(object):
if self.sym is None:
self.sym = "C"
if self.total is None:
print (_("DEBUG: ") + _("call Pot.end() before printing pot total"))
print (_("DEBUG:") + " " + _("call Pot.end() before printing pot total"))
# NB if I'm sure end() is idempotent, call it here.
raise FpdbParseError(_("Error in printing Hand object"))

View File

@ -41,7 +41,7 @@ def splitPokerStarsSummaries(summaryText): #TODO: this needs to go to PSS.py
splitSummaries = re.split(re_SplitTourneys, summaryText)
if len(splitSummaries) <= 1:
print (_("DEBUG: ") + _("re_SplitTourneys isn't matching"))
print (_("DEBUG:") + " " + _("re_SplitTourneys isn't matching"))
return splitSummaries
@ -50,7 +50,7 @@ def splitFullTiltSummaries(summaryText):#TODO: this needs to go to FTPS.py
splitSummaries = re.split(re_SplitTourneys, summaryText)
if len(splitSummaries) <= 1:
print(_("DEBUG: ") + _("re_SplitTourneys isn't matching"))
print(_("DEBUG:") + " " + _("re_SplitTourneys isn't matching"))
return splitSummaries

View File

@ -213,8 +213,8 @@ class OnGame(HandHistoryConverter):
tzoffset = a.group('OFFSET')
else:
datetimestr = "2010/Jan/01 01:01:01"
log.error(_("readHandInfo: DATETIME not matched: '%s'") % info[key])
print (_("DEBUG: ") + _("readHandInfo: DATETIME not matched: '%s'") % info[key])
log.error("readHandInfo: " + _("DATETIME not matched: '%s'") % info[key])
print (_("DEBUG:") + " readHandInfo: " + _("DATETIME not matched: '%s'") % info[key])
# TODO: Manually adjust time against OFFSET
hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%b/%d %H:%M:%S") # also timezone at end, e.g. " ET"
hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, tzoffset, "UTC")
@ -345,7 +345,7 @@ class OnGame(HandHistoryConverter):
elif action.group('ATYPE') == ' stands pat':
hand.addStandsPat( street, action.group('PNAME'))
else:
print (_("DEBUG: ") + _("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
print (_("DEBUG:") + " " + _("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
def readShowdownActions(self, hand):
for shows in self.re_ShowdownAction.finditer(hand.handText):

View File

@ -426,7 +426,7 @@ class PacificPoker(HandHistoryConverter):
elif action.group('ATYPE') == ' stands pat':
hand.addStandsPat( street, action.group('PNAME'))
else:
print (_("DEBUG: ") + _("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
print (_("DEBUG:") + " " + _("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
def readShowdownActions(self, hand):

View File

@ -532,7 +532,7 @@ class PartyPoker(HandHistoryConverter):
elif actionType == 'checks':
hand.addCheck( street, playerName )
else:
raise FpdbParseError(_("Unimplemented readAction: '%s' '%s'") % (playerName,actionType), hid = hand.hid)
raise FpdbParseError(_("Unimplemented %s: '%s' '%s'") % ("readAction", playerName,actionType), hid = hand.hid)
def readShowdownActions(self, hand):
# all action in readShownCards

View File

@ -348,7 +348,7 @@ class Pkr(HandHistoryConverter):
elif action.group('ATYPE') == ' stands pat':
hand.addStandsPat( street, action.group('PNAME'))
else:
print (_("DEBUG: ") + _("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
print (_("DEBUG:") + _("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
def readShowdownActions(self, hand):

View File

@ -437,7 +437,7 @@ class PokerStars(HandHistoryConverter):
elif action.group('ATYPE') == ' stands pat':
hand.addStandsPat( street, action.group('PNAME'), action.group('CARDS'))
else:
print (_("DEBUG: ") + _("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
print (_("DEBUG:") + " " + _("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
def readShowdownActions(self, hand):

View File

@ -345,7 +345,7 @@ class Win2day(HandHistoryConverter):
elif action.group('ATYPE') == 'ACTION_STAND':
hand.addStandsPat( street, action.group('PNAME'))
else:
print (_("DEBUG: ") + _("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
print (_("DEBUG:") + _("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
def readShowdownActions(self, hand):

View File

@ -403,7 +403,7 @@ class Winamax(HandHistoryConverter):
elif action.group('ATYPE') == ' stands pat':
hand.addStandsPat( street, action.group('PNAME'))
else:
log.fatal(_("DEBUG: ") + _("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
log.fatal(_("DEBUG:") + _("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
# print "Processed %s"%acts
# print "committed=",hand.pot.committed

View File

@ -258,7 +258,7 @@ or None if we fail to get the info """
#print "DEBUG: addBringIn(%s, %s)" %(action.group('PNAME'), action.group('BET'))
hand.addBringIn(action.group('PNAME'), action.group('BET'))
else:
logging.error(_("DEBUG: ") + _("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
logging.error(_("DEBUG:") + " " + _("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
def readShowdownActions(self, hand):
for shows in self.re_ShowdownAction.finditer(hand.handText):

View File

@ -47,8 +47,8 @@ def testSQLiteVarianceFunction():
cur.execute("SELECT variance(i) from test")
result = cur.fetchone()[0]
print (_("DEBUG: ") + _("Testing variance function"))
print (_("DEBUG: ") + _("result: %s expecting: 0.666666 (result-expecting ~= 0.0): %s") % (result, (result - 0.66666)))
print (_("DEBUG:") + " " + _("Testing variance function"))
print (_("DEBUG:") + " " + _("result: %s expecting: 0.666666 (result-expecting ~= 0.0): %s") % (result, (result - 0.66666)))
cur.execute("DROP TABLE test")
assert (result - 0.66666) <= 0.0001