pychess.ic package

Subpackages

Submodules

pychess.ic.FICSConnection module

exception pychess.ic.FICSConnection.LogOnException

Bases: Exception

class pychess.ic.FICSConnection.Connection(host, ports, timeseal, username, password)

Bases: GObject

cancel()
close()
expect(prediction)
expect_cn_line(number, callback)
expect_dg_line(number, callback)
expect_fromABplus(callback, regexp0, regexp1, regexp2)
expect_fromplus(callback, regexp0, regexp1)
expect_fromto(callback, regexp0, regexp1)
expect_line(callback, regexp)
expect_n_lines(callback, *regexps)
getUsername()
isConnected()
isConnecting()
isRegistred()
unexpect(callback)
property ics_name
class pychess.ic.FICSConnection.FICSConnection(host, ports, timeseal, username='guest', password='')

Bases: Connection

cancel()
close()
async start()
class pychess.ic.FICSConnection.FICSHelperConnection(main_conn, host, ports, timeseal, username='guest', password='')

Bases: FICSConnection

class pychess.ic.FICSConnection.FICSMainConnection(host, ports, timeseal, username='guest', password='')

Bases: FICSConnection

close()
start_helper_manager(set_user_vars)

pychess.ic.FICSObjects module

exception pychess.ic.FICSObjects.AlreadyExistException

Bases: Exception

class pychess.ic.FICSObjects.FICSAdjournedGame(wplayer, bplayer, our_color=None, length=None, time=None, rated=False, game_type=None, private=False, minutes=None, inc=None, result=7, reason=None, board=None, relation=None, gameno=None)

Bases: FICSGame

property display_time
property opponent
class pychess.ic.FICSObjects.FICSBoard(wms, bms, fen=None, pgn=None)

Bases: object

class pychess.ic.FICSObjects.FICSChallenge(index, player, minutes, inc, rated, color, game_type, adjourned=False)

Bases: FICSSoughtMatch

class pychess.ic.FICSObjects.FICSChallenges(connection)

Bases: GObject

clear()
onChallengeIssued(om, challenge)
onChallengeRemoved(om, index)
onPlayingGame(bm, game)
start()
class pychess.ic.FICSObjects.FICSGame(wplayer, bplayer, gameno=None, game_type=None, rated=False, minutes=None, inc=None, result=None, reason=None, board=None, private=False, relation=None)

Bases: FICSMatch

get_private()
set_private(private)
update(game)
property display_text
private = <GObjectMock name='mock.property()' id='139819325834304'>
property supported
class pychess.ic.FICSObjects.FICSGames(connection)

Bases: GObject

game_ended(game)
get(game, create=True, emit=True)
get_game_by_gameno(gameno)
items()
keys()
onAdjournmentsList(adm, adjournments)
onCurGameEnded(bm, game)
onHistoryList(adm, history)
onJournalList(adm, journal)
start()
values()
class pychess.ic.FICSObjects.FICSHistoryGame(wplayer, bplayer, time=None, rated=False, game_type=None, private=False, minutes=None, inc=None, result=None, reason=None, board=None, relation=None, wrating=None, brating=None, gameno=None, history_no=None)

Bases: FICSGame

property display_time
class pychess.ic.FICSObjects.FICSJournalGame(wplayer, bplayer, our_color=None, time=None, rated=False, game_type=None, private=False, minutes=None, inc=None, result=None, reason=None, board=None, relation=None, wrating=None, brating=None, gameno=None, journal_no=None)

Bases: FICSGame

property display_time
class pychess.ic.FICSObjects.FICSMatch(minutes, inc, rated, game_type)

Bases: GObject

property display_rated
property display_timecontrol
property sortable_time
class pychess.ic.FICSObjects.FICSPlayer(name, online=False, status=10, game=None, titles=None)

Bases: GObject

