当前位置: 首页>>代码示例>>Python>>正文


Python FirebasePusher.update_match方法代码示例

本文整理汇总了Python中helpers.firebase.firebase_pusher.FirebasePusher.update_match方法的典型用法代码示例。如果您正苦于以下问题:Python FirebasePusher.update_match方法的具体用法?Python FirebasePusher.update_match怎么用?Python FirebasePusher.update_match使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在helpers.firebase.firebase_pusher.FirebasePusher的用法示例。


在下文中一共展示了FirebasePusher.update_match方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: set

# 需要导入模块: from helpers.firebase.firebase_pusher import FirebasePusher [as 别名]
# 或者: from helpers.firebase.firebase_pusher.FirebasePusher import update_match [as 别名]
        '''
        for event in unplayed_match_events:
            try:
                logging.info("Sending schedule updates for: {}".format(event.key_name))
                NotificationHelper.send_schedule_update(event)
            except Exception, exception:
                logging.error("Eror sending schedule updates for: {}".format(event.key_name))

        '''
        Enqueue firebase push
        '''
        event_keys = set()
        for match in matches:
            event_keys.add(match.event.id())
            try:
                FirebasePusher.update_match(match)
            except Exception:
                logging.warning("Enqueuing Firebase push failed!")

        # Enqueue task to calculate matchstats
        for event_key in event_keys:
            taskqueue.add(
                url='/tasks/math/do/event_matchstats/' + event_key,
                method='GET')

    @classmethod
    def updateMerge(self, new_match, old_match, auto_union=True):
        """
        Given an "old" and a "new" Match object, replace the fields in the
        "old" team that are present in the "new" team, but keep fields from
        the "old" team that are null in the "new" team.
开发者ID:cmlicata,项目名称:the-blue-alliance,代码行数:33,代码来源:match_manipulator.py

示例2: set

# 需要导入模块: from helpers.firebase.firebase_pusher import FirebasePusher [as 别名]
# 或者: from helpers.firebase.firebase_pusher.FirebasePusher import update_match [as 别名]
            try:
                logging.info("Sending schedule updates for: {}".format(event.key_name))
                NotificationHelper.send_schedule_update(event)
            except Exception, exception:
                logging.error("Eror sending schedule updates for: {}".format(event.key_name))

        '''
        Enqueue firebase push
        '''
        affected_stats_event_keys = set()
        for (match, updated_attrs, is_new) in zip(matches, updated_attr_list, is_new_list):
            # Only attrs that affect stats
            if is_new or set(['alliances_json', 'score_breakdown_json']).intersection(set(updated_attrs)) != set():
                affected_stats_event_keys.add(match.event.id())
            try:
                FirebasePusher.update_match(match, updated_attrs)
            except Exception:
                logging.warning("Firebase update_match failed!")
                logging.warning(traceback.format_exc())

        # Enqueue statistics
        for event_key in affected_stats_event_keys:
            # Enqueue task to calculate matchstats
            try:
                taskqueue.add(
                    url='/tasks/math/do/event_matchstats/' + event_key,
                    method='GET')
            except Exception:
                logging.error("Error enqueuing event_matchstats for {}".format(event_key))
                logging.error(traceback.format_exc())
开发者ID:MC42,项目名称:the-blue-alliance,代码行数:32,代码来源:match_manipulator.py


注:本文中的helpers.firebase.firebase_pusher.FirebasePusher.update_match方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。