def tw_polyglot(self): titulo = self.dbGames.get_name() + ".bin" resp = PolyglotImports.export_polyglot_config(self, self.configuracion, titulo) if resp is None: return path_bin, uniform = resp resp = PolyglotImports.import_polyglot_config(self, self.configuracion, os.path.basename(path_bin)) if resp is None: return plies, st_side, st_results, ru, min_games, min_score, calc_weight, save_score = resp db = UtilSQL.DictBig() def fsum(keymove, pt): num, pts = db.get(keymove, (0, 0)) num += 1 pts += pt db[keymove] = num, pts dltmp = PolyglotImports.ImportarPGNDB(self, titulo) dltmp.show() ok = PolyglotImports.add_db(self.dbGames, plies, st_results, st_side, ru, time.time, 1.2, dltmp.dispatch, fsum) dltmp.close() if ok: PolyglotImports.create_bin_from_dbbig(self, path_bin, db, min_games, min_score, calc_weight, save_score)
def import_db(self): path_db = QTVarios.select_db(self.wpolyglot, self.configuration, True, False) if not path_db: return titulo = "%s %s" % (_("Import"), os.path.basename(path_db)) resp = self.import_polyglot_config(titulo) if resp is None: return plies, st_side, st_results, ru, min_games, min_score, calc_weight, save_score, collisions = resp db = UtilSQL.DictBig() def fsum(keymove, pt): num, pts = db.get(keymove, (0, 0)) num += 1 pts += pt db[keymove] = num, pts dltmp = ImportarPGNDB(self.wpolyglot, os.path.basename(path_db)) dltmp.show() db_games = DBgames.DBgames(path_db) ok = add_db(db_games, plies, st_results, st_side, ru, time.time, 1.2, dltmp.dispatch, fsum) dltmp.close() if not ok: db.close() db_games.close() return self.merge(db, min_games, min_score, calc_weight, save_score, collisions)
def import_pgn(self): li_path_pgn = QTVarios.select_pgns(self.wpolyglot) if not li_path_pgn: return titulo = "%s %d %s" % (_("Import"), len(li_path_pgn), _("PGN")) resp = self.import_polyglot_config(titulo) if resp is None: return plies, st_side, st_results, ru, min_games, min_score, calc_weight, save_score, collisions = resp db = UtilSQL.DictBig() for path_pgn in li_path_pgn: def fsum(keymove, pt): num, pts = db.get(keymove, (0, 0)) num += 1 pts += pt db[keymove] = num, pts dltmp = ImportarPGNDB(self.wpolyglot, os.path.basename(path_pgn)) dltmp.show() ok = self.add_pgn(path_pgn, plies, st_results, st_side, ru.encode(), time.time, 1.2, dltmp.dispatch, fsum) dltmp.close() if not ok: db.close() return self.merge(db, min_games, min_score, calc_weight, save_score, collisions)
def import_pgn(self): path_pgn = QTVarios.select_pgn(self.wpolyglot) if not path_pgn: return resp = self.import_config(os.path.basename(path_pgn)) if resp is None: return plies, st_side, st_results, ru, min_games, min_score, calc_weight, save_score = resp db = UtilSQL.DictBig() def fsum(keymove, pt): num, pts = db.get(keymove, (0, 0)) num += 1 pts += pt db[keymove] = num, pts dltmp = ImportarPGNDB(self.wpolyglot, os.path.basename(path_pgn)) dltmp.show() ok = add_pgn(path_pgn, plies, st_results, st_side, ru.encode(), time.time, 1.2, dltmp.dispatch, fsum) dltmp.close() if not ok: db.close() return self.merge(db, min_games, min_score, calc_weight, save_score)
def analysis_cached_begin(self): self.cache_analysis = UtilSQL.DictBig()