Renumber the players according to the supplied hash. Return self.
421765
def renumber(map)
      @members.each_with_index do |pnum, index|
        raise "player number #{pnum} not found in renumbering hash" unless map[pnum]
        @members[index] = map[pnum]
      end
      self
    end
1145943
def rename_with_num(self, prefix="", new_path=None, remove_desc=True):
        """"""
        # Temporary path #
        if new_path is None: numbered = self.__class__(new_temp_path())
        else:                numbered = self.__class__(new_path)
        # Generator #
        def numbered_iterator():
            for i,read in enumerate(self):
                read.id  = prefix + str(i)
                read.seq = read.seq.upper()
                if remove_desc: read.description = ""
                yield read
        # Do it #
        numbered.write(numbered_iterator())
        numbered.close()
        # Replace it #
        if new_path is None:
            os.remove(self.path)
            shutil.move(numbered, self.path)
        return numbered
273659
def renumber(criterion = :rank)
      if (criterion.class == Hash)
        # Undocumentted feature - supply your own hash.
        map = criterion
      else
        # Official way of reordering.
        map = Hash.new

        # Renumber by rank only if possible.
        criterion = criterion.to_s.downcase
        if criterion == 'rank'
          begin check_ranks rescue criterion = 'name' end
        end

        # Decide how to renumber.
        if criterion == 'rank'
          # Renumber by rank.
          @player.values.each{ |p| map[p.num] = p.rank }
        elsif criterion == 'order'
          # Just keep the existing numbers in order.
          @player.values.sort_by{ |p| p.num }.each_with_index{ |p, i| map[p.num] = i + 1 }
        else
          # Renumber by name alphabetically.
          @player.values.sort_by{ |p| p.name }.each_with_index{ |p, i| map[p.num] = i + 1 }
        end
      end

      # Apply renumbering.
      @teams.each{ |t| t.renumber(map) }
      @player = @player.values.inject({}) do |hash, player|
        player.renumber(map)
        hash[player.num] = player
        hash
      end

      # Return self for chaining.
      self
    end
423559
def parse_players
      s0 = @current_pos
      parse_comments
      s2 = @current_pos
      if match_str("N+") != :failed
        s4 = parse_nonls
        if parse_nl != :failed
          @reported_pos = s2
          s2 = s4
        else
          @current_pos = s2
          s2 = :failed
        end
      else
        @current_pos = s2
        s2 = :failed
      end
      s2 = nil if s2 == :failed
      parse_comments
      s4 = @current_pos
      if match_str("N-") != :failed
        s6 = parse_nonls
        if parse_nl != :failed
          @reported_pos = s4
          s4 = s6
        else
          @current_pos = s4
          s4 = :failed
        end
      else
        @current_pos = s4
        s4 = :failed
      end
      s4 = nil if s4 == :failed
      @reported_pos = s0
      s0 = [(s2 ? s2.join : nil), (s4 ? s4.join : nil)]
      s0
    end
109822
def batch_run_many(player, positions, batch_size=100):
    """"""
    prob_list = []
    value_list = []
    for idx in range(0, len(positions), batch_size):
        probs, values = player.network.run_many(positions[idx:idx + batch_size])
        prob_list.append(probs)
        value_list.append(values)
    return np.concatenate(prob_list, axis=0), np.concatenate(value_list, axis=0)
590786
def per_participant_count

      per_participant.remap { |(k, v), h| h[k] = v.size }
    end
753606
def playerSurrendered(cfg):
    """"""
    if cfg.numAgents + cfg.numBots == 2:
          otherResult = c.RESULT_VICTORY
    else: otherResult = c.RESULT_UNDECIDED # if multiple players remain, they need to finish the match
    return assignValue(cfg, c.RESULT_DEFEAT, otherResult)
774247
def renumber(self):
        """"""

        num = 0
        for cell in self.cells:
            cell_split = cell.splitlines()
            if len(cell_split) >= 2:
                num += 1
                cell_split[0] = str(num)
                yield '\n'.join(cell_split)
574551
def p5list(num):
    """"""

    from .website.pocketfives import get_ranked_players

    format_str = '{:>4.4}   {!s:<15.13}{!s:<18.15}{!s:<9.6}{!s:<10.7}'\
                 '{!s:<14.11}{!s:<12.9}{!s:<12.9}{!s:<12.9}{!s:<4.4}'

    click.echo(format_str.format(
        'Rank' , 'Player name', 'Country', 'Triple', 'Monthly', 'Biggest cash',
        'PLB score', 'Biggest s', 'Average s', 'Prev'
    ))
    # just generate the appropriate number of underlines and cut them with format_str
    underlines = ['-' * 20] * 10
    click.echo(format_str.format(*underlines))

    for ind, player in enumerate(get_ranked_players()):
        click.echo(format_str.format(str(ind + 1) + '.', *player))
        if ind == num - 1:
            break
255070
def update_results(self, results):
        '''
        
        '''

        if not results:
            raise PickerResultException('Results unavailable')

        if results['sequence'] != self.sequence or results['season'] != self.season:
            raise PickerResultException('Results not updated, wrong season or week')

        completed = {g['home']: g for g in results['games'] if g['status'].startswith('F')}
        if not completed:
            return (0, None)

        count = 0
        for game in self.games.incomplete(home__abbr__in=completed.keys()):
            result = completed.get(game.home.abbr, None)
            if result:
                winner = result['winner']
                game.winner = (
                    game.home if game.home.abbr == winner
                    else game.away if game.away.abbr == winner else None
                )
                count += 1

        last_game = self.last_game
        if not self.points and last_game.winner:
            now = datetime_now()
            if now > last_game.end_time:
                result = completed.get(last_game.home.abbr, None)
                if result:
                    self.points = result['home_score'] + result['away_score']
                    self.save()

        if count:
            self.update_pick_status()

        return (count, self.points)
1131321
def _renumber(a: np.ndarray, keys: np.ndarray, values: np.ndarray) -> np.ndarray:
	
	ordering = np.argsort(keys)
	keys = keys[ordering]
	values = keys[ordering]
	index = np.digitize(a.ravel(), keys, right=True)
	return(values[index].reshape(a.shape))
745698
def users=(users_hash)
      client_principal.users = Hash[users_hash.map { |k, v| [k, v.sort] } ]
    end
654550
def revrank v
      ret = redis.zrevrank rediskey, to_redis(v)
      ret.nil? ? nil : ret.to_i
    end
449306
def add_player(player)
      raise "invalid player" unless player.class == ICU::Player
      raise "player number (#{player.num}) should be unique" if @player[player.num]
      @player[player.num] = player
    end
939516
def rehash(self, password):
        """"""
        self.hash = self._new(password, self.desired_rounds)
        self.rounds = self.desired_rounds
1308910
def renumber(map)
      raise "result player number #{@player} not found in renumbering hash" unless map[@player]
      self.player = map[@player]
      if @opponent
        raise "result opponent number #{@opponent} not found in renumbering hash" unless map[@opponent]
        old_rateable = @rateable
        self.opponent = map[@opponent]
        self.rateable = old_rateable  # because setting the opponent has a side-effect which is undesirable in this context
      end
      self
    end
766098
def hash(self):
        '''
        
        '''
        hashed = super(Calculated, self).hash()
        return khash(hashed, self._field_name)