"""
This type stub file was generated by pyright.
"""

from typing import Final, TYPE_CHECKING, TypeVar
from streamlit.elements.lib.layout_utils import WidthWithoutContent
from streamlit.proto.Exception_pb2 import Exception as ExceptionProto
from streamlit.runtime.metrics_util import gather_metrics
from streamlit.delta_generator import DeltaGenerator

if TYPE_CHECKING:
    ...
_LOGGER: Final = ...
_GENERIC_UNCAUGHT_EXCEPTION_TEXT: Final = ...
class ExceptionMixin:
    @gather_metrics("exception")
    def exception(self, exception: BaseException, width: WidthWithoutContent = ...) -> DeltaGenerator:
        """Display an exception.

        When accessing the app through ``localhost``, in the lower-right corner
        of the exception, Streamlit displays links to Google and ChatGPT that
        are prefilled with the contents of the exception message.

        Parameters
        ----------
        exception : Exception
            The exception to display.
        width : int or "stretch"
            The desired width of the exception expressed in pixels. If this is
            ``"stretch"`` (default), Streamlit sets the width of the exception
            to match the width of the parent container. Otherwise, this must be
            an integer. If the specified width is greater than the width of the
            parent container, Streamlit sets the width of the exception to
            match the width of the parent container.

        Example
        -------
        >>> import streamlit as st
        >>>
        >>> e = RuntimeError("This is an exception of type RuntimeError")
        >>> st.exception(e)

        .. output ::
            https://doc-status-exception.streamlit.app/
            height: 220px

        """
        ...
    
    @property
    def dg(self) -> DeltaGenerator:
        """Get our DeltaGenerator."""
        ...
    


def marshall(exception_proto: ExceptionProto, exception: BaseException, width: WidthWithoutContent = ..., is_uncaught_app_exception: bool = ...) -> None:
    """Marshalls an Exception.proto message.

    Parameters
    ----------
    exception_proto : Exception.proto
        The Exception protobuf to fill out.

    exception : BaseException
        The exception whose data we're extracting.

    width : int or "stretch"
        The width of the exception display. Can be either an integer (pixels) or "stretch".
        Defaults to "stretch".

    is_uncaught_app_exception: bool
        The exception originates from an uncaught error during script execution.
    """
    ...

T = TypeVar("T")
