pychess.Savers package

Submodules

pychess.Savers.ChessFile module

exception pychess.Savers.ChessFile.LoadingError

Bases: Exception

class pychess.Savers.ChessFile.ChessFile(file)

Bases: object

This class describes an opened chessfile. It is lazy in the sense of not parsing any games, that the user don’t request. It has no catching.

close()
get_book_moves(fen=None)
get_date(gameno)

Returns a tuple (year,month,day) of the game date Default is current time if nothing is specified in the file

get_elo(gameno)

Returns a tuple of the players rating in ELO format Default is 1600 if nothing is specified in the file

get_event(gameno)

Returns the event at which the game took place Could be “World Chess Cup” or “My local tournament” Default is “?” if nothing is specified in the file

get_id(gameno)
get_info(gameno)
get_player_names(gameno)

Returns a tuple of the players names Default is (“Unknown”, “Unknown”) if nothing is specified

get_records(direction=0)
get_result(gameno)

Returns the result of the game Can be any of: RUNNING, DRAW, WHITEWON or BLACKWON Default is RUNNING if nothing is specified in the file

get_round(gameno)

Returns the round of the event at which the game took place Pgn supports having subrounds like 2.1.5, but as of writing, only the first int is returned. Default is 1 if nothing is specified in the file

get_site(gameno)

Returns the location at which the game took place Default is “?” if nothing is specified in the file

get_variant(gameno)
loadToModel(gameno, position, model=None)

Load the data of game “gameno” into the gamemodel If no model is specified, a new one will be created, loaded and returned

set_fen_filter(fen)
set_scout_filter(query)
set_tags_filter(text)

pychess.Savers.chessalpha2 module

pychess.Savers.chesspastebin module

pychess.Savers.database module

class pychess.Savers.database.TagDatabase(engine)

Bases: object

build_order_by(order_col, is_desc)
build_query()
build_where_offs(offset_list)
build_where_offs8(offset_list)
build_where_tags(tag_query)
close()
get_count()
get_exta_tags(rec)
get_info(rec)
get_offsets_for_tags(last_seen)
get_records(last_seen, limit)
count
pychess.Savers.database.parseDateTag(tag)
pychess.Savers.database.save(path, model, offset, flip=False)

pychess.Savers.epd module

class pychess.Savers.epd.EpdFile(handle)

Bases: pychess.Savers.ChessFile.ChessFile

create_rec(line)
get_player_names(rec)

Returns a tuple of the players names Default is (“Unknown”, “Unknown”) if nothing is specified

loadToModel(rec, position, model=None)

Load the data of game “gameno” into the gamemodel If no model is specified, a new one will be created, loaded and returned

pychess.Savers.epd.load(handle)
pychess.Savers.epd.save(handle, model, position=None, flip=False)

Saves game to file in fen format

pychess.Savers.fen module

class pychess.Savers.fen.FenFile(handle)

Bases: pychess.Savers.ChessFile.ChessFile

loadToModel(rec, position, model=None)

Load the data of game “gameno” into the gamemodel If no model is specified, a new one will be created, loaded and returned

pychess.Savers.fen.load(handle)
pychess.Savers.fen.save(handle, model, position=None, flip=False)

Saves game to file in fen format

pychess.Savers.pgn module

pychess.Savers.png module

Module contents