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


Python Platform.get方法代码示例

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


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

示例1: __init__

# 需要导入模块: from models import Platform [as 别名]
# 或者: from models.Platform import get [as 别名]
    def __init__(self):
        # FIXME: This function is massive. Break it up
        self._test_map = {}
        platform_id_map = {}
        branch_id_map = {}
        for test in Test.all():
            if test.hidden:
                continue

            branch_ids = [Branch.get(branch_key).id for branch_key in test.branches]
            platform_ids = [Platform.get(platform_key).id for platform_key in test.platforms]
            self._test_map[test.id] = {
                'name': test.name,
                'branchIds': branch_ids,
                'platformIds': platform_ids,
            }

            for platform_id in platform_ids:
                platform_id_map.setdefault(platform_id, {'tests': [], 'branches': []})
                platform_id_map[platform_id]['tests'].append(test.id)
                platform_id_map[platform_id]['branches'] += branch_ids

            for branch_id in branch_ids:
                branch_id_map.setdefault(branch_id, {'tests': [], 'platforms': []})
                branch_id_map[branch_id]['tests'].append(test.id)
                branch_id_map[branch_id]['platforms'] += platform_ids

        self._platform_map = {}
        for platform in Platform.all():
            if platform.id not in platform_id_map:
                continue

            if platform.hidden:
                for test_id in platform_id_map[platform.id]['tests']:
                    self._test_map[test_id]['platformIds'].remove(platform.id)
                for branch_id in platform_id_map[platform.id]['branches']:
                    branch_id_map[branch_id]['platforms'].remove(platform.id)
                continue

            self._platform_map[platform.id] = {
                'name': platform.name,
                'testIds': list(set(platform_id_map[platform.id]['tests'])),
                'branchIds': list(set(platform_id_map[platform.id]['branches'])),
            }

        self._branch_map = {}
        for branch in Branch.all():
            if branch.id not in branch_id_map:
                continue
            self._branch_map[branch.id] = {
                'name': branch.name,
                'testIds': list(set(branch_id_map[branch.id]['tests'])),
                'platformIds': list(set(branch_id_map[branch.id]['platforms'])),
            }
开发者ID:EQ4,项目名称:h5vcc,代码行数:56,代码来源:json_generators.py

示例2: get

# 需要导入模块: from models import Platform [as 别名]
# 或者: from models.Platform import get [as 别名]
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8';
        cache = memcache.get('manifest')
        if cache:
            self.response.out.write(cache)
            return

        testMap = {}
        platformIdMap = {}
        branchIdMap = {}
        for test in Test.all():
            branchIds = [Branch.get(branchKey).id for branchKey in test.branches]
            platformIds = [Platform.get(platformKey).id for platformKey in test.platforms]
            testMap[test.id] = {
                'name': test.name,
                'branchIds': branchIds,
                'platformIds': platformIds,
            }

            for platformId in platformIds:
                platformIdMap.setdefault(platformId, {'tests': [], 'branches': []})
                platformIdMap[platformId]['tests'].append(test.id)
                platformIdMap[platformId]['branches'] += branchIds

            for branchId in branchIds:
                branchIdMap.setdefault(branchId, {'tests': [], 'platforms': []})
                branchIdMap[branchId]['tests'].append(test.id)
                branchIdMap[branchId]['platforms'] += platformIds

        platformMap = {}
        for platform in Platform.all():
            if platform.id not in platformIdMap:
                continue
            platformMap[platform.id] = {
                'name': platform.name,
                'testIds': list(set(platformIdMap[platform.id]['tests'])),
                'branchIds': list(set(platformIdMap[platform.id]['branches'])),
            }

        branchMap = {}
        for branch in Branch.all():
            if branch.id not in branchIdMap:
                continue
            branchMap[branch.id] = {
                'name': branch.name,
                'testIds': list(set(branchIdMap[branch.id]['tests'])),
                'platformIds': list(set(branchIdMap[branch.id]['platforms'])),
            }

        result = json.dumps({'testMap': testMap, 'platformMap': platformMap, 'branchMap': branchMap})
        self.response.out.write(result)
        memcache.add('manifest', result)
开发者ID:,项目名称:,代码行数:54,代码来源:


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