display_titles(long=False)
getIcon(size=16, gametype=None)
classmethod getIconByRating(rating, size=16)
getMarkup(gametype=None, big=True, long_titles=True)
getRatingByGameType(game_type)
getRatingForCurrentGame()
getRatingMean()
getStrength()
get_game()
get_online()
get_status()
get_titles()
isAdmin()
isAvailableForGame()
isComputer()
isGuest()
isObservable()
isTitled()
long_name(game_type=None)
restore_previous_status()
set_game(game)
set_online(online)
set_status(status)
set_titles(titles)
property atomic
property blitz
property bughouse
property crazyhouse
property display_online
property display_status
game = <GObjectMock name='mock.property()' id='139819325834304'>
property lightning
property losers
online = <GObjectMock name='mock.property()' id='139819325834304'>
property standard
status = <GObjectMock name='mock.property()' id='139819325834304'>
property suicide
titles = <GObjectMock name='mock.property()' id='139819325834304'>
property wild
class pychess.ic.FICSObjects.FICSPlayers(connection)

Bases: GObject

get(name)
get_online_playernames()
items()
keys()
online_changed(player, prop)
player_disconnected(name)
start()
values()
class pychess.ic.FICSObjects.FICSSeek(index, player, minutes, inc, rated, color, game_type, rmin=0, rmax=9999, automatic=True, formula=False)

Bases: FICSSoughtMatch

class pychess.ic.FICSObjects.FICSSeeks(connection)

Bases: GObject

clear()
onAddSeek(glm, seek)
onClearSeeks(glm)
onCurGameEnded(bm, game)
onRemoveSeek(glm, index)
start()
class pychess.ic.FICSObjects.FICSSoughtMatch(index, player, minutes, inc, rated, color, game_type)

Bases: FICSMatch

property player_rating

This returns self.player’s rating for the type of match being sought. If self.player doesn’t have a rating for the type of match being sought, this returns 0. If the match is untimed we use self.player’s standard time-control rating if they have one.

pychess.ic.FICSObjects.get_challenge_tooltip_text(challenge)
pychess.ic.FICSObjects.get_player_tooltip_text(player, show_status=True)
pychess.ic.FICSObjects.get_rating_range_display_text(rmin=0, rmax=9999)
pychess.ic.FICSObjects.get_seek_tooltip_text(seek)
pychess.ic.FICSObjects.get_soughtmatch_tooltip_text(sought)
pychess.ic.FICSObjects.make_sensitive_if_available(button, player)
pychess.ic.FICSObjects.make_sensitive_if_playing(button, player)
pychess.ic.FICSObjects.player_id(name)

Two players are equal if the first 11 characters of their name match. This is to facilitate matching players from output of commands like the ‘games’ command which only return the first 11 characters of a player’s name

pychess.ic.ICGameModel module

class pychess.ic.ICGameModel.ICGameModel(connection, ficsgame, timemodel)

Bases: GameModel

acceptReceived(player, offer)
backToMainLine()
checkStatus()

Updates self.status so it fits with what getStatus(boards[-1]) would return. That is, if the game is e.g. check mated this will call mode.end(), or if moves have been undone from an otherwise ended position, this will call __resume and emit game_unended.

end(status, reason)
ficsplayer(player)
goFirst()
goLast()
goNext(step=1)
goPrev(step=1)
hasGuestPlayers()
offerReceived(player, offer)
onActionError(om, offer, error)
onBoardSetup(bm, gameno, fen, wname, bname)
onDisconnected(connection)
onExGameReset(bm, ficsgame)
onGameEnded(bm, ficsgame)
onGamePaused(bm, gameno, paused)
onGameUndoing(bm, gameno, ply)
onKibitzMessage(cm, name, gameno, text)
onMadeExamined(bm, gameno)
onMadeUnExamined(bm, gameno)
onObserversReceived(other, gameno, observers)
onTimesUpdate(bm, gameno, wms, bms)
onWhisperMessage(cm, name, gameno, text)
setPlayers(players)
terminate()
update_board(gameno, ply, curcol, lastmove, fen, wname, bname, wms, bms)
property display_text
property noTD
property remote_ficsplayer
property remote_player

pychess.ic.ICLogon module

exception pychess.ic.ICLogon.AutoLogoutException

Bases: Exception

class pychess.ic.ICLogon.ICLogon

Bases: object

get_user_names(value=None)

Split and return usernameEntry config item into registered and guest username

