Gets the box score information for the game with matching id.
969494
def box_score(game_id):
    """"""
    # get data
    data = mlbgame.data.get_box_score(game_id)
    # parse data
    parsed = etree.parse(data)
    root = parsed.getroot()
    linescore = root.find('linescore')
    result = dict()
    result['game_id'] = game_id
    # loop through innings and add them to output
    for x in linescore:
        inning = x.attrib['inning']
        home = value_to_int(x.attrib, 'home')
        away = value_to_int(x.attrib, 'away')
        result[int(inning)] = {'home': home, 'away': away}
    return result
1083870
def load_from_id(gid)
      @gid = gid
      @rosters = []
      @umpires = {}
      @xml_data = GamedayFetcher.fetch_players(gid)
      @xml_doc = REXML::Document.new(@xml_data)
      if @xml_doc.root
        self.set_rosters
        self.set_umpires
      end
    end
1283071
def get_score
      results = []
      ls = get_boxscore.linescore
      results << ls.away_team_runs
      results << ls.home_team_runs
      results
    end
398828
def score(ID, sign, lon):
    
    info = getInfo(sign, lon)
    dignities = [dign for (dign, objID) in info.items() if objID == ID]
    return sum([SCORES[dign] for dign in dignities])
1093780
def broadcast_info(team_id, date=datetime.now()):
    """"""
    year = date.year
    game_date = date.strftime('%Y-%m-%dT00:00:00')
    data = mlbgame.data.get_broadcast_info(team_id, year)
    schedule = json.loads(data.read().decode('utf-8'))
    schedule = schedule['mlb_broadcast_info']['queryResults']['row']
    return [g for g in schedule if g['game_date'] == game_date]
430605
def keep_everything_scorer(checked_ids):
    """"""
    result = checked_ids.keys()
    for i in checked_ids.values():
        result.extend(i.keys())
    return dict.fromkeys(result).keys()
573321
def overview(game_id):
    """"""
    output = {}
    # get data
    overview = mlbgame.data.get_overview(game_id)
    # parse data
    overview_root = etree.parse(overview).getroot()

    try:
        output = add_raw_box_score_attributes(output, game_id)
    except ValueError:
        pass

    # get overview attributes
    for x in overview_root.attrib:
        output[x] = overview_root.attrib[x]

    # Get probable starter attributes if they exist
    home_pitcher_tree = overview_root.find('home_probable_pitcher')
    if home_pitcher_tree is not None:
        output.update(build_namespaced_attributes(
            'home_probable_pitcher', home_pitcher_tree))
    else:
        output.update(build_probable_starter_defaults('home'))

    away_pitcher_tree = overview_root.find('away_probable_pitcher')
    if away_pitcher_tree is not None:
        output.update(build_namespaced_attributes(
            'away_probable_pitcher', away_pitcher_tree))
    else:
        output.update(build_probable_starter_defaults('away'))

    return output
1063582
function (id) {
  var b = id.s
    , r = id.r
    , g = id.m
    , p = this.p;

  // knockouts / special finals
  if (b >= this.last) { // greater than case is for BF in long single elimination
    if (b === WB && this.isLong && r === p - 1) {
      // if bronze final, move loser to "LBR1" at mirror pos of WBGF
      return [gId(LB, 1, 1), (g + 1) % 2];
    }
    if (b === LB && r === 2*p - 1 && this.isLong) {
      // if double final, then loser moves to the bottom
      return [gId(LB, 2 * p, 1), 1];
    }
    // otherwise always KO'd if loosing in >= last bracket
    return null;
  }

  // WBR1 always feeds into LBR1 as if it were WBR2
  if (r === 1) {
    return [gId(LB, 1, Math.floor((g+1)/2)), g % 2];
  }

  if (this.downMix) {
    // always drop on top when downmixing
    return [gId(LB, (r-1)*2, mixLbGames(p, r, g)), 0];
  }

  // normal  LB drops: on top for (r>2) and (r<=2 if odd g) to match bracket movement
  var pos = (r > 2 || $.odd(g)) ? 0 : 1;
  return [gId(LB, (r-1)*2, g), pos];
}
59562
def player_stats(game_id):
    """"""
    # get information for that game
    data = mlbgame.stats.player_stats(game_id)
    return mlbgame.stats.Stats(data, game_id, True)
