2 new revisions:
Revision: 294bd8819794
Branch: default
Author: gbtami
Date: Fri Jan 2 19:56:45 2015 UTC
Log: Fixed unit tests
https://code.google.com/p/pychess/source/detail?r=294bd8819794
Revision: ca7f809c994c
Branch: default
Author: gbtami
Date: Fri Jan 2 21:19:27 2015 UTC
Log: Python3 compatible pgn2ecodb
https://code.google.com/p/pychess/source/detail?r=ca7f809c994c
==============================================================================
Revision: 294bd8819794
Branch: default
Author: gbtami
Date: Fri Jan 2 19:56:45 2015 UTC
Log: Fixed unit tests
https://code.google.com/p/pychess/source/detail?r=294bd8819794
Modified:
/lib/pychess/ic/managers/BoardManager.py
=======================================
--- /lib/pychess/ic/managers/BoardManager.py Wed Dec 31 10:05:22 2014 UTC
+++ /lib/pychess/ic/managers/BoardManager.py Fri Jan 2 19:56:45 2015 UTC
@@ -33,7 +33,7 @@
moveListHeader2 = re.compile(moveListHeader2Str, re.IGNORECASE)
sanmove = "([a-hx@OoPKQRBN0-8+#=-]{2,7})"
movetime = "\((\d+):(\d\d)(?:\.(\d\d\d))?\)"
-moveListMoves = re.compile("(\d+)\. +(?:%s|\.\.\.) +%s *(?:%s +%s)?" % \
+moveListMoves = re.compile("\s*(\d+)\. +(?:%s|\.\.\.) +%s *(?:%s +%s)?" % \
(sanmove, movetime, sanmove, movetime))
creating0 = re.compile("Creating: %s %s %s %s %s ([^ ]+) (\d+) (\d+)(?:
\(adjourned\))?"
@@ -692,7 +692,7 @@
moves = sorted(moves.items())
for ply, move in moves:
if ply % 2 == 0:
- pgn += "%d. " % (ply/2+1)
+ pgn += "%d. " % (ply//2+1)
time = times[ply]
pgn += "%s {[%%emt %s]} " % (move, time)
pgn += "*\n"
==============================================================================
Revision: ca7f809c994c
Branch: default
Author: gbtami
Date: Fri Jan 2 21:19:27 2015 UTC
Log: Python3 compatible pgn2ecodb
https://code.google.com/p/pychess/source/detail?r=ca7f809c994c
Modified:
/pgn2ecodb.py
=======================================
--- /pgn2ecodb.py Tue Dec 30 12:55:47 2014 UTC
+++ /pgn2ecodb.py Fri Jan 2 21:19:27 2015 UTC
@@ -8,10 +8,13 @@
import sqlite3
import struct
+from pychess.compat import memoryview, unicode
from pychess.Savers.pgn import load
+from pychess.System.protoopen import protoopen
from pychess.System.prefix import addDataPrefix
from pychess.Utils.eco import hash_struct
+
path = os.path.join(addDataPrefix("eco.db"))
conn = sqlite3.connect(path)
@@ -24,7 +27,7 @@
c.execute("create table openings(hash blob, base integer, eco text,
lang text, opening text, variation text)")
def feed(pgnfile, lang):
- cf = load(open(pgnfile))
+ cf = load(protoopen(pgnfile))
rows = []
old_eco = ""
ply_max = 0
@@ -52,10 +55,10 @@
if res is not None:
hash = res[0]
else:
- hash =
buffer(hash_struct.pack(model.boards[-1].board.hash))
+ hash =
memoryview(hash_struct.pack(model.boards[-1].board.hash))
if opening:
- rows.append((hash, base, eco, lang, opening, variation))
+ rows.append((hash, base, unicode(eco), unicode(lang),
unicode(opening), unicode(variation)))
old_eco = eco