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


Python DatafeedFMSAPI.getSyncEnabledOffseasonEvents方法代码示例

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


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

示例1: get

# 需要导入模块: from datafeeds.datafeed_fms_api import DatafeedFMSAPI [as 别名]
# 或者: from datafeeds.datafeed_fms_api.DatafeedFMSAPI import getSyncEnabledOffseasonEvents [as 别名]
    def get(self, year):
        df = DatafeedFMSAPI('v2.0')
        first_events, _ = df.getSyncEnabledOffseasonEvents(year)
        linked_events, maybed_linked_events, new_events = \
            OffseasonEventHelper.categorize_offseasons(int(year), first_events)

        events_to_update = []
        events_to_put = []

        # for all events with a first_code linked, ensure official=True
        logging.info("Found {} already linked events".format(len(linked_events)))
        for tba, first in linked_events:
            if tba.first_code != first.event_short or not tba.official:
                tba.first_code = first.event_short
                tba.official = True
                events_to_put.append(tba)
            events_to_update.append(tba)

        # for all events that we can maybe link, also do that
        logging.info("Auto-linking {} probably events".format(len(maybed_linked_events)))
        for tba, first in maybed_linked_events:
            tba.first_code = first.event_short
            tba.official = True
            events_to_put.append(tba)
            events_to_update.append(tba)

        logging.info("Found {} events to put".format(len(events_to_put)))
        if events_to_put:
            EventManipulator.createOrUpdate(events_to_put)

        # Enqueue details updates for these events
        logging.info("Found {} events to update".format(len(events_to_update)))
        for event in events_to_update:
            taskqueue.add(
                queue_name='datafeed',
                target='backend-tasks',
                url='/backend-tasks/get/event_details/'+event.key_name,
                method='GET'
            )

        # Event we don't have anything for... Create suggestions
        logging.info("Found {} new events to link".format(len(new_events)))
        SuggestionCreator.createDummyOffseasonSuggestions(new_events)
开发者ID:MC42,项目名称:the-blue-alliance,代码行数:45,代码来源:datafeed_controller.py


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