From a5b9ea860d41bbe0bf81e7a1199962994e2ea241 Mon Sep 17 00:00:00 2001 From: eblade Date: Fri, 13 Mar 2009 06:21:48 -0400 Subject: [PATCH 01/32] fix runUpdated() to not freak out if a file disappears on it --- pyfpdb/fpdb_import.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index b8036e46..506e71ee 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -190,24 +190,26 @@ class Importer: self.addImportDirectory(self.dirlist[site][0], False, site, self.dirlist[site][1]) for file in self.filelist: - stat_info = os.stat(file) - try: - lastupdate = self.updated[file] - if stat_info.st_mtime > lastupdate: - self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) + if os.path.exists(file): + stat_info = os.stat(file) + try: + lastupdate = self.updated[file] + if stat_info.st_mtime > lastupdate: + self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) + self.updated[file] = time() + except: self.updated[file] = time() - except: - self.updated[file] = time() - # If modified in the last minute run an immediate import. - # This codepath only runs first time the file is found. - if os.path.isdir(file) or (time() - stat_info.st_mtime) < 60: - # TODO attach a HHC thread to the file - # TODO import the output of the HHC thread -- this needs to wait for the HHC to block? - self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) + # If modified in the last minute run an immediate import. + # This codepath only runs first time the file is found. + if os.path.isdir(file) or (time() - stat_info.st_mtime) < 60: + # TODO attach a HHC thread to the file + # TODO import the output of the HHC thread -- this needs to wait for the HHC to block? + self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) # TODO we also test if directory, why? #if os.path.isdir(file): #self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) - + else: + removeFromFileList[file] = True self.addToDirList = filter(lambda x: self.addImportDirectory(x, True, self.addToDirList[x][0], self.addToDirList[x][1]), self.addToDirList) for file in self.removeFromFileList: From 69c026bd29b79444ed6e22e91b092b417fb941c2 Mon Sep 17 00:00:00 2001 From: eblade Date: Fri, 13 Mar 2009 18:05:27 -0400 Subject: [PATCH 02/32] remove "import Utils" --- pyfpdb/Hud.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index c9e0ea07..ac9a53a3 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -44,7 +44,6 @@ import Stats import Mucked import Database import HUD_main -import Utils def importName(module_name, name, params): """Import a named object 'name' from module 'module_name'.""" From 79d9bd6d58b066aa1fb8d4601a7a5254910f0499 Mon Sep 17 00:00:00 2001 From: eblade Date: Fri, 13 Mar 2009 18:09:25 -0400 Subject: [PATCH 03/32] make third parameter to importName() optional --- pyfpdb/Hud.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index ac9a53a3..a8591041 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -45,7 +45,7 @@ import Mucked import Database import HUD_main -def importName(module_name, name, params): +def importName(module_name, name, *params): """Import a named object 'name' from module 'module_name'.""" # Recipe 16.3 in the Python Cookbook, 2nd ed. Thanks!!!! # Modded by Carl G to support additional params From e0a406e66d3e7bcc6a689b55bece50e74c25248f Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 14 Mar 2009 12:54:52 -0400 Subject: [PATCH 04/32] Make Configiuration.py executable. --- pyfpdb/Configuration.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 pyfpdb/Configuration.py diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py old mode 100644 new mode 100755 From 40d98b11d9f8313ae68c5286c2ffbd496c628987 Mon Sep 17 00:00:00 2001 From: Worros Date: Sun, 15 Mar 2009 14:32:52 +0900 Subject: [PATCH 05/32] PokerStarsToFpdb - PLO parsing update --- pyfpdb/PokerStarsToFpdb.py | 8 ++++---- pyfpdb/test_PokerStars.py | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py index b7322a1b..8b905005 100755 --- a/pyfpdb/PokerStarsToFpdb.py +++ b/pyfpdb/PokerStarsToFpdb.py @@ -24,9 +24,9 @@ from HandHistoryConverter import * # PokerStars HH Format class PokerStars(HandHistoryConverter): - + # Static regexes - re_GameInfo = re.compile("PokerStars Game #(?P[0-9]+):\s+(HORSE)? \(?(?PHold\'em|Razz|7 Card Stud|Omaha Hi/Lo|Badugi) (?PNo Limit|Limit|Pot Limit),? \(?(?P\$|)?(?P[.0-9]+)/\$?(?P[.0-9]+)\) - (?P.*$)", re.MULTILINE) + re_GameInfo = re.compile("PokerStars Game #(?P[0-9]+):\s+(HORSE)? \(?(?PHold\'em|Razz|7 Card Stud|Omaha|Omaha Hi/Lo|Badugi) (?PNo Limit|Limit|Pot Limit),? \(?(?P\$|)?(?P[.0-9]+)/\$?(?P[.0-9]+)\) - (?P.*$)", re.MULTILINE) re_SplitHands = re.compile('\n\n+') re_HandInfo = re.compile("^Table \'(?P[- a-zA-Z]+)\'(?P.+?$)?", re.MULTILINE) re_Button = re.compile('Seat #(?P