def transform_qubits(
        self, qubit_map: dict[cirq.Qid, cirq.Qid] | Callable[[cirq.Qid], cirq.Qid]
    ) -> cirq.Circuit:
        """Returns the same circuit, but with different qubits.

        This function will return a new `Circuit` with the same gates but
        with qubits mapped according to the argument.

        For example, the following will translate LineQubits to GridQubits:

        >>> grid_qubits = cirq.GridQubit.square(2)
        >>> line_qubits = cirq.LineQubit.range(4)
        >>> circuit = cirq.Circuit([cirq.H(q) for q in line_qubits])
        >>> circuit.transform_qubits(lambda q : grid_qubits[q.x])
        cirq.Circuit([
            cirq.Moment(
                cirq.H(cirq.GridQubit(0, 0)),
                cirq.H(cirq.GridQubit(0, 1)),
                cirq.H(cirq.GridQubit(1, 0)),
                cirq.H(cirq.GridQubit(1, 1)),
            ),
        ])

        Args:
            qubit_map: A function or a dict mapping each current qubit into a desired
                new qubit.

        Returns:
            The receiving circuit but with qubits transformed by the given
                function.

        Raises:
            TypeError: If `qubit_function` is not a function or a dict.
        """
        if callable(qubit_map):
            transform = qubit_map
        elif isinstance(qubit_map, dict):
            transform = lambda q: qubit_map.get(q, q)
        else:
            raise TypeError('qubit_map must be a function or dict mapping qubits to qubits.')

        op_list = [
            Moment(operation.transform_qubits(transform) for operation in moment.operations)
            for moment in self._moments
        ]

        return Circuit(op_list)
Returns the same circuit, but with different qubits.

        This function will return a new `Circuit` with the same gates but
        with qubits mapped according to the argument.

        For example, the following will translate LineQubits to GridQubits:

        >>> grid_qubits = cirq.GridQubit.square(2)
        >>> line_qubits = cirq.LineQubit.range(4)
        >>> circuit = cirq.Circuit([cirq.H(q) for q in line_qubits])
        >>> circuit.transform_qubits(lambda q : grid_qubits[q.x])
        cirq.Circuit([
            cirq.Moment(
                cirq.H(cirq.GridQubit(0, 0)),
                cirq.H(cirq.GridQubit(0, 1)),
                cirq.H(cirq.GridQubit(1, 0)),
                cirq.H(cirq.GridQubit(1, 1)),
            ),
        ])

        Args:
            qubit_map: A function or a dict mapping each current qubit into a desired
                new qubit.

        Returns:
            The receiving circuit but with qubits transformed by the given
                function.

        Raises:
            TypeError: If `qubit_function` is not a function or a dict.
        
cirq-core/cirq/circuits/circuit.py