Repository: pandas-dev/pandas
File: pandas/core/arrays/interval.py (Python)

Code before:
                # Union[bool, int, float, complex, str, bytes]]]"
                return np.isin(left, right).ravel()

            elif needs_i8_conversion(self.left.dtype) ^ needs_i8_conversion(
                values.left.dtype
            ):
                # not comparable -> no overlap
                return np.zeros(self.shape, dtype=bool)

        return isin(self.astype(object), values.astype(object))

    @property
    def _combined(self) -> IntervalSide:
        # error: Item "ExtensionArray" of "ExtensionArray | ndarray[Any, Any]"
        # has no attribute "reshape"  [union-attr]
        left = self.left._values.reshape(-1, 1)  # type: ignore[union-attr]
        right = self.right._values.reshape(-1, 1)  # type: ignore[union-attr]
        if needs_i8_conversion(left.dtype):
            # error: Item "ndarray[Any, Any]" of "Any | ndarray[Any, Any]" has
            # no attribute "_concat_same_type"
            comb = left._concat_same_type(  # type: ignore[union-attr]
                [left, right], axis=1
            )
            comb = comb.view("complex128")[:, 0]
        else:
            comb = (np.array(left.ravel(), dtype=complex)) + (
                1j * np.array(right.ravel(), dtype=complex)
            )
        return comb

    def _from_combined(self, combined: np.ndarray) -> IntervalArray:
        """
        Create a new IntervalArray with our dtype from a 1D complex128 ndarray.
        """

        dtype = self._left.dtype
        if needs_i8_conversion(dtype):
            nc = combined.view("i8").reshape(-1, 2)
            assert isinstance(self._left, (DatetimeArray, TimedeltaArray))
            new_left: DatetimeArray | TimedeltaArray | np.ndarray = type(
                self._left
            )._from_sequence(nc[:, 0], dtype=dtype)
            assert isinstance(self._right, (DatetimeArray, TimedeltaArray))
            new_right: DatetimeArray | TimedeltaArray | np.ndarray = type(
                self._right
            )._from_sequence(nc[:, 1], dtype=dtype)
        else:
            assert isinstance(dtype, np.dtype)
            new_left = np.real(combined).astype(dtype).ravel()
            new_right = np.imag(combined).astype(dtype).ravel()
        return self._shallow_copy(left=new_left, right=new_right)

Review comment (suggestion):
can you make dtype="complex128" explicit here?  i dont want to be surprised if we accidentally get complex64 in some builds

Code after:
        objects and NA can be inserted into an IntervalIndex

        Parameters
        ----------
        loc : int
        item : Interval

        Returns
        -------
        IntervalArray
        """
        left_insert, right_insert = self._validate_scalar(item)

        new_left = self.left.insert(loc, left_insert)
        new_right = self.right.insert(loc, right_insert)

        return self._shallow_copy(new_left, new_right)

    def delete(self, loc) -> Self:
        new_left: np.ndarray | DatetimeArray | TimedeltaArray
        new_right: np.ndarray | DatetimeArray | TimedeltaArray
        if isinstance(self._left, np.ndarray):
            new_left = np.delete(self._left, loc)
            assert isinstance(self._right, np.ndarray)
            new_right = np.delete(self._right, loc)
        else:
            new_left = self._left.delete(loc)
            assert not isinstance(self._right, np.ndarray)
            new_right = self._right.delete(loc)
        return self._shallow_copy(left=new_left, right=new_right)

    def repeat(
        self,
        repeats: int | Sequence[int],
        axis: AxisInt | None = None,
    ) -> Self:
        """
        Repeat elements of a IntervalArray.

        Returns a new IntervalArray where each element of the current IntervalArray
        is repeated consecutively a given number of times.

        Parameters
        ----------
        repeats : int or array of ints
            The number of repetitions for each element. This should be a
            non-negative integer. Repeating 0 times will return an empty
            IntervalArray.
        axis : None
            Must be ``None``. Has no effect but is accepted for compatibility
            with numpy.