L iddlmZddlmZmZmZddlmZmZddl m Z ddl m Z ddlmZmZer ddlmZddlmZd d ZGd d Zy )) annotations) TYPE_CHECKINGLiteralcast)StreamlitAPIExceptionStreamlitValueError)Toast)gather_metrics) clean_textvalidate_icon_or_emoji)DeltaGenerator) SupportsStrc8t|dk(r td|S)Nz6Toast body cannot be blank - please provide a message.)strr) toast_texts ^/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/streamlit/elements/toast.py validate_textrs& :"# D   cReZdZedddd ddZeddZy) ToastMixintoastNshort)icondurationcLt}tt||_t ||_|dvst |tr4|dkDr/|dk(rd|_n0|dk(rd|_n#|dk(rd|_n||_ntdgd |jjd |S) uDisplay a short message, known as a notification "toast". The toast appears in the app's top-right corner and disappears after four seconds. .. warning:: ``st.toast`` is not compatible with Streamlit's `caching `_ and cannot be called within a cached function. Parameters ---------- body : str The string to display as GitHub-flavored Markdown. Syntax information can be found at: https://github.github.com/gfm. See the ``body`` parameter of |st.markdown|_ for additional, supported Markdown directives. .. |st.markdown| replace:: ``st.markdown`` .. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown icon : str, None An optional emoji or icon to display next to the alert. If ``icon`` is ``None`` (default), no icon is displayed. If ``icon`` is a string, the following options are valid: - A single-character emoji. For example, you can set ``icon="🚨"`` or ``icon="🔥"``. Emoji short codes are not supported. - An icon from the Material Symbols library (rounded style) in the format ``":material/icon_name:"`` where "icon_name" is the name of the icon in snake case. For example, ``icon=":material/thumb_up:"`` will display the Thumb Up icon. Find additional icons in the `Material Symbols `_ font library. duration : "short", "long", "infinite", or int The time to display the toast message. This can be one of the following: - ``"short"`` (default): Displays for 4 seconds. - ``"long"``: Displays for 10 seconds. - ``"infinite"``: Shows the toast until the user dismisses it. - An integer: Displays for the specified number of seconds. Examples -------- **Example 1: Show a toast message** >>> import streamlit as st >>> >>> st.toast("Your edited image was saved!", icon="😍") .. output:: https://doc-status-toast.streamlit.app height: 200px **Example 2: Show multiple toasts** When multiple toasts are generated, they will stack. Hovering over a toast will stop it from disappearing. When hovering ends, the toast will disappear after time specified in ``duration``. >>> import time >>> import streamlit as st >>> >>> if st.button("Three cheers"): >>> st.toast("Hip!") >>> time.sleep(0.5) >>> st.toast("Hip!") >>> time.sleep(0.5) >>> st.toast("Hooray!", icon="🎉") .. output:: https://doc-status-toast1.streamlit.app height: 300px **Example 3: Update a toast message** Toast messages can also be updated. Assign ``st.toast(my_message)`` to a variable and use the ``.toast()`` method to update it. If a toast has already disappeared or been dismissed, the update will not be seen. >>> import time >>> import streamlit as st >>> >>> def cook_breakfast(): >>> msg = st.toast("Gathering ingredients...") >>> time.sleep(1) >>> msg.toast("Cooking...") >>> time.sleep(1) >>> msg.toast("Ready!", icon="🥞") >>> >>> if st.button("Cook breakfast"): >>> cook_breakfast() .. output:: https://doc-status-toast2.streamlit.app height: 200px )rlonginfiniterrr rr)rrrza positive integerr) ToastProtor rbodyr r isinstanceintrrdg_enqueue)selfr"rr toast_protos rrzToastMixin.toast&s\!l %mD&9: 1$7  4 4 x %(Q,7"'( $V#') $Z''( $'/ $%O ww55rctd|S)zGet our DeltaGenerator.r )r)r's rr%z ToastMixin.dgs$d++r)r"rrz str | Nonerz*Literal['short', 'long', 'infinite'] | intreturnr )r*r )__name__ __module__ __qualname__r rpropertyr%rrrr%sbG  ?F A6A6 A6 = A6  A6A6F,,rrN)rrr*r) __future__rtypingrrrstreamlit.errorsrrstreamlit.proto.Toast_pb2r r!streamlit.runtime.metrics_utilr streamlit.string_utilr r streamlit.delta_generatorr streamlit.type_utilrrrr/rrr8s6#//G99D8/H,H,r