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


Python ModelToDict.matchConverter方法代码示例

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


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

示例1: _render

# 需要导入模块: from helpers.model_to_dict import ModelToDict [as 别名]
# 或者: from helpers.model_to_dict.ModelToDict import matchConverter [as 别名]
    def _render(self, event_key):
        self._set_event(event_key)

        matches = self.event.matches
        match_dicts = [ModelToDict.matchConverter(match) for match in matches]

        return json.dumps(match_dicts, ensure_ascii=True)
开发者ID:cmlicata,项目名称:the-blue-alliance,代码行数:9,代码来源:api_event_controller.py

示例2: _render

# 需要导入模块: from helpers.model_to_dict import ModelToDict [as 别名]
# 或者: from helpers.model_to_dict.ModelToDict import matchConverter [as 别名]
    def _render(self, team_key, event_key):
        match_keys_future = Match.query(Match.event == ndb.Key(Event, self.event_key), Match.team_key_names == self.team_key).fetch_async(None, keys_only=True)
        match_futures = ndb.get_multi_async(match_keys_future.get_result())

        matches = [ModelToDict.matchConverter(match_future.get_result()) for match_future in match_futures]

        return json.dumps(matches, ensure_ascii=True)
开发者ID:Captain-Dude,项目名称:the-blue-alliance,代码行数:9,代码来源:api_team_controller.py

示例3: _build_dict

# 需要导入模块: from helpers.model_to_dict import ModelToDict [as 别名]
# 或者: from helpers.model_to_dict.ModelToDict import matchConverter [as 别名]
 def _build_dict(self):
     data = {}
     data['message_type'] = NotificationType.type_names[self._type]
     data['message_data'] = {}
     data['message_data']['event_name'] = self.event.name
     data['message_data']['match'] = ModelToDict.matchConverter(self.match)
     return data
开发者ID:cmlicata,项目名称:the-blue-alliance,代码行数:9,代码来源:match_score.py

示例4: _render_android

# 需要导入模块: from helpers.model_to_dict import ModelToDict [as 别名]
# 或者: from helpers.model_to_dict.ModelToDict import matchConverter [as 别名]
    def _render_android(self):
        gcm_keys = self.keys[ClientType.OS_ANDROID]

        data = {}
        data["message_type"] = NotificationType.type_names[NotificationType.MATCH_SCORE]
        data["message_data"] = {}
        data["message_data"]["event_name"] = self.match.event.get().name
        data["message_data"]["match"] = ModelToDict.matchConverter(self.match)

        return GCMMessage(gcm_keys, data)
开发者ID:dewdn2,项目名称:the-blue-alliance,代码行数:12,代码来源:match_score.py

示例5: test_build

# 需要导入模块: from helpers.model_to_dict import ModelToDict [as 别名]
# 或者: from helpers.model_to_dict.ModelToDict import matchConverter [as 别名]
    def test_build(self):
        expected = {}
        expected['message_type'] = NotificationType.type_names[NotificationType.MATCH_SCORE]
        expected['message_data'] = {}
        expected['message_data']['event_name'] = self.event.name
        expected['message_data']['match'] = ModelToDict.matchConverter(self.match)

        data = self.notification._build_dict()

        self.assertEqual(expected, data)
开发者ID:BowlesCR,项目名称:the-blue-alliance,代码行数:12,代码来源:test_notification_score.py

示例6: _render

# 需要导入模块: from helpers.model_to_dict import ModelToDict [as 别名]
# 或者: from helpers.model_to_dict.ModelToDict import matchConverter [as 别名]
    def _render(self, team_key, year=None):
        self._write_cache_headers(61)

        self.team = Team.get_by_id(self.team_key)
        if self.team is None:
            self._errors = json.dumps({"404": "%s team not found" % self.team_key})
            self.abort(404)

        events_sorted, matches_by_event_key, awards_by_event_key, _ = TeamDetailsDataFetcher.fetch(self.team, self.year)
        team_dict = ModelToDict.teamConverter(self.team)

        team_dict["events"] = list()
        for event in events_sorted:
            event_dict = ModelToDict.eventConverter(event)
            event_dict["matches"] = [ModelToDict.matchConverter(match) for match in matches_by_event_key.get(event.key, [])]
            event_dict["awards"] = [ModelToDict.awardConverter(award) for award in awards_by_event_key.get(event.key, [])]
            team_dict["events"].append(event_dict)

        return json.dumps(team_dict, ensure_ascii=True)
开发者ID:linuxuser0,项目名称:the-blue-alliance,代码行数:21,代码来源:api_team_controller.py

示例7: _render

# 需要导入模块: from helpers.model_to_dict import ModelToDict [as 别名]
# 或者: from helpers.model_to_dict.ModelToDict import matchConverter [as 别名]
    def _render(self, team_key, event_key):
        matches = TeamEventMatchesQuery(self.team_key, self.event_key).fetch()

        matches = [ModelToDict.matchConverter(match) for match in matches]

        return json.dumps(matches, ensure_ascii=True)
开发者ID:DNGros,项目名称:the-blue-alliance,代码行数:8,代码来源:api_team_controller.py

示例8: _render

# 需要导入模块: from helpers.model_to_dict import ModelToDict [as 别名]
# 或者: from helpers.model_to_dict.ModelToDict import matchConverter [as 别名]
    def _render(self, match_key):
        self._set_match(match_key)

        match_dict = ModelToDict.matchConverter(self.match)

        return json.dumps(match_dict, ensure_ascii=True)
开发者ID:FRC-Team-5522,项目名称:the-blue-alliance,代码行数:8,代码来源:api_match_controller.py


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