本文整理汇总了Python中pychess.System.Log.log.warning函数的典型用法代码示例。如果您正苦于以下问题:Python warning函数的具体用法?Python warning怎么用?Python warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了warning函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _del
def _del(self):
self.egtb.disconnect(self.cid)
try:
self.queue.put_nowait(self.StopNow)
except asyncio.QueueFull:
log.warning("EndgameAdvisor.gamewidget_closed: Queue.Full")
self.egtb_task.cancel()
开发者ID:bboutkov,项目名称:pychess,代码行数:7,代码来源:bookPanel.py
示例2: onGameStarted
def onGameStarted(self, gamemodel):
if gamemodel.examined:
if gamemodel.players[0].name == gamemodel.connection.username:
self.player = gamemodel.players[0]
self.opplayer = gamemodel.players[1]
else:
self.player = gamemodel.players[1]
self.opplayer = gamemodel.players[0]
elif gamemodel.isObservationGame():
# no local player but enable chat to send/receive whisper/kibitz
pass
elif gamemodel.players[0].__type__ == LOCAL:
self.player = gamemodel.players[0]
self.opplayer = gamemodel.players[1]
if gamemodel.players[1].__type__ == LOCAL:
log.warning("Chatpanel loaded with two local players")
elif gamemodel.players[1].__type__ == LOCAL:
self.player = gamemodel.players[1]
self.opplayer = gamemodel.players[0]
else:
log.info("Chatpanel loaded with no local players")
self.chatView.hide()
if isinstance(gamemodel, ICGameModel):
if gamemodel.connection.ICC:
gamemodel.connection.client.run_command("set-2 %s 1" % DG_PLAYERS_IN_MY_GAME)
else:
allob = 'allob ' + str(gamemodel.ficsgame.gameno)
gamemodel.connection.client.run_command(allob)
if hasattr(self, "player") and not gamemodel.examined and self.player_cid is None:
self.player_cid = self.player.connect("messageReceived", self.onMessageRecieved)
self.chatView.enable()
开发者ID:leogregianin,项目名称:pychess,代码行数:34,代码来源:chatPanel.py
示例3: on_drag_received
def on_drag_received (self, wi, context, x, y, selection, target_type, timestamp):
uri = selection.data.strip()
uris = uri.split()
if len(uris) > 1:
log.warning("%d files were dropped. Only loading the first" % len(uris))
uri = uris[0]
newGameDialog.LoadFileExtension.run(uri)
开发者ID:prvn16,项目名称:pychess,代码行数:7,代码来源:Main.py
示例4: onOfferAdd
def onOfferAdd (self, match):
log.debug("OfferManager.onOfferAdd: match.string=%s" % match.string)
tofrom, index, offertype, parameters = match.groups()
index = int(index)
if tofrom == "t":
# ICGameModel keeps track of the offers we've sent ourselves, so we
# don't need this
return
if offertype not in strToOfferType:
log.warning("OfferManager.onOfferAdd: Declining unknown offer type: " + \
"offertype=%s parameters=%s index=%d" % (offertype, parameters, index))
self.connection.client.run_command("decline %d" % index)
offertype = strToOfferType[offertype]
if offertype == TAKEBACK_OFFER:
offer = Offer(offertype, param=int(parameters), index=index)
else:
offer = Offer(offertype, index=index)
self.offers[offer.index] = offer
if offer.type == MATCH_OFFER:
is_adjourned = False
if matchreUntimed.match(parameters) != None:
fname, frating, col, tname, trating, rated, type = \
matchreUntimed.match(parameters).groups()
mins = 0
incr = 0
gametype = GAME_TYPES["untimed"]
else:
fname, frating, col, tname, trating, rated, gametype, mins, \
incr, wildtype, adjourned = matchre.match(parameters).groups()
if (wildtype and "adjourned" in wildtype) or \
(adjourned and "adjourned" in adjourned):
is_adjourned = True
if wildtype and "wild" in wildtype:
gametype = wildtype
try:
gametype = GAME_TYPES[gametype]
except KeyError:
log.warning("OfferManager.onOfferAdd: auto-declining " + \
"unknown offer type: '%s'\n" % gametype)
self.decline(offer)
del self.offers[offer.index]
return
player = self.connection.players.get(FICSPlayer(fname))
rating = frating.strip()
rating = int(rating) if rating.isdigit() else 0
if gametype.rating_type in player.ratings and \
player.ratings[gametype.rating_type].elo != rating:
player.ratings[gametype.rating_type].elo = rating
rated = rated != "unrated"
challenge = FICSChallenge(index, player, int(mins), int(incr), rated, col,
gametype, adjourned=is_adjourned)
self.emit("onChallengeAdd", challenge)
else:
log.debug("OfferManager.onOfferAdd: emitting onOfferAdd: %s" % offer)
self.emit("onOfferAdd", offer)
开发者ID:Alex-Linhares,项目名称:pychess,代码行数:60,代码来源:OfferManager.py
示例5: kill
def kill(self, reason):
""" Kills the engine, starting with the 'quit' command, then sigterm and
eventually sigkill.
Returns the exitcode, or if engine have already been killed, returns
None """
if self.connected:
self.connected = False
try:
try:
print("quit", file=self.engine)
self.queue.put_nowait("del")
self.engine.terminate()
except OSError as err:
# No need to raise on a hang up error, as the engine is dead
# anyways
if err.errno == 32:
log.warning("Hung up Error", extra={"task": self.defname})
return err.errno
else:
raise
finally:
# Clear the analyzed data, if any
self.emit("analyze", [])
开发者ID:bboutkov,项目名称:pychess,代码行数:25,代码来源:CECPEngine.py
示例6: __startBlocking
def __startBlocking(self, event):
if self.protover == 1:
self.emit("readyForMoves")
return_value = "ready"
if self.protover == 2:
try:
return_value = yield from asyncio.wait_for(self.queue.get(), TIME_OUT_SECOND)
if return_value == "not ready":
return_value = yield from asyncio.wait_for(self.queue.get(), TIME_OUT_SECOND)
# Gaviota sends done=0 after "xboard" and after "protover 2" too
if return_value == "not ready":
return_value = yield from asyncio.wait_for(self.queue.get(), TIME_OUT_SECOND)
self.emit("readyForOptions")
self.emit("readyForMoves")
except asyncio.TimeoutError:
log.warning("Got timeout error", extra={"task": self.defname})
raise PlayerIsDead
except:
log.warning("Unknown error", extra={"task": self.defname})
raise PlayerIsDead
else:
if return_value == "die":
raise PlayerIsDead
assert return_value == "ready" or return_value == "del"
if event is not None:
event.set()
开发者ID:bboutkov,项目名称:pychess,代码行数:28,代码来源:CECPEngine.py
示例7: release
def release():
me = currentThread()
# As it is the natural state for the MainThread to control the gdklock, we
# only release it if _rlock has been released so many times that we don't
# own it any more
if me.getName() == "MainThread":
if not has():
_debug('glock.release', me, '-> threads_leave')
Gdk.threads_leave()
_debug('glock.release', me, '<- threads_leave')
else:
_debug('glock.release', me, '-> _rlock.release')
_rlock.release()
_debug('glock.release', me, '<- _rlock.release')
# If this is the last unlock, we also free the gdklock.
elif has():
if rlock_count(_rlock) == 1:
_debug('glock.release', me, '-> threads_leave')
Gdk.threads_leave()
_debug('glock.release', me, '<- threads_leave')
_debug('glock.release', me, '-> _rlock.release')
_rlock.release()
_debug('glock.release', me, '<- _rlock.release')
else:
log.warning("Tried to release un-owned glock\n%s" %
"".join(traceback.format_stack()),
extra={"task": (me.ident, me.name, 'glock.release')})
开发者ID:Alex-Linhares,项目名称:pychess,代码行数:27,代码来源:glock.py
示例8: scoreAllMoves
def scoreAllMoves(self, board):
result, depth = self.scoreGame(board, False, False)
if result is None:
return []
scores = []
gen = board.isChecked() and genCheckEvasions or genAllMoves
for move in gen(board):
board.applyMove(move)
if not board.opIsChecked():
result, depth = self.scoreGame(board, False, False)
if result is None:
log.warning("An EGTB file does not have all its dependencies")
board.popMove()
return []
scores.append((move, result, depth))
board.popMove()
def mateScore(mrd):
if mrd[1] == DRAW:
return 0
absScore = 32767 - mrd[2]
if (board.color == WHITE) ^ (mrd[1] == WHITEWON):
return absScore
return -absScore
scores.sort(key=mateScore)
return scores
开发者ID:oldstylejoe,项目名称:pychess-timed,代码行数:28,代码来源:egtb_gaviota.py
示例9: shownChanged
def shownChanged(self, boardview, shown):
if boardview.model is None:
return
boardview.bluearrow = None
if legalMoveCount(boardview.model.getBoardAtPly(
shown, boardview.shown_variation_idx)) == 0:
if self.sw.get_child() == self.tv:
self.sw.remove(self.tv)
label = Gtk.Label(_(
"In this position,\nthere is no legal move."))
label.set_property("yalign", 0.1)
self.sw.add_with_viewport(label)
self.sw.get_child().set_shadow_type(Gtk.ShadowType.NONE)
self.sw.show_all()
return
for advisor in self.advisors:
advisor.shownChanged(boardview, shown)
self.tv.expand_all()
if self.sw.get_child() != self.tv:
log.warning("bookPanel.Sidepanel.shownChanged: get_child() != tv")
self.sw.remove(self.sw.get_child())
self.sw.add(self.tv)
开发者ID:ME7ROPOLIS,项目名称:pychess,代码行数:25,代码来源:bookPanel.py
示例10: __clean
def __clean(self, rundata, engine):
""" Grab the engine from the backup and attach the attributes
from rundata. The update engine is ready for discovering.
"""
vmpath, path = rundata
md5sum = md5_sum(path)
######
# Find the backup engine
######
try:
backup_engine = next((
c for c in backup if c["name"] == engine["name"]))
engine["country"] = backup_engine["country"]
except StopIteration:
log.warning(
"Engine '%s' is not in PyChess predefined known engines list" % engine.get('name'))
engine['recheck'] = True
######
# Clean it
######
engine['command'] = path
engine['md5'] = md5sum
if vmpath is not None:
engine['vm_command'] = vmpath
if "variants" in engine:
del engine["variants"]
if "options" in engine:
del engine["options"]
开发者ID:teacoffee2017,项目名称:pychess,代码行数:32,代码来源:engineNest.py
示例11: __clean
def __clean(self, rundata, engine):
""" Grab the engine from the backup and attach the attributes
from rundata. The update engine is ready for discovering.
"""
vmpath, path = rundata
md5sum = md5_sum(path)
######
# Find the backup engine
######
try:
backup_engine = next((c for c in backup if c["name"] == engine["name"]))
engine["country"] = backup_engine["country"]
except StopIteration:
log.warning("Engine '%s' has not been tested and verified to work with PyChess" % engine.get("name"))
engine["recheck"] = True
######
# Clean it
######
engine["command"] = path
engine["md5"] = md5sum
if vmpath is not None:
engine["vm_command"] = vmpath
if "variants" in engine:
del engine["variants"]
if "options" in engine:
del engine["options"]
开发者ID:oldstylejoe,项目名称:pychess-timed,代码行数:30,代码来源:engineNest.py
示例12: resign
def resign (self, game):
""" This is (and draw and abort) are possible even when one's
opponent is not logged on """
if not game.opponent.adjournment:
log.warning("AdjournManager.resign: no adjourned game vs %s" % game.opponent)
return
log.info("AdjournManager.resign: resigning adjourned game=%s" % game)
self.connection.client.run_command("resign %s" % game.opponent.name)
开发者ID:vgupta2507,项目名称:pychess,代码行数:8,代码来源:AdjournManager.py
示例13: resume
def resume(self, game):
if not game.opponent.adjournment:
log.warning("AdjournManager.resume: no adjourned game vs %s" %
game.opponent)
return
log.info("AdjournManager.resume: offering resume for adjourned game=%s"
% game)
self.connection.client.run_command("match %s" % game.opponent.name)
开发者ID:bboutkov,项目名称:pychess,代码行数:8,代码来源:AdjournManager.py
示例14: draw
def draw(self, game):
if not game.opponent.adjournment:
log.warning("AdjournManager.draw: no adjourned game vs %s" %
game.opponent)
return
log.info("AdjournManager.draw: offering sdraw for adjourned game=%s" %
game)
self.connection.client.run_command("sdraw %s" % game.opponent.name)
开发者ID:bboutkov,项目名称:pychess,代码行数:8,代码来源:AdjournManager.py
示例15: _loadLibrary
def _loadLibrary(self):
libName = "libgaviotatb.so.1.0.1"
try:
self.libgtb = CDLL(libName)
except OSError:
log.warning("Failed to load Gaviota EGTB library %s" % libName)
return None
return self.libgtb
开发者ID:oldstylejoe,项目名称:pychess-timed,代码行数:8,代码来源:egtb_gaviota.py
示例16: onChannelLogLine
def onChannelLogLine (self, match):
if not self.currentLogChannel:
log.warning("Received log line before channel was set")
return
h, m, s, handle, text = match.groups()
time = self.convTime(int(h), int(m), int(s))
text = self.entityDecode(text)
GLib.idle_add(self.emit, "channelLog", self.currentLogChannel, time, handle, text)
开发者ID:vgupta2507,项目名称:pychess,代码行数:8,代码来源:ChatManager.py
示例17: __setitem__
def __setitem__ (self, index, seek):
if not isinstance(index, int): raise TypeError
if not isinstance(seek, FICSSoughtMatch): raise TypeError
if index in self:
log.warning("FICSSeeks: not overwriting seek %s" % repr(seek))
return
self.seeks[index] = seek
self.emit('FICSSeekCreated', seek)
开发者ID:sally0813,项目名称:pychess,代码行数:8,代码来源:FICSObjects.py
示例18: abort
def abort(self, game):
if not game.opponent.adjournment:
log.warning("AdjournManager.abort: no adjourned game vs %s" %
game.opponent)
return
log.info("AdjournManager.abort: offering sabort for adjourned game=%s"
% game)
self.connection.client.run_command("sabort %s" % game.opponent.name)
开发者ID:bboutkov,项目名称:pychess,代码行数:8,代码来源:AdjournManager.py
示例19: onObserveGameCreated
def onObserveGameCreated (self, matchlist):
log.debug("'%s'" % (matchlist[1].string),
extra={"task": (self.connection.username, "BM.onObserveGameCreated")})
gameno, wname, wrating, bname, brating, rated, gametype, min, inc = matchlist[1].groups()
wplayer = self.connection.players.get(FICSPlayer(wname))
bplayer = self.connection.players.get(FICSPlayer(bname))
game = FICSGame(wplayer, bplayer, gameno=int(gameno))
style12 = matchlist[-1].groups()[0]
gameno = int(gameno)
wrating = self.parseRating(wrating)
brating = self.parseRating(brating)
game_type = GAME_TYPES[gametype]
castleSigns = self.generateCastleSigns(style12, game_type)
self.castleSigns[gameno] = castleSigns
gameno, relation, curcol, ply, wname, bname, wms, bms, gain, lastmove, fen = \
self.parseStyle12(style12, castleSigns)
if relation == IC_POS_OBSERVING_EXAMINATION:
pgnHead = [
("Event", "FICS %s %s game" % (rated, game_type.fics_name)),
("Site", "freechess.org"),
("White", wname),
("Black", bname),
("Result", "*"),
("SetUp", "1"),
("FEN", fen)
]
pgn = "\n".join(['[%s "%s"]' % line for line in pgnHead]) + "\n*\n"
game = FICSGame(wplayer, bplayer, gameno=gameno, rated=rated=="rated",
game_type=game_type, minutes=int(min), inc=int(inc),
board=FICSBoard(wms, bms, pgn=pgn), relation=relation)
game = self.connection.games.get(game)
self.gamesImObserving[game] = None
self.gamemodelStartedEvents[game.gameno] = threading.Event()
self.emit("obsGameCreated", game)
self.gamemodelStartedEvents[game.gameno].wait()
else:
game = self.connection.games.get(game, emit=False)
if not game.supported:
log.warning("Trying to follow an unsupported type game %s" % game.game_type)
return
if game.gameno in self.gamemodelStartedEvents:
log.warning("%s already in gamemodelstartedevents" % game.gameno)
return
self.gamesImObserving[game] = None
self.queuedStyle12s[game.gameno] = []
self.queuedEmits[game.gameno] = []
self.gamemodelStartedEvents[game.gameno] = threading.Event()
# FICS doesn't send the move list after 'observe' and 'follow' commands
self.connection.client.run_command("moves %d" % game.gameno)
开发者ID:sally0813,项目名称:pychess,代码行数:57,代码来源:BoardManager.py
示例20: setOptionVariant
def setOptionVariant (self, variant):
if self.features["variants"] is None:
log.warning("setOptionVariant: engine doesn't support variants", extra={"task":self.defname})
return
if variant in variants.values() and not variant.standard_rules:
assert variant.cecp_name in self.features["variants"], \
"%s doesn't support %s variant" % (self, variant.cecp_name)
self.optionQueue.append("variant %s" % variant.cecp_name)
开发者ID:Alex-Linhares,项目名称:pychess,代码行数:9,代码来源:CECPEngine.py
注:本文中的pychess.System.Log.log.warning函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论