
    &e,                        d Z ddlZddlZddlmZmZmZmZ ddlZddl	m
c mZ ddlm
c mZ ddlmc mZ ddlmZ ddlmZ ddlmZmZ ddlmZ dZd	Zd
edeeef         fdZd
efdZd Z dededdfdZ! ej"        ddi           ej#        dd ej$        e                     ej%        d          dBd                                    Z&e&'                    d          d             Z(e&'                    d          d             Z)e&'                    d           d!             Z*e&'                    d"          e d#                         Z+e&'                    d$          e  ej,        d%dd&'           ej,        d(d)*          dCd%efd+                                                Z-dee         fd,Z.	 	 dDd(eee                  d-eeeef                  ddfd.Z/e&"                    d/          d0             Z0e0'                    d1          d2             Z1e&"                    d3          d4             Ze'                    d5          e d6                         Z2e&"                    d7d8          ej3        d9                         Z4e4'                    d:          d;             Z5e&"                    d<d=          d>             Z6e6'                    d?          d@             Z7e8dAk    r e&             dS dS )Ez=A script which is run when the Streamlit package is executed.    N)AnyDictListOptional)config)ConfigOption)Credentialscheck_credentials)$create_default_cache_storage_manager)pypy3)errorwarninginfodebugconfig_optionreturnc                     d| j          }| j                             dd          }| j        }| j        r|d}|d| j         d| j         z  }||| j        || j        dS )	z>Composes given config option options as options for click lib.z--._N z
 z - )paramdescriptiontypeoptionenvvar)keyreplacer   
deprecateddeprecation_textexpiration_dater   env_var)r   r   r   r   s       1lib/python3.11/site-packages/streamlit/web/cli.py&_convert_config_option_to_click_optionr$   &   s     &-#%%F%%c3//E+K 
KT-0TT]5RTT	

 ""'      c                 H     dt           j        dt           j        dd f fd}|S )N_ctx_paramr   c                 J    |d S t          dj        dj                  )NzSetting zn option using the CLI flag is not allowed. Set this option in the configuration file or environment variable: )
