Return the innings file of a game with matching id.
514944
def get_innings(game_id):
    """"""
    year, month, day = get_date_from_game_id(game_id)
    try:
        return urlopen(INNINGS_URL.format(year, month, day, game_id))
    except HTTPError:
        raise ValueError('Could not find a game with that id.')
404537
def roster(team_id):
    """"""
    data = mlbgame.info.roster(team_id)
    return mlbgame.info.Roster(data)
152343
def parse_file_info(self, file_info):
        

        self.info["playback_time"] = file_info.playback_time
        self.info["match_id"] = file_info.game_info.dota.match_id
        self.info["game_mode"] = file_info.game_info.dota.game_mode
        self.info["game_winner"] = file_info.game_info.dota.game_winner

        for index, player in enumerate(file_info.game_info.dota.player_info):
            p = self.heroes[player.hero_name]
            p.name = player.player_name
            p.index = index
            p.team = 0 if index < 5 else 1

            self.indexed_players[index] = p
            self.info["players"][player.player_name] = p
661798
def print_scoreboard(self):
        """"""
        output = ''
        # parallel dictionaries with innings and scores
        innings = []
        away = []
        home = []
        for x in self:
            innings.append(x['inning'])
            away.append(x['away'])
            home.append(x['home'])
        # go through all the information and make a nice output
        # that looks like a scoreboard
        output += 'Inning\t'
        for x in innings:
            output += str(x) + ' '
        output += '\n'
        for x in innings:
            output += '---'
        output += '\nAway\t' + self.__enumerate_scoreboard(away)
        output += '\nHome\t' + self.__enumerate_scoreboard(home)
        return output
1109325
def _find(self, id_):
        
        cur = self._connection.cursor()
        cur.execute(
            'SELECT fileNumber, offset FROM sequences WHERE id = ?', (id_,))
        row = cur.fetchone()
        if row is None:
            return None
        else:
            return self._getFilename(row[0]), row[1]
1217007
def get(self, file_id: str) -> [typing.BinaryIO, str, datetime.datetime]:
        """"""
        raise NotImplementedError("Downloading files for downloading files in FileStore has not been implemented yet.")
