Returns an array of Inning objects that represent each inning of the game
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
1208179
def players(self, postgame, game_type):
        """"""
        for i, attributes in self._players():
            yield self._parse_player(i, attributes, postgame, game_type)
552370
public function toArray(): array
    {
        return [
            'score_mode' => $this->scoreMode,
            'score_strategies' => array_map(function (ScoreStrategy $scoreStrategy) {
                return $scoreStrategy->toArray();
            }, $this->scoreStrategies),
        ];
    }
723592
def load_from_id(gid)
      @gid = gid
      @xml_data = GamedayFetcher.fetch_boxscore(gid)
      @xml_doc = REXML::Document.new(@xml_data)
      if @xml_doc.root
        @game = Game.new(@gid)
        @game.boxscore = self
        set_basic_info
        @linescore = LineScore.new
        @linescore.init(@xml_doc.root.elements["linescore"])
        @home_runs = @linescore.home_team_runs
        @away_runs = @linescore.away_team_runs
        @game_info = @xml_doc.root.elements["game_info"].text
  	    set_batting_text
        set_cities
        set_pitchers
        set_batters
        set_weather
      end
    end
534443
def get_leadoff_hitters_by_year(year)
      results = []
      games = all_games(year)
      games.each do |game|
        boxscore = game.get_boxscore
        leadoffs = boxscore.get_leadoff_hitters
        if game.home_team_abbrev == @abrev
          results << leadoffs[1]
        else
          results << leadoffs[0]
        end
      end
      results
    end
652264
def dataframe(self):
        
        if self._away_runs is None and self._home_runs is None:
            return None
        fields_to_include = {
            'date': self.date,
            'time': self.time,
            'venue': self.venue,
            'attendance': self.attendance,
            'duration': self.duration,
            'time_of_day': self.time_of_day,
            'winner': self.winner,
            'winning_name': self.winning_name,
            'winning_abbr': self.winning_abbr,
            'losing_name': self.losing_name,
            'losing_abbr': self.losing_abbr,
            'away_at_bats': self.away_at_bats,
            'away_runs': self.away_runs,
            'away_hits': self.away_hits,
            'away_rbi': self.away_rbi,
            'away_earned_runs': self.away_earned_runs,
            'away_bases_on_balls': self.away_bases_on_balls,
            'away_strikeouts': self.away_strikeouts,
            'away_plate_appearances': self.away_plate_appearances,
            'away_batting_average': self.away_batting_average,
            'away_on_base_percentage': self.away_on_base_percentage,
            'away_slugging_percentage': self.away_slugging_percentage,
            'away_on_base_plus': self.away_on_base_plus,
            'away_pitches': self.away_pitches,
            'away_strikes': self.away_strikes,
            'away_win_probability_for_offensive_player':
            self.away_win_probability_for_offensive_player,
            'away_average_leverage_index': self.away_average_leverage_index,
            'away_win_probability_added': self.away_win_probability_added,
            'away_win_probability_subtracted':
            self.away_win_probability_subtracted,
            'away_base_out_runs_added': self.away_base_out_runs_added,
            'away_putouts': self.away_putouts,
            'away_assists': self.away_assists,
            'away_innings_pitched': self.away_innings_pitched,
            'away_home_runs': self.away_home_runs,
            'away_strikes_by_contact': self.away_strikes_by_contact,
            'away_strikes_swinging': self.away_strikes_swinging,
            'away_strikes_looking': self.away_strikes_looking,
            'away_grounded_balls': self.away_grounded_balls,
            'away_fly_balls': self.away_fly_balls,
            'away_line_drives': self.away_line_drives,
            'away_unknown_bat_type': self.away_unknown_bat_type,
            'away_game_score': self.away_game_score,
            'away_inherited_runners': self.away_inherited_runners,
            'away_inherited_score': self.away_inherited_score,
            'away_win_probability_by_pitcher':
            self.away_win_probability_by_pitcher,
            'away_base_out_runs_saved': self.away_base_out_runs_saved,
            'home_at_bats': self.home_at_bats,
            'home_runs': self.home_runs,
            'home_hits': self.home_hits,
            'home_rbi': self.home_rbi,
            'home_earned_runs': self.home_earned_runs,
            'home_bases_on_balls': self.home_bases_on_balls,
            'home_strikeouts': self.home_strikeouts,
            'home_plate_appearances': self.home_plate_appearances,
            'home_batting_average': self.home_batting_average,
            'home_on_base_percentage': self.home_on_base_percentage,
            'home_slugging_percentage': self.home_slugging_percentage,
            'home_on_base_plus': self.home_on_base_plus,
            'home_pitches': self.home_pitches,
            'home_strikes': self.home_strikes,
            'home_win_probability_for_offensive_player':
            self.home_win_probability_for_offensive_player,
            'home_average_leverage_index': self.home_average_leverage_index,
            'home_win_probability_added': self.home_win_probability_added,
            'home_win_probability_subtracted':
            self.home_win_probability_subtracted,
            'home_base_out_runs_added': self.home_base_out_runs_added,
            'home_putouts': self.home_putouts,
            'home_assists': self.home_assists,
            'home_innings_pitched': self.home_innings_pitched,
            'home_home_runs': self.home_home_runs,
            'home_strikes_by_contact': self.home_strikes_by_contact,
            'home_strikes_swinging': self.home_strikes_swinging,
            'home_strikes_looking': self.home_strikes_looking,
            'home_grounded_balls': self.home_grounded_balls,
            'home_fly_balls': self.home_fly_balls,
            'home_line_drives': self.home_line_drives,
            'home_unknown_bat_type': self.home_unknown_bat_type,
            'home_game_score': self.home_game_score,
            'home_inherited_runners': self.home_inherited_runners,
            'home_inherited_score': self.home_inherited_score,
            'home_win_probability_by_pitcher':
            self.home_win_probability_by_pitcher,
            'home_base_out_runs_saved': self.home_base_out_runs_saved
        }
        return pd.DataFrame([fields_to_include], index=[self._uri])
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
670290
def broadcast_info(team_id, date=datetime.now()):
    """"""
    data = mlbgame.info.broadcast_info(team_id, date)
    return [mlbgame.info.BroadcastInfo(x) for x in data]
