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


Python PersistenceManager.get_league方法代码示例

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


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

示例1: __init__

# 需要导入模块: from persistence import PersistenceManager [as 别名]
# 或者: from persistence.PersistenceManager import get_league [as 别名]
 def __init__(self,tsvfile):
     if tsvfile is None:
         return
     pm = PersistenceManager( myapp.db_connector )
     league_name = "X-Wing Vassal League Season Two"
     league = pm.get_league(league_name)
     self.tsv_players = {}
     self.divisions = {}
     with open(tsvfile, 'rU') as input:
         reader = csv.reader( input,delimiter='\t' )
         for row in reader:
             person_name = unicode(row[0].strip())
             email_address = row[1].strip()
             challonge_name = unicode(row[2].strip())
             time_zone = row[3].strip()
             reddit_handle = row[4].strip()
             challengeboards_name = row[5].strip()
             tier_name = row[6].strip()
             tier_number = row[7].strip()
             division_name = row[8].strip()
             division_letter = row[9].strip()
             self.tsv_players[challonge_name] = { 'person_name': person_name,
                                             'email_address' : email_address,
                                             'challonge_name' : challonge_name,
                                             'time_zone' : time_zone,
                                             'reddit_handle' : reddit_handle,
                                             'challengeboards_name':challengeboards_name ,
                                             'tier_name' : tier_name,
                                             'tier_number' : tier_number,
                                             'division_name' : division_name,
                                             'division_letter' : division_letter }
             if not self.divisions.has_key( division_name ):
                 self.divisions[division_name] = { 'name': division_name, 'letter':division_letter, 'tier': tier_name}
开发者ID:timfreilly,项目名称:xwlists,代码行数:35,代码来源:season_two_manual_entry.py

示例2: decode

# 需要导入模块: from persistence import PersistenceManager [as 别名]
# 或者: from persistence.PersistenceManager import get_league [as 别名]
                print "looking up division %s for player %s" % (division_name, lookup_name)

                if not divisions_href.has_key(division_name):
                    divisions_href[division_name] = pm.get_division(division_name, league)
                tier_player.division = divisions_href[division_name]
                tier_player.tier = tier_player.division.tier
                tier_player.challengeboards_handle = decode(tsv_record['challengeboards_name'])
                tier_player.challonge_id = player['id']
                print player['group_player_ids'][0]
                tier_player.group_id = player['group_player_ids'][0]
                tier_player.name = lookup_name
                tier_player.email_address = decode(tsv_record['email_address'])
                tier_player.person_name = decode(tsv_record['person_name'])
                tier_player.reddit_handle = decode(tsv_record['reddit_handle'])
                tier_player.timezone = decode(tsv_record['time_zone'])
                pm.db_connector.get_session().add(tier_player)
    pm.db_connector.get_session().commit()

if __name__ == "__main__":
    c = ChallongeMatchCSVImporter(sys.argv[1])
    pm  = PersistenceManager( myapp.db_connector )
    challonge_user = os.getenv('CHALLONGE_USER')
    challonge_key  = os.getenv('CHALLONGE_API_KEY')
    ch = ChallongeHelper(challonge_user, challonge_key)
    league = pm.get_league( "X-Wing Vassal League Season Two")

    #create all the divisions for each tier
    create_divisions(c,pm,league)
    create_players(c, pm, ch, league)
    create_matchups(c, pm, ch, league)
开发者ID:timfreilly,项目名称:xwlists,代码行数:32,代码来源:season_two_manual_entry.py

示例3: decode

# 需要导入模块: from persistence import PersistenceManager [as 别名]
# 或者: from persistence.PersistenceManager import get_league [as 别名]
                if not divisions_href.has_key(division_name):
                    divisions_href[division_name] = pm.get_division(division_name)
                tier_player.division = divisions_href[division_name]

                tier_player.tier = tier_player.division.tier
                tier_player.challengeboards_handle = decode(tsv_record['challengeboards_name'])
                tier_player.challonge_id = player['id']
                print player['group_player_ids'][0]
                tier_player.group_id = player['group_player_ids'][0]
                tier_player.name = lookup_name
                tier_player.email_address = decode(tsv_record['email_address'])
                tier_player.person_name = decode(tsv_record['person_name'])
                tier_player.reddit_handle = decode(tsv_record['reddit_handle'])
                tier_player.timezone = decode(tsv_record['time_zone'])
                pm.db_connector.get_session().add(tier_player)
    pm.db_connector.get_session().commit()

if __name__ == "__main__":
    c = ChallongeMatchCSVImporter(sys.argv[1])
    pm  = PersistenceManager( myapp.db_connector )
    challonge_user = os.getenv('CHALLONGE_USER')
    challonge_key  = os.getenv('CHALLONGE_API_KEY')
    ch = ChallongeHelper(challonge_user, challonge_key)
    league = pm.get_league( "X-Wing Vassal League Season One")

    #create all the divisions for each tier
    create_divisions(c,pm)
    create_players(c, pm, ch, league)
    create_matchups(c, pm, ch, league)
开发者ID:chrisalleng,项目名称:xwlists,代码行数:31,代码来源:season_one_manual_entry.py


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