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

from typing import Any, Callable, Final, TypeVar, overload
from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
from streamlit.proto.PageProfile_pb2 import Command

_LOGGER: Final = ...
_MAX_TRACKED_COMMANDS: Final = ...
_MAX_TRACKED_PER_COMMAND: Final = ...
_OBJECT_NAME_MAPPING: Final = ...
_ATTRIBUTIONS_TO_CHECK: Final = ...
_ETC_MACHINE_ID_PATH = ...
_DBUS_MACHINE_ID_PATH = ...
class Installation:
    _instance_lock = ...
    _instance: Installation | None = ...
    @classmethod
    def instance(cls) -> Installation:
        """Returns the singleton Installation."""
        ...
    
    def __init__(self) -> None:
        ...
    
    def __repr__(self) -> str:
        ...
    
    @property
    def installation_id(self): # -> str:
        ...
    


def to_microseconds(seconds: float) -> int:
    """Convert seconds into microseconds."""
    ...

F = TypeVar("F", bound=Callable[..., Any])
@overload
def gather_metrics(name: str, func: F) -> F:
    ...

@overload
def gather_metrics(name: str, func: None = ...) -> Callable[[F], F]:
    ...

def gather_metrics(name: str, func: F | None = ...) -> Callable[[F], F] | F:
    """Function decorator to add telemetry tracking to commands.

    Parameters
    ----------
    func : callable
    The function to track for telemetry.

    name : str or None
    Overwrite the function name with a custom name that is used for telemetry tracking.

    Example
    -------
    >>> @st.gather_metrics
    ... def my_command(url):
    ...     return url

    >>> @st.gather_metrics(name="custom_name")
    ... def my_command(url):
    ...     return url
    """
    ...

def create_page_profile_message(commands: list[Command], exec_time: int, prep_time: int, uncaught_exception: str | None = ...) -> ForwardMsg:
    """Create and return the full PageProfile ForwardMsg."""
    ...

