
    gQ                    t    d dl mZ d dlmZmZ d dlmZ d dlm	Z	 d dl
mZ erd dlmZ d dlmZ  G d d	      Zy
)    )annotations)TYPE_CHECKINGcast)Code)gather_metrics)
clean_text)DeltaGenerator)SupportsStrc                  `    e Zd Z ed      	 ddddd	 	 	 	 	 	 	 	 	 	 	 dd       Zed	d       Zy)
	CodeMixincodeFN)line_numbers
wrap_linesheightc                   t               }t        |      |_        |xs d|_        ||_        ||_        |r||_        | j                  j                  d|      S )a~	  Display a code block with optional syntax highlighting.

        Parameters
        ----------
        body : str
            The string to display as code or monospace text.

        language : str or None
            The language that the code is written in, for syntax highlighting.
            This defaults to ``"python"``. If this is ``None``, the code will
            be plain, monospace text.

            For a list of available ``language`` values, see
            `react-syntax-highlighter
            <https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_PRISM.MD>`_
            on GitHub.

        line_numbers : bool
            An optional boolean indicating whether to show line numbers to the
            left of the code block. This defaults to ``False``.

        wrap_lines : bool
            An optional boolean indicating whether to wrap lines. This defaults
            to ``False``.

        height : int or None
            Desired height of the code block expressed in pixels. If ``height``
            is ``None`` (default), Streamlit sets the element's height to fit
            its content. Vertical scrolling within the element is enabled when
            the height does not accomodate all lines.

        Examples
        --------
        >>> import streamlit as st
        >>>
        >>> code = '''def hello():
        ...     print("Hello, Streamlit!")'''
        >>> st.code(code, language="python")

        .. output ::
            https://doc-code.streamlit.app/
            height: 220px

        >>> import streamlit as st
        >>> code = '''Is it a crown or boat?
        ...                         ii
        ...                       iiiiii
        ... WWw                 .iiiiiiii.                ...:
        ...  WWWWWWw          .iiiiiiiiiiii.         ........
        ...   WWWWWWWWWWw    iiiiiiiiiiiiiiii    ...........
        ...    WWWWWWWWWWWWWWwiiiiiiiiiiiiiiiii............
        ...     WWWWWWWWWWWWWWWWWWwiiiiiiiiiiiiii.........
        ...      WWWWWWWWWWWWWWWWWWWWWWwiiiiiiiiii.......
        ...       WWWWWWWWWWWWWWWWWWWWWWWWWWwiiiiiii....
        ...        WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwiiii.
        ...           -MMMWWWWWWWWWWWWWWWWWWWWWWMMM-
        ... '''
        >>> st.code(code, language=None)

        .. output ::
            https://doc-code-ascii.streamlit.app/
            height: 380px
        	plaintextr   )		CodeProtor   	code_textlanguageshow_line_numbersr   r   dg_enqueue)selfbodyr   r   r   r   
code_protos          L/var/www/openai/venv/lib/python3.12/site-packages/streamlit/elements/code.pyr   zCodeMixin.code   sX    R [
)$/
&5+
'3
$ *
 &Jww
33    c                    t        d|       S )zGet our DeltaGenerator.r	   )r   )r   s    r   r   zCodeMixin.dgo   s     $d++r   )python)r   r
   r   z
str | Noner   boolr   r    r   z
int | Nonereturnr	   )r!   r	   )__name__
__module____qualname__r   r   propertyr    r   r   r   r      s    F  (O4
 # !O4O4 O4
 O4 O4 O4 
O4 O4b , ,r   r   N)
__future__r   typingr   r   streamlit.proto.Code_pb2r   r   streamlit.runtime.metrics_utilr   streamlit.string_utilr   streamlit.delta_generatorr	   streamlit.type_utilr
   r   r&   r   r   <module>r.      s+    # & 6 9 ,8/V, V,r   