SystemExitr   r"   )r'   r(   	cli_valuer   s      r#   callbackz1_make_sensitive_option_callback.<locals>.callback>   sD    43}( 3 3&.3 3
 
 	
r%   )clickContext	Parameter)r   r,   s   ` r#   _make_sensitive_option_callbackr0   =   sA    
u} 
eo 
T 
 
 
 
 
 
 Or%   c                 F   t          t          j                                                  D ]t\  }}t	          |          }|j        rdddt          |          d}nd|d         d}t          j        |d         |d         f|d         |d	         d
|} ||           } u| S )z;Decorator that adds config param keys to click dynamically.FT)expose_valuehiddenis_eagerr,   r   )show_envvarr   r   r   r   r   )helpr   )	reversed_config_config_options_templateitemsr$   	sensitiver0   r-   r   )funcr   valueparsed_parameterclick_option_kwargsr   s         r#   configurator_optionsr@   J   s    W=CCEEFF # #5A%HH? 	 !& ;EBB	# #  $*84# # X&W%
 "-0!&)	
 

 "
 
 }T""Kr%   main_script_pathurl_pathc                 N   ddl }t          | d          5 }	 |                    |          }|                                 |                    |j                   n1# |j        j        $ r}t          j	        d| d|           d}~ww xY w	 ddd           dS # 1 swxY w Y   dS )z1Fetch remote file at url_path to main_script_pathr   NwbzUnable to fetch z.
)
requestsopengetraise_for_statuswritecontent
exceptionsRequestExceptionr-   BadParameter)rA   rB   rE   fprespes         r#   _download_remoterQ   g   s    OOO		%	% J	J<<))D!!###HHT\"""""3 	J 	J 	J$%H%H%HQ%H%HIII	J #	J J J J J J J J J J J J J J J J J Js5   BAABB	*BB		BB!Bauto_envvar_prefix	STREAMLIT)context_settingsz--log_levelT)show_defaultr   	Streamlit	prog_namer   c                 d    | r-ddl m}  |t                    }|                    d           dS dS )zTry out a demo with:

        $ streamlit hello

    Or use the line below to run your own script:

        $ streamlit run your_script.py
    r   )
get_loggerzSetting the log level using the --log_level flag is unsupported.
Use the --logger.level flag (after your streamlit command) instead.N)streamlit.loggerrZ   __name__r   )	log_levelrZ   LOGGERs      r#   mainr_   t   s]      
//////H%%T	
 	
 	
 	
 	
	
 
r%   r6   c                      t                       t          t          j                  dk    sJ dt          j        d<   t	          d           dS )zPrint this help message.   z--help   	streamlitrW   N)_get_command_line_as_stringlensysargvr_    r%   r#   r6   r6      sM    
  !!!sx==A CHQK;r%   versionc                      ddl } t                       t          | j                  dk    sJ d| j        d<   t	                       dS )z!Print Streamlit's version number.r   Nra   z	--versionrb   )rf   rd   re   rg   r_   )rf   s    r#   main_versionrk      sL     JJJ  !!!sx==ACHQKFFFFFr%   docsc                  Z    t          d           ddlm}  |                     d           dS )zShow help in browser.zShowing help page in browser...r   utilzhttps://docs.streamlit.ioN)printrc   ro   open_browserrn   s    r#   	main_docsrr      s@     

+,,,122222r%   helloc                  l    ddl m} t          j        |            |j        }t          ||            dS )zRuns the Hello World script.r   )Helloflag_optionsN)streamlit.helloru   	bootstrapload_config_options__file__	_main_run)kwargsru   filenames      r#   
main_hellor      sJ     &%%%%%!v6666~HhV,,,,,,r%   runtargetSTREAMLIT_RUN_TARGET)requiredr   args)nargsc                 R   ddl m} t          j        |           t          j                            |           \  }}|dd         t          vr:|dd         dk    rt          j	        d          t          j	        d| d	           ||           rdd
l
m}  |            5 }ddlm} ddlm}	  ||           j        }
t          j                            ||
                    d                              dd          d                   }|	                    |           } t)          ||            t+          |||           ddd           dS # 1 swxY w Y   dS t          j                            |           st          j        d|            t+          | ||           dS )zRun a Python script, piping stderr to Streamlit.

    The script can be local or it can be an url. In the latter case, Streamlit
    will download the script to a temporary file and runs this file.

    r   )urlrv   rb   Nr   zStreamlit requires raw Python (.py) files, but the provided file has no extension.
For more information, please see https://docs.streamlit.ioz/Streamlit requires raw Python (.py) files, not z<.
For more information, please see https://docs.streamlit.io)TemporaryDirectory)urlparse)url_util/r   zFile does not exist: )
validatorsr   ry   rz   ospathsplitextACCEPTED_FILE_EXTENSIONSr-   BadArgumentUsagestreamlit.temporary_directoryr   urllib.parser   rc   r   joinstriprsplitprocess_gitblob_urlrQ   r|   existsrM   )r   r   r}   r   r   	extensionr   temp_dirr   r   r   rA   s               r#   main_runr      sW    !v66667##F++LAy}444QRR=B( a   ( K)  K  K  K   s6{{ 5DDDDDD!! 	CX------******8F##(D!w||$**S//00a88<    11&99F-v666&6BBBB	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C w~~f%% 	G$%EV%E%EFFF&$V444444s   $B!EEEc                      dd l } t          j                    j        }|d S d|j        v rt          d          |j        g}|                    t          j        dd                     | 	                    |          S )Nr   zstreamlit.cliz}Running streamlit via `python -m streamlit.cli <command>` is unsupported. Please use `python -m streamlit <command>` instead.rb   )

subprocessr-   get_current_contextparentcommand_pathRuntimeErrorextendrf   rg   list2cmdline)r   r   cmd_line_as_lists      r#   rd   rd      s    &((/F~t&---P
 
 	

 +,CHQRRL)))""#3444r%   rw   c                     |g }|i }t                      dk    }t                       t          j        | |||           d S )Nzstreamlit hello)rd   r
   ry   r   )filer   rw   is_hellos       r#   r|   r|      sR    
 |*,,0AAHM$$55555r%   cachec                      dS )zManage the Streamlit cache.Nrh   rh   r%   r#   r   r     	     	Dr%   clearc                  $   t          j                    } t          j                    }| rt          d| d           nt          d| d           t	                      }|                                 t          j                                         dS )z<Clear st.cache, st.cache_data, and st.cache_resource caches.zCleared directory r   zNothing to clear at N)	legacy_cachingclear_cacheget_cache_pathrp   r   	clear_allcachingcache_resourcer   )result
cache_pathcache_storage_managers      r#   cache_clearr     s     '))F.00J 40:00011112Z222333 ABB##%%%  """""r%   r   c                      dS )z#Manage Streamlit's config settings.Nrh   rh   r%   r#   r   r   0  r   r%   showc                  V    t          j        |            t          j                     dS )z(Show all of Streamlit's config settings.rv   N)ry   rz   r8   show_config)r}   s    r#   config_showr   6  s-    
 !v6666r%   activate)invoke_without_commandc                 b    | j         s't          j                                                     dS dS )z*Activate Streamlit by entering your email.N)invoked_subcommandr	   get_currentr   )ctxs    r#   r   r   C  s:     ! -!!**,,,,,- -r%   resetc                  P    t          j                                                     dS )zReset Activation Credentials.N)r	   r   r   rh   r%   r#   activate_resetr   K  s%     ##%%%%%r%   test)r3   c                      dS )zuInternal-only commands used for testing.

    These commands are not included in the output of `streamlit help`.
    Nrh   rh   r%   r#   r   r   T  s	     	Dr%   rX   c                  t    t                       t          j                    j        } | J | j        dk    sJ dS )zAssert that the program name is set to `streamlit test`.

    This is used by our cli-smoke-tests to verify that the program name is set
    to `streamlit ...` whether the streamlit binary is invoked directly or via
    `python -m streamlit ...`.
    Nzstreamlit test)rd   r-   r   r   r   )r   s    r#   test_prog_namer   ]  sH      !!!&((/F"2222222r%   __main__)r   )N)NN)9__doc__r   rf   typingr   r   r   r   r-   streamlit.runtime.cachingruntimer    streamlit.runtime.legacy_cachingr   streamlit.web.bootstrapwebry   rc   r   r8   streamlit.config_optionr   streamlit.runtime.credentialsr	   r
   *streamlit.web.cache_storage_manager_configr   r   
LOG_LEVELSstrr$   r0   r@   rQ   groupr   Choiceversion_optionr_   commandr6   rk   rr   r   argumentr   rd   r|   r   r   r   pass_contextr   r   r   r   r\   rh   r%   r#   <module>r      s-   D C 				 



 , , , , , , , , , , , ,  + + + + + + + + + 9 9 9 9 9 9 9 9 9 + + + + + + + + + ' ' ' ' ' ' 0 0 0 0 0 0 H H H H H H H H      ) 2
	#s(^   .
< 
 
 
 
  :
Js 
Jc 
Jd 
J 
J 
J 
J 3[ABBBm$\U\*5M5MNNN,,,
 
 
 -, ON CB
( f
  
  
  i   f3 3 3 g- -  - e40FGGGb!!!)5 )5S )5 )5 )5 "! HG  )5X5Xc] 5 5 5 5( !%-16 6
49
6 4S>*6 
	6 6 6 6* G	 	 	
 w# # #, H	 	 	
     Jt44- -  54- 
'& & & F4  	 	 ! 	 k3 3 3" zDFFFFF r%   