Returns the current skill rating of the player for a specified gamemode,
        default gamemode is solo
195160
def player_skill(self, player_handle, game_mode='solo'):
        """"""
        if game_mode not in constants.GAME_MODES:
            raise APIException("game_mode must be one of: solo, duo, squad, all")
        try:
            data = self._get_player_profile(player_handle)
            player_stats = {}
            return_data = []
            for stat in data['Stats']:
                if stat['Match'] == game_mode:
                    for datas in stat['Stats']:
                        if datas['label'] == 'Rating':
                            player_stats[stat['Region']] = datas['value']
            return player_stats
        except BaseException as error:
            print('Unhandled exception: ' + str(error))
            raise
285037
def rating_score(obj, user):
    
    if not user.is_authenticated() or not hasattr(obj, '_ratings_field'):
        return False

    ratings_descriptor = getattr(obj, obj._ratings_field)
    try:
        rating = ratings_descriptor.get(user=user).score
    except ratings_descriptor.model.DoesNotExist:
        rating = None

    return rating
892972
def report_player(player)
      result = {}
      plugins.each {|each| result.merge!(each.report(player))}
      result
    end
1358857
def GameActionModeEnum(ctx):
    """"""
    return Enum(
        ctx,
        diplomacy=0,
        speed=1,
        instant_build=2,
        quick_build=4,
        allied_victory=5,
        cheat=6,
        unk0=9,
        spy=10,
        unk1=11,
        farm_queue=13,
        farm_unqueue=14,
        default=Pass
    )
228286
def get_projected_player_game_stats_by_player(self, season, week, player_id):
        
        result = self._method_call("PlayerGameProjectionStatsByPlayerID/{season}/{week}/{player_id}", "projections", season=season, week=week, player_id=player_id)
        return result
1092474
def get_projected_player_game_stats_by_week(self, season, week):
        
        result = self._method_call("PlayerGameProjectionStatsByWeek/{season}/{week}", "projections", season=season, week=week)
        return result
274236
public function majRankPointGame()
    {
        $players = $this->findBy(array(), array('pointGame' => 'DESC'));

        Ranking::addObjectRank($players, 'rankPointGame', array('pointGame'));
        $this->getEntityManager()->flush();
    }
1077789
function(){
            // Compute team Wins, Losts, Draws and Goal-Sum
            /*
                // Uses the key as the teamId
                {
                         1: {P: x, S: y, [...]},
                    teamId: {P: x, S: y, [...]}
                 }
            */
            var rawTable = {};
            var _default = {rank: 0, teamId: 0, P: 0, goalsMade: 0, goalsTaken: 0, S: 0, W: 0, D: 0, L: 0, score: 0};

            for(var k in this.matches){
                var match = this.matches[k];

                // Compute game points for both teams
                computeGame(match, match.teamAId, match.teamAScore, match.teamBScore);
                computeGame(match, match.teamBId, match.teamBScore, match.teamAScore);
            }

            // Adds game to the teamId. Should be runned twice for each
            // side of match (teamA and teamB).
            function computeGame(match, teamId, goalsMade, goalsTaken){
                // Skip empty id's
                if(!teamId)
                    return;

                // Generate default template if NOT in array yet
                if(!rawTable[teamId]){
                    var teamRow = _.clone(_default);
                    // Keeps team id under team
                    teamRow.teamId = teamId;
                    // Inserts team in rawTable
                    rawTable[teamId] = teamRow;
                }

                // Get teamRow (it is supposed to exist)
                var teamRow = rawTable[teamId];

                // Compute points ONLY if match is not 'scheduled'
                // logycaly, it's 'ended' or 'playing', so we compute it
                if(match.state == 'scheduled')
                    return;

                // Increment Plays
                teamRow.P++;

                // Compute goals made/taken
                teamRow.goalsMade += goalsMade*1;
                teamRow.goalsTaken += goalsTaken*1;

                // Win
                if(goalsMade > goalsTaken)
                    teamRow.W ++;
                // Loose
                else if(goalsMade < goalsTaken)
                    teamRow.L ++;
                // Drew
                else
                    teamRow.D ++;
            }

            // Compute 'final score' and add column S (goalsMade:goalsTaken)
            // Transfer data to final table array
            var finalTable = [];
            _.forEach(rawTable, function(row){
                row.score = row.W*3 + row.D*1;
                row.S = row.goalsMade*1 + ':' + row.goalsTaken*1;
                row.GD = row.goalsMade*1 - row.goalsTaken*1;

                finalTable.push(row);
            });

            // Sort by 'score' field
            finalTable = _.sortBy(finalTable, 'score').reverse();

            // Rank Table
            var pos = 0;
            var lastScore = -1;

            _.forEach(finalTable, function(row){
                // Keeps the same ranking if scores is the same
                if(lastScore != row.score){
                    pos++;
                    lastScore = row.score;
                }

                row.rank = pos;
            });


            return finalTable;


        }
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
    }
