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


Python Team.all方法代码示例

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


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

示例1: _upload_stats

# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import all [as 别名]
def _upload_stats(team_name, stats):
    query = Team.all()
    query.filter('name =', team_name)
    result = query.fetch(1)

    if len(result) > 0:
        for team in result:
            team.year = Const.LAST_YEAR
            team.offense_passing = stats['offense']['pass']
            team.offense_rushing = stats['offense']['rush']
            team.offense_first_down = stats['offense']['first_down']
            team.defense_passing = stats['defense']['pass']
            team.defense_rushing = stats['defense']['rush']
            team.defense_first_down = stats['defense']['first_down']

            team.put()
    else:
        team = Team(name = team_name,
                    year = Const.LAST_YEAR,
                    offense_passing = stats['offense']['pass'],
                    offense_rushing = stats['offense']['rush'],
                    offense_first_down = stats['offense']['first_down'],
                    defense_passing = stats['defense']['pass'],
                    defense_rushing = stats['defense']['rush'],
                    defense_first_down = stats['defense']['first_down'])

        team.put()
开发者ID:FenrirUnbound,项目名称:StatsUp,代码行数:29,代码来源:create_eleven.py

示例2: _fetch_stats

# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import all [as 别名]
    def _fetch_stats(self):
        result = {}
        query = Team.all()
        query.filter('name !=', 'Testing Team')
        query_result = query.fetch(50)
        
        for team in query_result:
            name = (team.name).encode('ascii', 'ignore')

            if name not in result:
                result[name] = {}
            if 'offense' not in result[name]:
                result[name]['offense'] = {}
            if 'defense' not in result[name]:
                result[name]['defense'] = {}

            offense = result[name]['offense']
            offense['pass'] = int(team.offense_passing)
            offense['rush'] = int(team.offense_rushing)
            offense['first_down'] = int(team.offense_first_down)

            defense = result[name]['defense']
            defense['pass'] = int(team.defense_passing)
            defense['rush'] = int(team.defense_rushing)
            defense['first_down'] = int(team.defense_first_down)
        
        return result
开发者ID:FenrirUnbound,项目名称:StatsUp,代码行数:29,代码来源:stats.py


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