Sets a piece at the given square.

        An existing piece is replaced. Setting *piece* to ``None`` is
        equivalent to :func:`~chess.Board.remove_piece_at()`.
432819
def set_piece_at(self, square: Square, piece: Optional[Piece], promoted: bool = False) -> None:
        
        if piece is None:
            self._remove_piece_at(square)
        else:
            self._set_piece_at(square, piece.piece_type, piece.color, promoted)
380404
def piece_at(self, square: Square) -> Optional[Piece]:
        """"""
        piece_type = self.piece_type_at(square)
        if piece_type:
            mask = BB_SQUARES[square]
            color = bool(self.occupied_co[WHITE] & mask)
            return Piece(piece_type, color)
        else:
            return None
205434
def remove(self, square: Square) -> None:
        
        mask = BB_SQUARES[square]
        if self.mask & mask:
            self.mask ^= mask
        else:
            raise KeyError(square)
758854
def remove(self, attr, item):
        
        return self.set(attr, operation.Remove([item]))
1260527
def update(self, move):
        
        if move is None:
            raise TypeError("Move cannot be type None")

        if self.king_loc_dict is not None and isinstance(move.piece, King):
            self.king_loc_dict[move.color] = move.end_loc

        # Invalidates en-passant
        for square in self:
            pawn = square
            if isinstance(pawn, Pawn):
                pawn.just_moved_two_steps = False

        # Sets King and Rook has_moved property to True is piece has moved
        if type(move.piece) is King or type(move.piece) is Rook:
            move.piece.has_moved = True

        elif move.status == notation_const.MOVEMENT and \
                isinstance(move.piece, Pawn) and \
                fabs(move.end_loc.rank - move.start_loc.rank) == 2:
            move.piece.just_moved_two_steps = True

        if move.status == notation_const.KING_SIDE_CASTLE:
            self.move_piece(Location(move.end_loc.rank, 7), Location(move.end_loc.rank, 5))
            self.piece_at_square(Location(move.end_loc.rank, 5)).has_moved = True

        elif move.status == notation_const.QUEEN_SIDE_CASTLE:
            self.move_piece(Location(move.end_loc.rank, 0), Location(move.end_loc.rank, 3))
            self.piece_at_square(Location(move.end_loc.rank, 3)).has_moved = True

        elif move.status == notation_const.EN_PASSANT:
            self.remove_piece_at_square(Location(move.start_loc.rank, move.end_loc.file))

        elif move.status == notation_const.PROMOTE or \
                move.status == notation_const.CAPTURE_AND_PROMOTE:
            try:
                self.remove_piece_at_square(move.start_loc)
                self.place_piece_at_square(move.promoted_to_piece(move.color, move.end_loc), move.end_loc)
            except TypeError as e:
                raise ValueError("Promoted to piece cannot be None in Move {}\n{}".format(repr(move), e))
            return

        self.move_piece(move.piece.location, move.end_loc)
471478
func (b *Board) Piece(sq Square) Piece {
	for _, p := range allPieces {
		bb := b.bbForPiece(p)
		if bb.Occupied(sq) {
			return p
		}
	}
	return NoPiece
}
437566
def set_rectangle(self, rectangle):
        
        if rectangle == self.rectangle():
            return False

        if rectangle is None:
            self.reset()
        else:
            self.start_point = QgsPointXY(
                rectangle.xMinimum(), rectangle.yMinimum())
            self.end_point = QgsPointXY(
                rectangle.xMaximum(), rectangle.yMaximum())
            self.show_rectangle(self.start_point, self.end_point)
        return True
1084515
def set(self, section, option, value=None):
        
        try:
            section = self.__getitem__(section)
        except KeyError:
            raise NoSectionError(section) from None
        option = self.optionxform(option)
        if option in section:
            section[option].value = value
        else:
            section[option] = value
        return self
856237
def get_piece(self, piece_type, input_color):
        
        for loc in self:
            piece = self.piece_at_square(loc)

            if not self.is_square_empty(loc) and \
                    isinstance(piece, piece_type) and \
                    piece.color == input_color:
                return loc

        raise Exception("{} \nPiece not found: {}".format(self, piece_type))
916965
function(key, value) {
        this._removeRemove(this.sets.remove, key);
        var op = this._getOp(this.sets.removes, key);
        if (op) {
            op.remove.push(value);
        } else {
            this.sets.removes.push({key: key, remove: [value]});
        }
        return this;
    }
1013199
def set(bit)
      quotient = bit >> 3
      remainder = bit & 0x7
      mask = 0x80 >> remainder

      raise "Bit #{bit} out of range of bitfield with length #{length}" if quotient >= @data.length
      @data[quotient] |= mask
    end
509946
def set_item(self,item):
        ""
        self.item = self.x.process_one(item)
        yield None
        self.item = None
900868
def dims_knight(self, move):
    ''''''
    if self.board.piece_type_at(move.from_square) == chess.KNIGHT:
      rim = SquareSet(
          chess.BB_RANK_1 | \
          chess.BB_RANK_8 | \
          chess.BB_FILE_A | \
          chess.BB_FILE_H)
      return move.to_square in rim
1102526
def setPieceRequested(pieceIndex, bool)
      if bool
        @requestedPieces.set pieceIndex
        @pieceRequestTime[pieceIndex] = Time.new
      else
        @requestedPieces.clear pieceIndex
        @pieceRequestTime[pieceIndex] = nil
      end
    end
1110160
def set(self, value, start=None, stop=None):
		""""""
		_check_start_stop(start, stop)
		# start_index, stop_index will denote the sections we are replacing
		start_index = self._bisect_left(start)
		if start is not None:  # start_index == 0
			prev_value = self._values[start_index - 1]
			if prev_value == value:
				# We're setting a range where the left range has the same
				# value, so create one big range
				start_index -= 1
				start = self._keys[start_index]
		if stop is None:
			new_keys = [start]
			new_values = [value]
			stop_index = len(self._keys)
		else:
			stop_index = self._bisect_right(stop)
			stop_value = self._values[stop_index - 1]
			stop_key = self._keys[stop_index - 1]
			if stop_key == stop and stop_value == value:
				new_keys = [start]
				new_values = [value]
			else:
				new_keys = [start, stop]
				new_values = [value, stop_value]
		self._keys[start_index:stop_index] = new_keys
		self._values[start_index:stop_index] = new_values
929494
def set_empty(self, row, column):
        
        subplot = self.get_subplot_at(row, column)
        subplot.set_empty()
1011447
def set(self, name, value):
        
        flag = self.flags[name]
        self._value = (self.value | flag) if value else (self.value & ~flag)