hide()
host_get_value(entry)
host_set_value(entry, value)
onAutologout(connection)
onCancel(widget, hide)
onConnectClicked(button)
onConnected(connection)
onConnectionError(connection, error)
onCreateNew(button)
onHelperConnectionError(connection, error)
onLogout(connection)
on_ics_combo_changed(combo)
on_logOnAsGuest_toggled(widget)
on_timeseal_toggled(widget)
password_set_value(entry, value)
present()
show()
showConnecting()
showError(connection, error)
showMessage(connection, message)
showNormal()
user_name_get_value(entry)
user_name_set_value(entry, value)
pychess.ic.ICLogon.run()
pychess.ic.ICLogon.stop()

pychess.ic.TimeSeal module

exception pychess.ic.TimeSeal.CanceledException

Bases: Exception

class pychess.ic.TimeSeal.ICSStreamReader(limit, loop, connected_event, name)

Bases: StreamReader

async read_until(*untils)
class pychess.ic.TimeSeal.ICSStreamReaderProtocol(stream_reader, client_connected_cb, loop, name, timeseal)

Bases: StreamReaderProtocol

cook_some(data)
data_received(data)

Called when some data is received.

The argument is a bytes object.

decode(buf, stateinfo=None)
encode(inbuf, timestamp=None)
class pychess.ic.TimeSeal.ICSTelnet(timeseal)

Bases: object

cancel()
close()
get_init_string()

timeseal header: TIMESTAMP|bruce|Linux gruber 2.6.15-gentoo-r1 #9 PREEMPT Thu Feb 9 20:09:47 GMT 2006 i686 Intel(R) Celeron(R) CPU 2.00GHz GenuineIntel GNU/Linux| 93049

async read_until(*untils)
async readline()
async readuntil(until)
async start(host, port, connected_event)
write(string)
sensitive = False

pychess.ic.VerboseTelnet module

class pychess.ic.VerboseTelnet.ConsoleHandler(callback)

Bases: object

handle(line)
class pychess.ic.VerboseTelnet.FromABPlusPrediction(callback, regexp0, regexp1, regexp2)

Bases: MultipleLinesPrediction

handle(line)
class pychess.ic.VerboseTelnet.FromPlusPrediction(callback, regexp0, regexp1)

Bases: MultipleLinesPrediction

handle(line)
class pychess.ic.VerboseTelnet.FromToPrediction(callback, regexp0, regexp1)

Bases: MultipleLinesPrediction

handle(line)
class pychess.ic.VerboseTelnet.LinePrediction(callback, regexp)

Bases: Prediction

handle(line)
class pychess.ic.VerboseTelnet.MultipleLinesPrediction(callback, *regexps)

Bases: Prediction

class pychess.ic.VerboseTelnet.NLinesPrediction(callback, *regexps)

Bases: MultipleLinesPrediction

handle(line)
class pychess.ic.VerboseTelnet.Prediction(callback, *regexps)

Bases: object

class pychess.ic.VerboseTelnet.PredictionsTelnet(telnet, predictions, reply_cmd_dict, replay_dg_dict, replay_cn_dict)

Bases: object

cancel()
close()
async parse()
run_command(text, show_reply=False)
async test_prediction(prediction, line)
class pychess.ic.VerboseTelnet.TelnetLine(line, code, code_type)

Bases: tuple

code

Alias for field number 1

code_type

Alias for field number 2

line

Alias for field number 0

class pychess.ic.VerboseTelnet.TelnetLines(telnet, show_reply)

Bases: object

appendleft(x)
extendleft(iterable)
async popleft()

Module contents

class pychess.ic.GameType(fics_name, short_fics_name, rating_type, display_text=None, variant_type=0)

Bases: object

property variant
class pychess.ic.NormalGameType(fics_name, short_fics_name, rating_type, display_text)

Bases: GameType

class pychess.ic.VariantGameType(fics_name, short_fics_name, rating_type, variant_type)

Bases: GameType

property display_text
property seek_text
class pychess.ic.WildGameType(fics_name, variant_type)

Bases: VariantGameType

classmethod instances()
pychess.ic.get_infobarmessage_content(player, text, gametype=None)
pychess.ic.get_infobarmessage_content2(player, heading_text, message_text, gametype=None)
pychess.ic.parseRating(rating)
pychess.ic.parse_title_hex(titlehex)
pychess.ic.time_control_to_gametype(minutes, gain)
pychess.ic.type_to_display_text(typename)