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

from typing import Any, Callable, Final, Union
from typing_extensions import TypeAlias
from streamlit.errors import StreamlitAPIException
from streamlit.runtime.caching.cache_type import CacheType

"""Hashing for st.cache_data and st.cache_resource."""
_LOGGER: Final = ...
_PANDAS_ROWS_LARGE: Final = ...
_PANDAS_SAMPLE_SIZE: Final = ...
_NP_SIZE_LARGE: Final = ...
_NP_SAMPLE_SIZE: Final = ...
HashFuncsDict: TypeAlias = dict[Union[str, type[Any]], Callable[[Any], Any]]
_CYCLE_PLACEHOLDER: Final = ...
class UserHashError(StreamlitAPIException):
    def __init__(self, orig_exc, object_to_hash, hash_func, cache_type: CacheType | None = ...) -> None:
        ...
    


def update_hash(val: Any, hasher, cache_type: CacheType, hash_source: Callable[..., Any] | None = ..., hash_funcs: HashFuncsDict | None = ...) -> None:
    """Updates a hashlib hasher with the hash of val.

    This is the main entrypoint to hashing.py.
    """
    ...

class _HashStack:
    """Stack of what has been hashed, for debug and circular reference detection.

    This internally keeps 1 stack per thread.

    Internally, this stores the ID of pushed objects rather than the objects
    themselves because otherwise the "in" operator inside __contains__ would
    fail for objects that don't return a boolean for "==" operator. For
    example, arr == 10 where arr is a NumPy array returns another NumPy array.
    This causes the "in" to crash since it expects a boolean.
    """
    def __init__(self) -> None:
        ...
    
    def __repr__(self) -> str:
        ...
    
    def push(self, val: Any): # -> None:
        ...
    
    def pop(self): # -> None:
        ...
    
    def __contains__(self, val: Any): # -> bool:
        ...
    
    def pretty_print(self) -> str:
        ...
    


class _HashStacks:
    """Stacks of what has been hashed, with at most 1 stack per thread."""
    def __init__(self) -> None:
        ...
    
    def __repr__(self) -> str:
        ...
    
    @property
    def current(self) -> _HashStack:
        ...
    


hash_stacks = ...
class _CacheFuncHasher:
    """A hasher that can hash objects with cycles."""
    def __init__(self, cache_type: CacheType, hash_funcs: HashFuncsDict | None = ...) -> None:
        ...
    
    def __repr__(self) -> str:
        ...
    
    def to_bytes(self, obj: Any) -> bytes:
        """Add memoization to _to_bytes and protect against cycles in data structures."""
        ...
    
    def update(self, hasher, obj: Any) -> None:
        """Update the provided hasher with the hash of an object."""
        ...
    


class NoResult:
    """Placeholder class for return values when None is meaningful."""
    ...


