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

from collections.abc import Iterator, MutableMapping
from typing import Any, Final
from streamlit.elements.lib.utils import Key
from streamlit.runtime.metrics_util import gather_metrics
from streamlit.runtime.state.safe_session_state import SafeSessionState

_LOGGER: Final = ...
_state_use_warning_already_displayed: bool = ...
_mock_session_state: SafeSessionState | None = ...
def get_session_state() -> SafeSessionState:
    """Get the SessionState object for the current session.

    Note that in streamlit scripts, this function should not be called
    directly. Instead, SessionState objects should be accessed via
    st.session_state.
    """
    ...

class SessionStateProxy(MutableMapping[Key, Any]):
    """A stateless singleton that proxies `st.session_state` interactions
    to the current script thread's SessionState instance.

    The proxy API differs slightly from SessionState: it does not allow
    callers to get, set, or iterate over "keyless" widgets (that is, widgets
    that were created without a user_key, and have autogenerated keys).
    """
    def __iter__(self) -> Iterator[Any]:
        """Iterator over user state and keyed widget values."""
        ...
    
    def __len__(self) -> int:
        """Number of user state and keyed widget values in session_state."""
        ...
    
    def __str__(self) -> str:
        """String representation of user state and keyed widget values."""
        ...
    
    def __getitem__(self, key: Key) -> Any:
        """Return the state or widget value with the given key.

        Raises
        ------
        StreamlitAPIException
            If the key is not a valid SessionState user key.
        """
        ...
    
    @gather_metrics("session_state.set_item")
    def __setitem__(self, key: Key, value: Any) -> None:
        """Set the value of the given key.

        Raises
        ------
        StreamlitAPIException
            If the key is not a valid SessionState user key.
        """
        ...
    
    def __delitem__(self, key: Key) -> None:
        """Delete the value with the given key.

        Raises
        ------
        StreamlitAPIException
            If the key is not a valid SessionState user key.
        """
        ...
    
    def __getattr__(self, key: str) -> Any:
        ...
    
    @gather_metrics("session_state.set_attr")
    def __setattr__(self, key: str, value: Any) -> None:
        ...
    
    def __delattr__(self, key: str) -> None:
        ...
    
    def to_dict(self) -> dict[str, Any]:
        """Return a dict containing all session_state and keyed widget values."""
        ...
    


