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

from typing import Any, Final, TYPE_CHECKING
from streamlit.errors import StreamlitAPIWarning
from streamlit.runtime.state import WidgetCallback
from collections.abc import Sequence
from streamlit.delta_generator import DeltaGenerator

if TYPE_CHECKING:
    ...
_LOGGER: Final = ...
def check_callback_rules(dg: DeltaGenerator, on_change: WidgetCallback | None) -> None:
    """Ensures that widgets other than `st.form_submit_button` within a form don't have
    an on_change callback set.

    Raises
    ------
    StreamlitInvalidFormCallbackError:
        Raised when the described rule is violated.
    """
    ...

_shown_default_value_warning: bool = ...
def check_session_state_rules(default_value: Any, key: str | None, writes_allowed: bool = ...) -> None:
    """Ensures that no values are set for widgets with the given key when writing
    is not allowed.

    Additionally, if `global.disableWidgetStateDuplicationWarning` is False a warning is
    shown when a widget has a default value but its value is also set via session state.

    Raises
    ------
    StreamlitAPIException:
        Raised when the described rule is violated.
    """
    ...

class CachedWidgetWarning(StreamlitAPIWarning):
    def __init__(self) -> None:
        ...
    


def check_cache_replay_rules() -> None:
    """Check if a widget is allowed to be used in the current context.
    More specifically, this checks if the current context is inside a
    cached function that disallows widget usage. If so, it raises a warning.

    If there are other similar checks in the future, we could extend this
    function to check for those as well. And rename it to check_widget_usage_rules.
    """
    ...

def check_fragment_path_policy(dg: DeltaGenerator): # -> None:
    """Ensures that the current widget is not written outside of the
    fragment's delta path.

    Should be called by ever element that acts as a widget.
    We don't allow writing widgets from within a widget to the outside path
    because it can lead to unexpected behavior. For elements, this is okay
    because they do not trigger a re-run.
    """
    ...

def check_widget_policies(dg: DeltaGenerator, key: str | None, on_change: WidgetCallback | None = ..., *, default_value: Sequence[Any] | Any | None = ..., writes_allowed: bool = ..., enable_check_callback_rules: bool = ...): # -> None:
    """Check all widget policies for the given DeltaGenerator."""
    ...

def maybe_raise_label_warnings(label: str | None, label_visibility: str | None): # -> None:
    ...