1119205
def scoreboard(year, month, day, home=None, away=None):
    
    # get data
    data = mlbgame.data.get_scoreboard(year, month, day)
    # parse data
    parsed = etree.parse(data)
    root = parsed.getroot()
    games = {}
    output = {}
    # loop through games
    for game in root:
        if game.tag == 'data':
            return []
        # get team names
        teams = game.findall('team')
        home_name = teams[0].attrib['name']
        away_name = teams[1].attrib['name']
        # check if teams match parameters
        if (home_name == home and home is not None) \
                or (away_name == away and away is not None) \
                or (away is None and home is None):
            # throw all the data into a complicated dictionary
            game_tag = game.tag
            game_data = game.find('game')
            game_id = game_data.attrib['id']
            game_league = game_data.attrib['league']
            game_status = game_data.attrib['status']
            game_start_time = game_data.attrib['start_time']
            home_team_data = teams[0].find('gameteam')
            home_team = home_name
            home_team_runs = int(home_team_data.attrib['R'])
            home_team_hits = int(home_team_data.attrib['H'])
            home_team_errors = int(home_team_data.attrib['E'])
            away_team_data = teams[1].find('gameteam')
            away_team = away_name
            away_team_runs = int(away_team_data.attrib['R'])
            away_team_hits = int(away_team_data.attrib['H'])
            away_team_errors = int(away_team_data.attrib['E'])
            # check type of game
            if game_tag == 'go_game' or game_tag == 'ig_game':
                try:
                    w_pitcher_data = game.find('w_pitcher')
                    w_pitcher = w_pitcher_data.find('pitcher').attrib['name']
                    w_pitcher_wins = int(w_pitcher_data.attrib['wins'])
                    w_pitcher_losses = int(w_pitcher_data.attrib['losses'])
                except Exception:
                    w_pitcher = ""
                    w_pitcher_wins = 0
                    w_pitcher_losses = 0
                try:
                    l_pitcher_data = game.find('l_pitcher')
                    l_pitcher = l_pitcher_data.find('pitcher').attrib['name']
                    l_pitcher_wins = int(l_pitcher_data.attrib['wins'])
                    l_pitcher_losses = int(l_pitcher_data.attrib['losses'])
                except Exception:
                    l_pitcher = ""
                    l_pitcher_wins = 0
                    l_pitcher_losses = 0
                try:
                    sv_pitcher_data = game.find('sv_pitcher')
                    sv_pitcher = sv_pitcher_data.find('pitcher').attrib['name']
                    sv_pitcher_saves = int(sv_pitcher_data.attrib['saves'])
                except Exception:
                    sv_pitcher = ""
                    sv_pitcher_saves = 0
                output = {
                    'game_id': game_id,
                    'game_tag': game_tag,
                    'game_league': game_league,
                    'game_status': game_status,
                    'game_start_time': game_start_time,
                    'home_team': home_team,
                    'home_team_runs': home_team_runs,
                    'home_team_hits': home_team_hits,
                    'home_team_errors': home_team_errors,
                    'away_team': away_team,
                    'away_team_runs': away_team_runs,
                    'away_team_hits': away_team_hits,
                    'away_team_errors': away_team_errors,
                    'w_pitcher': w_pitcher,
                    'w_pitcher_wins': w_pitcher_wins,
                    'w_pitcher_losses': w_pitcher_losses,
                    'l_pitcher': l_pitcher,
                    'l_pitcher_wins': l_pitcher_wins,
                    'l_pitcher_losses': l_pitcher_losses,
                    'sv_pitcher': sv_pitcher,
                    'sv_pitcher_saves': sv_pitcher_saves
                }
            # games that were not played
            elif game_tag == 'sg_game':
                try:
                    p_pitcher_data = game.findall('p_pitcher')
                    p_pitcher_home_data = p_pitcher_data[0]
                    p_pitcher_home = p_pitcher_home_data.find(
                        'pitcher').attrib['name']
                    p_pitcher_home_wins = int(p_pitcher_home_data.
                                              attrib['wins'])
                    p_pitcher_home_losses = int(p_pitcher_home_data.
                                                attrib['losses'])
                    p_pitcher_away_data = p_pitcher_data[1]
                    p_pitcher_away = p_pitcher_away_data.find(
                        'pitcher').attrib['name']
                    p_pitcher_away_wins = int(p_pitcher_away_data.
                                              attrib['wins'])
                    p_pitcher_away_losses = int(p_pitcher_away_data.
                                                attrib['losses'])
                except Exception:
                    p_pitcher_home = ''
                    p_pitcher_home_wins = 0
                    p_pitcher_home_losses = 0
                    p_pitcher_away = ''
                    p_pitcher_away_wins = 0
                    p_pitcher_away_losses = 0
                output = {
                    'game_id': game_id,
                    'game_tag': game_tag,
                    'game_league': game_league,
                    'game_status': game_status,
                    'game_start_time': game_start_time,
                    'home_team': home_team,
                    'home_team_runs': home_team_runs,
                    'home_team_hits': home_team_hits,
                    'home_team_errors': home_team_errors,
                    'away_team': away_team,
                    'away_team_runs': away_team_runs,
                    'away_team_hits': away_team_hits,
                    'away_team_errors': away_team_errors,
                    'p_pitcher_home': p_pitcher_home,
                    'p_pitcher_home_wins': p_pitcher_home_wins,
                    'p_pitcher_home_losses': p_pitcher_home_losses,
                    'p_pitcher_away': p_pitcher_away,
                    'p_pitcher_away_wins': p_pitcher_away_wins,
                    'p_pitcher_away_losses': p_pitcher_away_losses
                }
            # put this dictionary into the larger dictionary
            games[game_id] = output
    return games
130562
def get_vs_ab
      results = []
      abs = get_game.get_atbats
      abs.each do |ab|
        if ab.pitcher_id == @pid
          results << ab
        end
      end
      results
    end
323131
def roster(team_id):
    """"""
    data = mlbgame.data.get_roster(team_id)
    parsed = json.loads(data.read().decode('utf-8'))
    players = parsed['roster_40']['queryResults']['row']
    return {'players': players, 'team_id': team_id}
407653
def get_match(session, match_id):
    """"""
    url = '{}{}/{}'.format(session.auth.base_url, MATCH_URL, match_id)
    parsed = make_scrape_request(session, url)
    game = parsed.find('h3').text
    if game != GAME_AOC:
        raise ValueError('not an aoc match')
    date_played = parsed.find(text=MATCH_DATE_PLAYED).find_next('td').text
    players = []
    colors = {}
    player_count = int(parsed.find('td', text='Players:').find_next('td').text)
    for div in parsed.find_all('div', style=True):
        if not div['style'].startswith('background-color:'):
            continue
        if len(players) == player_count:
            break
        username_elem = div.find_next('a', href=re.compile(PROFILE_PATH))
        username = username_elem.text
        color = div['style'].split(':')[1].split(';')[0].strip()
        colors[username] = color

        rec = None
        for dl_elem in parsed.find_all('a', href=re.compile('^/files/view')):
            rec_name = dl_elem.find('b', text=re.compile(username+'$'))
            if rec_name:
                rec = rec_name.parent

        user = parsed.find('a', text=username)
        if not user:
            # bugged match page
            continue
        user_id = int(user['href'].split('/')[-1])
        children = list(user.find_next('span').children)
        rate_after = None
        rate_before = None
        if str(children[0]).strip() == MATCH_NEW_RATE:
            rate_after = int(children[1].text)
            rate_before = rate_after - int(children[3].text)
        elif str(children[4]).strip() == MATCH_NEW_RATE:
            rate_after = int(children[5].text)
            rate_before = rate_after - int(children[3].text)
        players.append({
            'url': rec['href'] if rec else None,
            'id': user_id,
            'username': username,
            'color_id': COLOR_MAPPING.get(colors[username]),
            'rate_before': rate_before,
            'rate_after': rate_after
        })
    return {
        'timestamp': dateparser.parse(date_played),
        'players': players
    }
