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


Python Team.validate_key_name方法代码示例

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


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

示例1: main

# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import validate_key_name [as 别名]
def main(key, url):
    print "Configuring GAE Remote API on {} to import {}".format(url, key)
    if 'localhost' in url:
        remote_api_stub.ConfigureRemoteApi(None, '/_ah/remote_api', local_auth_func, url)
    else:
        remote_api_stub.ConfigureRemoteApiForOAuth(url, '/_ah/remote_api')

    print "Loading data from The Blue Alliance requires an API key"
    print "Please go to https://thebluealliance.com/account and generate a read API key"
    apiv3_key = raw_input("Enter your API key: ")

    global AUTH_TOKEN
    AUTH_TOKEN = apiv3_key

    if Match.validate_key_name(key):
        match_data = fetch_match(key)
        store_match(match_data)

    elif Event.validate_key_name(key):
        update_event(key)
    elif Team.validate_key_name(key):
        team_data = fetch_team(key)
        store_team(team_data)
    elif key.isdigit():
        event_keys = [event['key'] for event in fetch_endpoint('events/{}'.format(key))]
        for event in event_keys:
            update_event(event)
    else:
        print "Unknown key :("
开发者ID:fangeugene,项目名称:the-blue-alliance,代码行数:31,代码来源:bootstrap.py

示例2: main

# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import validate_key_name [as 别名]
def main(key, url):
    print "Configuring GAE Remote API on {} to import {}".format(url, key)
    if 'localhost' in url:
        remote_api_stub.ConfigureRemoteApi(None, '/_ah/remote_api', local_auth_func, url)
    else:
        remote_api_stub.ConfigureRemoteApiForOAuth(url, '/_ah/remote_api')

    print "Loading data from The Blue Alliance requires an API key"
    print "Please go to https://thebluealliance.com/account and generate a read API key"
    apiv3_key = raw_input("Enter your API key: ")

    global AUTH_TOKEN
    AUTH_TOKEN = apiv3_key

    if Match.validate_key_name(key):
        match_data = fetch_match(key)
        store_match(match_data)

    elif Event.validate_key_name(key):
        event_data = fetch_event(key)
        event = store_event(event_data)

        event_teams = fetch_event_detail(key, 'teams')
        teams = map(store_team, event_teams)
        map(lambda t: store_eventteam(t, event), teams)

        event_matches = fetch_event_detail(key, 'matches')
        map(store_match, event_matches)

        event_rankings = fetch_event_detail(key, 'rankings')
        store_eventdetail(event, 'rankings2', event_rankings['rankings'] if event_rankings else [])

        event_alliances = fetch_event_detail(key, 'alliances')
        store_eventdetail(event, 'alliance_selections', event_alliances)

        event_awards = fetch_event_detail(key, 'awards')
        map(lambda t: store_award(t, event), event_awards)

    elif Team.validate_key_name(key):
        team_data = fetch_team(key)
        store_team(team_data)

    else:
        print "Unknown key :("
开发者ID:nwalters512,项目名称:the-blue-alliance,代码行数:46,代码来源:bootstrap.py

示例3: test_invalid_team_key

# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import validate_key_name [as 别名]
 def test_invalid_team_key(self):
     self.assertEqual(Team.validate_key_name(self.invalid_team_key), False)
     self.assertEqual(Team.validate_key_name(self.invalid_team_key2), False)
     self.assertEqual(Team.validate_key_name(self.invalid_team_key3), False)
开发者ID:linuxuser0,项目名称:the-blue-alliance,代码行数:6,代码来源:test_key_name_validators.py

示例4: test_valid_team_key

# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import validate_key_name [as 别名]
 def test_valid_team_key(self):
     self.assertEqual(Team.validate_key_name(self.valid_team_key), True)
     self.assertEqual(Team.validate_key_name(self.valid_team_key2), True)
开发者ID:linuxuser0,项目名称:the-blue-alliance,代码行数:5,代码来源:test_key_name_validators.py

示例5: is_valid_model_key

# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import validate_key_name [as 别名]
 def is_valid_model_key(cls, key):
     return (Team.validate_key_name(key) or
         Event.validate_key_name(key) or
         Match.validate_key_name(key) or
         District.validate_key_name(key))
开发者ID:CarlColglazier,项目名称:the-blue-alliance,代码行数:7,代码来源:validation_helper.py


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