Esempio n. 1
0
def main(player_id, player_ids):
    site = pwb.Site()
    always = False
    error_count = 0
    page_count = 0

    if (player_id):
        player = Player.load_one(player_id)  # Load player from blaseball-mike
        (page_count, error_count, always) = wiki_edit(player, site, always, error_count, page_count, None, None, False)

    elif (player_ids):
        ids_list = player_ids.split(',')
        for player_id in ids_list:
            player = Player.load_one(player_id)  # Load player from blaseball-mike
            (page_count, error_count, always) = wiki_edit(player, site, always, error_count, page_count, None, None, False)
    else:
        teams = Team.load_all()

        for team in teams.values():
            if team.nickname == 'Shoe Thieves':
                for batter in team.lineup:
                    (page_count, error_count, always) = wiki_edit(batter, site, always, error_count, page_count, team.full_name, 'Batter', False)

                for pitcher in team.rotation:
                    (page_count, error_count, always) = wiki_edit(pitcher, site, always, error_count, page_count, team.full_name, 'Pitcher', False)

                # for batter in team.bench:
                #     (page_count, error_count, always) = wiki_edit(batter, site, always, error_count, page_count, team.full_name, 'Batter', True)

                # for pitcher in team.bullpen:
                #     (page_count, error_count, always) = wiki_edit(pitcher, site, always, error_count, page_count, team.full_name, 'Pitcher', True)

    print(f'Updated {page_count} pages. Error count: {error_count}.')
Esempio n. 2
0
 def test_load_all(self):
     teams = Team.load_all()
     assert isinstance(teams, dict)
     assert len(teams) > 0
     for key, team in teams.items():
         assert isinstance(key, str)
         assert isinstance(team, Team)
         assert key == team.id
def main():
    print("Creating map of team nicknames to full team names")
    all_teams = Team.load_all()
    
    names = {}
    for t in all_teams:
        team = all_teams[t]
        short_name = team.nickname
        long_name = team.full_name
        names[short_name] = long_name
    
    with open(OUTPUT_FILE, 'w') as f:
        json.dump(names, f)
Esempio n. 4
0
from blaseball_mike.models import Team
from blaseball_mike.models import Game

teams = Team.load_all()
games = []

NUM_SEASONS = 14
for i in range(1, NUM_SEASONS + 1):
    games.append(Game.load_by_season(i))

print(len(games))