783570
def __get_league_object():
    """"""
    # get data
    data = mlbgame.data.get_properties()
    # return league object
    return etree.parse(data).getroot().find('leagues').find('league')
982571
def _read_objects(cls, soup, game):
        
        players = Players()
        players.game = Players.Game()
        # game data
        players.game.venue = soup.game['venue']
        players.game.date = soup.game['date']
        # players & team data
        for team in soup.find_all('team'):
            team_object = cls._get_team(team)
            if team['type'] == Game.TEAM_TYPE_HOME:
                # team data(home)
                players.home_team = team_object
            elif team['type'] == Game.TEAM_TYPE_AWAY:
                # team data(away)
                players.away_team = team_object
            # player data
            players.rosters.update(
                    {player['id']: cls.Player(player, game.retro_game_id) for player in team.find_all('player')}
            )
            # coach data
            players.coaches.update(
                    {coach['id']: cls.Coach(coach, game.retro_game_id, team_object) for coach in team.find_all('coach')}
            )
        # umpire data
        umpires = soup.find('umpires')
        players.umpires.update(
                {umpire['id']: cls.Umpire(umpire, game.retro_game_id) for umpire in umpires.find_all('umpire')}
        )
        return players
1116078
def _get_pitch(self, soup, pa):
        
        pitches = []
        ball_tally, strike_tally = 0, 0
        for pitch in soup.find_all('pitch'):
            # pitching result
            pitch = Pitch.row(pitch, pa, pitches, ball_tally, strike_tally)
            pitches.append(pitch)
            # ball count
            ball_tally, strike_tally = RetroSheet.ball_count(ball_tally, strike_tally, pitch['pitch_res'])
        return pitches
422638
function getPlayerCounters(player, attacker, game) {
  return player.hand
    .map((card) => {
      return card.validCounters ? card.validCounters(player, attacker, game) : []
    })
    .reduce((acc, array) => {
      return acc.concat(array)
    }, [])
    .sort((counterA, counterB) => counterB.weight - counterA.weight)
}
670528
def _inning_actions(self, soup, inning_number, inning_id):
        
        # at bat(batter box data) & pitching data
        for act in soup.find_all('action'):
            self.actions.append(InningAction.action(act, self.game, self.players.rosters, inning_number, inning_id))
972346
def get_pitches(pid)
      results = []
      atbats = get_atbats
      atbats.each do |ab|
        if ab.pitcher_id == pid
          results << ab.pitches
        end
      end
      results.flatten
    end
468151
def set_pitchers
      @pitchers, away_pitchers, home_pitchers = [], [], []
      count = 1
      @xml_doc.elements.each("boxscore/pitching[@team_flag='away']/pitcher") { |element| 
        pitcher = PitchingAppearance.new
        pitcher.init(@gid, element, count)
        count += 1
        away_pitchers.push pitcher
      }   
      count = 1
      @xml_doc.elements.each("boxscore/pitching[@team_flag='home']/pitcher") { |element| 
        pitcher = PitchingAppearance.new
        pitcher.init(@gid, element, count)
        count += 1
        home_pitchers.push pitcher
      }   
      @pitchers << away_pitchers
      @pitchers << home_pitchers
    end
1109336
def get_pitches
      results = []
      ab = get_vs_ab
      ab.each do |ab|
        results << ab.pitches
      end
      results.flatten
    end
903023
public function leagues(): array
    {
        $curlClient = curl_init(self::BASE_URL . self::LEAGUES_URL);
        curl_setopt($curlClient, CURLOPT_HTTPHEADER, $this->_curlHeader);
        curl_setopt($curlClient, CURLOPT_RETURNTRANSFER, true);
        $results = json_decode(curl_exec($curlClient), true);
        $leagues = [];
        foreach ($results['items'] as $result) {
            $leagues[] = League::create($result);
        }
        return $leagues;
    }