o
    沪g{                     @  sX   d dl mZ d dlZd dlmZ d dlmZ dd
dZdddZdddZ	dddZ
dS )    )annotationsN)cli_util)ConfigOptionold_optionsdict[str, ConfigOption]new_optionsreturnboolc                 C  s@   |   D ]\}}|dsq|j}|| j}||kr dS qdS )zpReturn True if and only if an option in the server section differs
    between old_options and new_options.
    serverTF)items
startswithvalue)r   r   opt_nameopt_valold_valnew_val r   Q/var/www/html/chatdoc2/venv/lib/python3.10/site-packages/streamlit/config_util.pyserver_option_changed   s   

r   section_descriptionsdict[str, str]config_optionsNonec                   sd  g    td  fdd} fdd} fdd} fdd	}|  D ]\}d
kr/q%fdd| D }t|dkrAq%  d |d    d | D ]\}}	|	jdd }t|	jpfd}
t|
d }t|
D ]5\}}|	 d}|r|d 
 s|dd }|dkr|n|}|D ]}||  q||kr  d qrddl}|d|	ji}|dd 
 }t|dkrԈ d dkr͈  d |d|  n	 |	jr|tjddd t|	jD ]}|| q|d|	j  |	jtjk}|r|d|	j  |||	ji}t|dkrd| d}n|s"d| }|| qUq%td  dS )z8Print the given config sections/options to the terminal.zh
        # Below are all the sections and options you can have in
        ~/.streamlit/config.toml.
    c                   s     dtj| dd  d S )N# T)boldappendr   style_for_clitextoutr   r   append_desc9   s   z show_config.<locals>.append_descc                   s     dt|   d S )Nr   r   r   r    r   r   append_comment<      z#show_config.<locals>.append_commentc                   s     tj| ddd d S )NTgreen)r   fgr   r   r    r   r   append_section?   s   z#show_config.<locals>.append_sectionc                   s     tj| dd d S )Nr%   r&   r   r   r    r   r   append_settingB   r$   z#show_config.<locals>.append_setting_testc                   s2   i | ]\}}|j  kr|jd kr| s||qS )visible)section
visibility
is_expired).0kv)r,   r   r   
<dictcomp>L   s
    zshow_config.<locals>.<dictcomp>r    z[%s].   
Ndefault
   zDefault: %szDEPRECATED.yellowr(   z+This option will be removed on or after %s.zThe value below was set in %sr   z =
)r   _cleanr   lenkeysplit_clean_paragraphsdescription	enumeraterstripstriplstriptomldumpsdefault_val
deprecatedr   r   deprecation_textexpiration_datewhere_definedr   DEFAULT_DEFINITIONr   print_to_clijoin)r   r   r"   r#   r'   r)   _section_optionsr=   optiondescription_paragraphslast_paragraph_idxi	paragraphlinesappend_funclinerE   toml_defaultoption_is_manually_settoml_settingr   )r!   r,   r   show_config)   s   	








Cr\   txtstrc                 C  s   t dd| S )zReplace sequences of multiple spaces with a single space, excluding newlines.

    Preserves leading and trailing spaces, and does not modify spaces in between lines.
    z + )resub)r]   r   r   r   r;      s   r;   	list[str]c                 C  s&   |  d} | d}dd |D }|S )zHSplit the text into paragraphs, preserve newlines within the paragraphs.r6   z

c                 S  s&   g | ]}d  dd |d D qS )r6   c                 s  s    | ]}t |V  qd S )N)r;   )r/   rX   r   r   r   	<genexpr>   s    z/_clean_paragraphs.<locals>.<listcomp>.<genexpr>)rN   r>   )r/   rU   r   r   r   
<listcomp>   s    z%_clean_paragraphs.<locals>.<listcomp>)rC   r>   )r]   
paragraphscleaned_paragraphsr   r   r   r?      s   

r?   )r   r   r   r   r   r	   )r   r   r   r   r   r   )r]   r^   r   r^   )r]   r^   r   rb   )
__future__r   r`   	streamlitr   streamlit.config_optionr   r   r\   r;   r?   r   r   r   r   <module>   s   


w