1086302
def get_film(film_id):
    '''  '''
    result = _get(film_id, settings.FILMS)
    return Film(result.content)
769211
def load_from_scoreboard(element)
        @away_innings = []
        @home_innings = []
        @scoreboard_game_id = element.attributes['id']
        @ampm = element.attributes['ampm']
        @venue = element.attributes['venue']
        @game_pk = element.attributes['game_pk']
        @time = element.attributes['time']
        @time_zone = element.attributes['time_zone']
        @game_type = element.attributes['game_type']
        @away_name_abbrev = element.attributes['away_name_abbrev']
        @home_name_abbrev = element.attributes['home_name_abbrev']
        @away_code = element.attributes['away_code']
        @away_file_code = element.attributes['away_file_code']
        @away_team_id = element.attributes['away_team_id']
        @away_team_city = element.attributes['away_team_city']
        @away_team_name = element.attributes['away_team_name']
        @away_division = element.attributes['away_division']
        @home_code = element.attributes['home_code']
        @home_file_code = element.attributes['home_file_code']
        @home_team_id = element.attributes['home_team_id']
        @home_team_city = element.attributes['home_team_city']
        @home_team_name = element.attributes['home_team_name']
        @home_division = element.attributes['home_division']
        @day = element.attributes['day']
        @gameday_sw = element.attributes['gameday_sw']
        @away_games_back = element.attributes['away_games_back']
        @home_games_back = element.attributes['home_games_back']
        @away_games_back_wildcard = element.attributes['away_games_back_wildcard']
        @home_games_back_wildcard = element.attributes['home_games_back_wildcard']
        @venue_w_chan_loc = element.attributes['venue_w_chan_loc']
        @gameday = element.attributes['gameday']
        @away_win = element.attributes['away_win']
        @away_loss = element.attributes['away_loss']
        @home_win = element.attributes['home_win']
        @home_loss = element.attributes['home_loss']
        @league = element.attributes['league']
      
        set_status(element)
        set_innings(element)
        set_totals(element)
        set_pitchers(element)
        set_homeruns(element)
      end
796941
def get_batters(home_or_away)
      if self.gid
        bs = get_boxscore
        if home_or_away == 'away'
        	bs.batters[0]
        else
          bs.batters[1]
        end
      else
        puts "No data for input specified"
      end
    end
906028
def get_capture(self):
        """"""
        # game
        game_image = self._game_image_from_screen('capture')
        if game_image is None:
            return
        # board
        board = self._board_from_game_image(game_image)
        if board is None:
            return
        if board.is_empty():
            return
        return board
636232
def get_volume(self, id):
        
        # If the id is actually a path
        if exists(id):
            with open(id) as file:
                size = os.lseek(file.fileno(), 0, os.SEEK_END)
            return {'path': id, 'size': size}
        return self.volume.get(id)
738692
def team_stats(game_id):
    
    # get data from data module
    box_score = mlbgame.data.get_box_score(game_id)
    raw_box_score = mlbgame.data.get_raw_box_score(game_id)
    # parse XML
    box_score_tree = etree.parse(box_score).getroot()
    raw_box_score_tree = etree.parse(raw_box_score).getroot()
    # get pitching and batting ingo
    pitching = box_score_tree.findall('pitching')
    batting = box_score_tree.findall('batting')
    # dictionary for output
    output = {}
    output = __team_stats_info(pitching, output, 'pitching')
    output = __team_stats_info(batting, output, 'batting')
    output = __raw_team_stats_info(raw_box_score_tree, output)
    return output
331580
def get_innings
      if @innings.length == 0
        inn_count = get_num_innings
        (1..get_num_innings).each do |inn|
          inning = Inning.new
          inning.load_from_id(@gid, inn)
          @innings << inning
        end
      end
      @innings
    end