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

from abc import abstractmethod
from typing import NamedTuple, Protocol, TYPE_CHECKING, runtime_checkable
from streamlit.proto.openmetrics_data_model_pb2 import Metric as MetricProto

if TYPE_CHECKING:
    ...
class CacheStat(NamedTuple):
    """Describes a single cache entry.

    Properties
    ----------
    category_name : str
        A human-readable name for the cache "category" that the entry belongs
        to - e.g. "st.memo", "session_state", etc.
    cache_name : str
        A human-readable name for cache instance that the entry belongs to.
        For "st.memo" and other function decorator caches, this might be the
        name of the cached function. If the cache category doesn't have
        multiple separate cache instances, this can just be the empty string.
    byte_length : int
        The entry's memory footprint in bytes.
    """
    category_name: str
    cache_name: str
    byte_length: int
    def to_metric_str(self) -> str:
        ...
    
    def marshall_metric_proto(self, metric: MetricProto) -> None:
        """Fill an OpenMetrics `Metric` protobuf object."""
        ...
    


def group_stats(stats: list[CacheStat]) -> list[CacheStat]:
    """Group a list of CacheStats by category_name and cache_name and sum byte_length."""
    ...

@runtime_checkable
class CacheStatsProvider(Protocol):
    @abstractmethod
    def get_stats(self) -> list[CacheStat]:
        ...
    


class StatsManager:
    def __init__(self) -> None:
        ...
    
    def register_provider(self, provider: CacheStatsProvider) -> None:
        """Register a CacheStatsProvider with the manager.
        This function is not thread-safe. Call it immediately after
        creation.
        """
        ...
    
    def get_stats(self) -> list[CacheStat]:
        """Return a list containing all stats from each registered provider."""
        ...
    