199823
def get_player_stats(self, player_key, board_key):
        
        player_stats_url = self.api_path + 'player/' + player_key + '/league/' + board_key + '/stats/'
        response = self.get_response(player_stats_url)
        return response
1182153
def get_players_game_stats_for_season_for_week(self, season, week, season_type="REG"):
        
        try:
            season = int(season)
            week = int(week)
            if season_type not in ["REG", "PRE", "POST"]:
                raise ValueError
        except (TypeError, ValueError):
            raise FantasyDataError('Error: Invalid method parameters')

        season_param = "{0}{1}".format(season, season_type)
        result = self._method_call("PlayerGameStatsByWeek/{season}/{week}", "stats", season=season_param, week=week)
        return result
339755
def get_global_achievement_percentages_for_app(self, gameID, format=None):
        
        parameters = {'gameid' : gameID}
        if format is not None:
            parameters['format'] = format
        url = self.create_request_url(self.interface,
            'GetGlobalAchievementPercentagesForApp', 2, parameters)
        data = self.retrieve_request(url)
        return self.return_data(data, format=format)
953986
def rank(self, item):
        ''''''
        score = self._dict.get(item)
        if score is not None:
            return self._sl.rank(score)
760655
def percentage_played(self):
    ''''''
    played = self.object_dict.get('UserData', {}).get('PlaybackPositionTicks')
    total  = self.object_dict.get('RunTimeTicks') or 1
    return (played or 0)/total
205147
async def selfplay(state, flagfile='selfplay'):
  

  output_dir = os.path.join(fsdb.selfplay_dir(), state.output_model_name)
  holdout_dir = os.path.join(fsdb.holdout_dir(), state.output_model_name)

  lines = await run(
      'bazel-bin/cc/selfplay',
      '--flagfile={}.flags'.format(os.path.join(FLAGS.flags_dir, flagfile)),
      '--model={}'.format(state.best_model_path),
      '--output_dir={}'.format(output_dir),
      '--holdout_dir={}'.format(holdout_dir),
      '--seed={}'.format(state.seed))
  result = '\n'.join(lines[-6:])
  logging.info(result)
  stats = parse_win_stats_table(result, 1)[0]
  num_games = stats.total_wins
  logging.info('Black won %0.3f, white won %0.3f',
               stats.black_wins.total / num_games,
               stats.white_wins.total / num_games)

  # Write examples to a single record.
  pattern = os.path.join(output_dir, '*', '*.zz')
  random.seed(state.seed)
  tf.set_random_seed(state.seed)
  np.random.seed(state.seed)
  # TODO(tommadams): This method of generating one golden chunk per generation
  # is sub-optimal because each chunk gets reused multiple times for training,
  # introducing bias. Instead, a fresh dataset should be uniformly sampled out
  # of *all* games in the training window before the start of each training run.
  buffer = example_buffer.ExampleBuffer(sampling_frac=1.0)

  # TODO(tommadams): parallel_fill is currently non-deterministic. Make it not
  # so.
  logging.info('Writing golden chunk from "{}"'.format(pattern))
  buffer.parallel_fill(tf.gfile.Glob(pattern))
  buffer.flush(os.path.join(fsdb.golden_chunk_dir(),
                            state.output_model_name + '.tfrecord.zz'))
429815
def brier_skill_score(self):
        
        reliability, resolution, uncertainty = self.brier_score_components()
        return (resolution - reliability) / uncertainty
1027992
def load_gamemodes(self):
        """"""

        stats = yield from self._fetch_statistics("secureareapvp_matchwon", "secureareapvp_matchlost", "secureareapvp_matchplayed",
                                                  "secureareapvp_bestscore", "rescuehostagepvp_matchwon", "rescuehostagepvp_matchlost",
                                                  "rescuehostagepvp_matchplayed", "rescuehostagepvp_bestscore", "plantbombpvp_matchwon",
                                                  "plantbombpvp_matchlost", "plantbombpvp_matchplayed", "plantbombpvp_bestscore",
                                                  "generalpvp_servershacked", "generalpvp_serverdefender", "generalpvp_serveraggression",
                                                  "generalpvp_hostagerescue", "generalpvp_hostagedefense")

        self.gamemodes = {x: Gamemode(x) for x in GamemodeNames}
        for name in self.gamemodes:
            statname, gamemode = name + "pvp_", self.gamemodes[name]

            gamemode.best_score = stats.get(statname + "bestscore", 0)
            gamemode.lost = stats.get(statname + "matchlost", 0)
            gamemode.won = stats.get(statname + "matchwon", 0)
            gamemode.played = stats.get(statname + "matchplayed", 0)

            if name == "securearea":
                gamemode.areas_secured = stats.get("generalpvp_servershacked", 0)
                gamemode.areas_defended = stats.get("generalpvp_serverdefender", 0)
                gamemode.areas_contested = stats.get("generalpvp_serveraggression", 0)
            elif name == "rescuehostage":
                gamemode.hostages_rescued = stats.get("generalpvp_hostagerescue", 0)
                gamemode.hostages_defended = stats.get("generalpvp_hostagedefense", 0)



        return self.gamemodes