本文整理汇总了Python中formatter.Formatter.format_updates方法的典型用法代码示例。如果您正苦于以下问题:Python Formatter.format_updates方法的具体用法?Python Formatter.format_updates怎么用?Python Formatter.format_updates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类formatter.Formatter
的用法示例。
在下文中一共展示了Formatter.format_updates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update
# 需要导入模块: from formatter import Formatter [as 别名]
# 或者: from formatter.Formatter import format_updates [as 别名]
def update(self, server, monitor, data):
# clone monitor so we don't overwrite settings
_monitor = dict(monitor)
# TODO: delete monitor
# skip empty monitor
if not _monitor['alliances']: return
logging.info("Sending Updates to chat %s", monitor['chatname'])
# filter updates, conquers, and changes per this monitor
_monitor['updates'] = {k: data['updates'][str(k)] for k in _monitor['alliances'] if data['updates'][str(k)] != None}
_monitor['conquers'] = {k: data['conquers'][str(k)] for k in _monitor['alliances'] if data['conquers'][str(k)] != None}
_monitor['changes'] = {k: data['changes'][str(k)] for k in _monitor['alliances'] if data['changes'][str(k)] != None}
# get chat for monitor
chat = self._skype.Chat(monitor['chatname'])
# send updates to chat
if (_monitor['updates']):
chat.SendMessage(Formatter.format_updates(server, _monitor['updates']))
if (_monitor['conquers']):
chat.SendMessage(Formatter.format_conquers(server, _monitor['conquers']))
if (_monitor['changes']):
chat.SendMessage(Formatter.format_changes(server, _monitor['changes']))