61815
def get_recently_played_games(self, steamID, count=0, format=None):
        
        parameters = {'steamid' : steamID, 'count' : count}
        if format is not None:
            parameters['format'] = format
        url = self.create_request_url(self.interface, 'GetRecentlyPlayedGames', 1,
            parameters)
        data = self.retrieve_request(url)
        return self.return_data(data, format=format)
783570
def __get_league_object():
    """"""
    # get data
    data = mlbgame.data.get_properties()
    # return league object
    return etree.parse(data).getroot().find('leagues').find('league')
910929
def _get_game_type_des(cls, game_type):
        
        if game_type == 'S':
            return 'Spring Training'
        elif game_type == 'R':
            return 'Regular Season'
        elif game_type == 'F':
            return 'Wild-card Game'
        elif game_type == 'D':
            return 'Divisional Series'
        elif game_type == 'L':
            return 'LCS'
        elif game_type == 'W':
            return 'World Series'
        return MlbamConst.UNKNOWN_FULL
278190
def dataframe(self):
        
        # If both the runs scored and allowed are None, the game hasn't been
        # played yet, and the DataFrame should be None.
        if self._runs_allowed is None and self._runs_scored is None:
            return None
        fields_to_include = {
            'attendance': self.attendance,
            'boxscore_index': self.boxscore_index,
            'date': self.date,
            'datetime': self.datetime,
            'game_number_for_day': self.game_number_for_day,
            'day_or_night': self.day_or_night,
            'game': self.game,
            'game_duration': self.game_duration,
            'games_behind': self.games_behind,
            'innings': self.innings,
            'location': self.location,
            'loser': self.loser,
            'opponent_abbr': self.opponent_abbr,
            'rank': self.rank,
            'record': self.record,
            'result': self.result,
            'runs_allowed': self.runs_allowed,
            'runs_scored': self.runs_scored,
            'save': self.save,
            'streak': self.streak,
            'winner': self.winner
        }
        return pd.DataFrame([fields_to_include], index=[self._boxscore])
1240091
def get_ranked_players():
    """"""

    rankings_page = requests.get(RANKINGS_URL)
    root = etree.HTML(rankings_page.text)
    player_rows = root.xpath('//div[@id="ranked"]//tr')

    for row in player_rows[1:]:
        player_row = row.xpath('td[@class!="country"]//text()')
        yield _Player(
            name=player_row[1],
            country=row[1][0].get('title'),
            triple_crowns=player_row[3],
            monthly_win=player_row[4],
            biggest_cash=player_row[5],
            plb_score=player_row[6],
            biggest_score=player_row[7],
            average_score=player_row[8],
            previous_rank=player_row[9],
        )
935139
def get_game_high_scores(self, *args, **kwargs):
        """"""
        return get_game_high_scores(*args, **self._merge_overrides(**kwargs)).run()
879072
public function getNbGameWIthScore() {
    $query = \Drupal::entityQuery('game')
      ->condition('day', $this->id())
      ->condition('score_team_1', NULL, 'IS NOT')
      ->condition('score_team_2', NULL, 'IS NOT');
    $ids = $query->execute();
    return \count($ids);
  }
1190879
def _get_retro_id(cls, home_team_id, timestamp, game_number):
        
        return '{home_team_id}{year}{month}{day}{game_number}'.format(
            **{
                'home_team_id': home_team_id.upper(),
                'year': timestamp.year,
                'month': timestamp.strftime('%m'),
                'day': timestamp.strftime('%d'),
                'game_number': int(game_number)-1,
            }
        )