
    ȯei(7                       U d Z ddlmZ ddlZddlZddlmZ ddlmZ ddl	m
Z
mZmZmZ ddlZddlmZ ddlmZ dd	lmZmZ dd
lmZ ddlmZ e
rddlmZ dZded<   dZded<   	 	 	 	 dNdZ 	 	 	 	 dOdZ! ededef         Z"dPdZ#dQdZ$ ejJ                  ddi       ejL                  dd ejN                  e             ejP                  d       dRdSd!                     Z)e)jU                  d"      dTd#       Z+e)jU                  d$      dTd%       Z,e)jU                  d&      dTd'       Z-e)jU                  d(      e#dUd)              Z.e)jU                  d*      e# ej^                  d+d,d-.       ej^                  d/d01      dVdWd2                            Z0dXd3Z1dYd4Z2	 	 dZ	 	 	 	 	 	 	 d[d5Z3e)jK                  d6      dTd7       Z4e4jU                  d8      dTd9       Z5e)jK                  d:      dTd;       ZejU                  d<      e#dUd=              Z6e)jK                  d>d?      ejn                  d\d@              Z8e8jU                  dA      dTdB       Z9e)jK                  dCdD      dTdE       Z:e:jU                  dF      dTdG       Z;e)jU                  dH       ej^                  dIdJK      dVd]dL              Z<e=dMk(  r e)        yy)^z=A script which is run when the Streamlit package is executed.    )annotationsN)CallablePath)TYPE_CHECKINGAnyFinalTypeVar)config)caching)Credentialscheck_credentials)	bootstrap)$create_default_cache_storage_manager)ConfigOption)pypy3r	   ACCEPTED_FILE_EXTENSIONS)errorwarninginfodebug
LOG_LEVELSc                   d| j                    }| j                   j                  dd      }| j                  }| j                  r#|d}|d| j                   d| j
                   z  }||| j                  || j                  | j                  dS )z>Composes given config option options as options for click lib.z--._ z
 z - )paramdescriptiontypeoptionenvvarmultiple)	keyreplacer   
deprecateddeprecation_textexpiration_dater    env_varr#   )config_optionr!   r   r   s       S/var/www/html/glpi_dashboard/venv/lib/python3.12/site-packages/streamlit/web/cli.py&_convert_config_option_to_click_optionr,   ,   s     -##$%F%%c3/E++KK-001]5R5R4ST	

 """''!**     c                     d fd}|S )Nc                T    |y 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)   )_ctx_param	cli_valuer*   s      r+   callbackz1_make_sensitive_option_callback.<locals>.callbackG   s=    }((+ ,&..13
 	
r-   )r1   click.Contextr2   zclick.Parameterr3   r   returnNone )r*   r4   s   ` r+   _make_sensitive_option_callbackr9   D   s    
 Or-   F.)boundc                (   t        t        j                  j                               D ]g  \  }}t	        |      }|j
                  rdddt        |      d}nd|d   d}t        j                  |d   |d   f|d   |d	   |d
   d|} ||       } i | S )z;Decorator that adds config param keys to click dynamically.FT)expose_valuehiddenis_eagerr4   r"   )show_envvarr"   r!   r   r   r    r#   )helpr    r#   )	reversed_config_config_options_templateitemsr,   	sensitiver9   clickr!   )funcr   valueparsed_parameterclick_option_kwargsr*   s         r+   configurator_optionsrL   V   s    W==CCEF #5A%H?? !& ;EB	#  $*84# X&W%
 "-0!&)%j1
 "
 T"1#2 Kr-   c                *   ddl }ddlm} t        | d      5 }	 |j	                  |d      }|j                          |j                  |j                         	 ddd       y# |$ r }t        j                  d| d|       d}~ww xY w# 1 sw Y   yxY w)	z2Fetch remote file at url_path to main_script_path.r   N)RequestExceptionwb   )timeoutzUnable to fetch z.
)
requestsrequests.exceptionsrN   opengetraise_for_statuswritecontentrG   BadParameter)main_script_pathurl_pathrR   rN   fprespes          r+   _download_remoter_   t   s    4		% J	J<<"<5D!!#HHT\\"	J J
   	J$$'7zQC%HII	JJ Js(   B	>A!!B&BBB		Bauto_envvar_prefix	STREAMLIT)context_settingsz--log_levelT)show_defaultr    	Streamlit	prog_namec                P    | r$ddl m}  |t              }|j                  d       yy)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.loggerrh   __name__r   )	log_levelrh   loggers      r+   mainrm      s+     /"8,T	
	 r-   rA   c                 V    t                dt        j                  d<   t        d       y)zPrint this help message.z--help   	streamlitre   N)_get_command_line_as_stringsysargvrm   r8   r-   r+   rA   rA      s!    
  ! CHHQK;r-   versionc                 R    ddl } t                d| j                  d<   t                y)z!Print Streamlit's version number.r   Nz	--versionro   )rr   rq   rs   rm   )rr   s    r+   main_versionrv      s!       !CHHQKFr-   docsc                 \    t        j                  d       ddlm}  | j	                  d       y)zShow help in browser.zShowing help page in browser...r   cli_utilzhttps://docs.streamlit.ioN)rG   echorp   rz   open_browserry   s    r+   	main_docsr}      s#     
JJ01"56r-   helloc                 B    ddl m} |j                  }t        ||        y)zRuns the Hello World script.r   )streamlit_appflag_optionsN)streamlit.hellor   __file__	_main_run)kwargsr   filenames      r+   
main_hellor      s     .%%HhV,r-   runtargetstreamlit_app.pySTREAMLIT_RUN_TARGET)defaultr"   args)nargsc                p   ddl m} |j                  |       rddlm}  |       5 }ddlm}  ||       j                  }t        |       t        j                  j                  ||j                  d      j                  dd      d         }|j                  |       }	t        ||	       t        |||       d	d	d	       y	t!        |       }
|
j#                         r|
d
z  }
t%        |
      }t        |       |
j'                         st)        j*                  d|
       t        |||       y	# 1 sw Y   y	xY w)u  Run a Python script, piping stderr to Streamlit.

    If omitted, the target script will be assumed to be "streamlit_app.py".

    Otherwise, the target script should be one of the following:
    - The path to a local Python file.
    - The path to a local folder where "streamlit_app.py" can be found.
    - A URL pointing to a Python file. In this case Streamlit will download the
      file to a temporary file and run it.

    To pass command-line arguments to the script, add " -- " before them. For example:

        $ streamlit run my_app.py -- --my_arg1=123 my_arg2
                                   ↑
                                   Your CLI args start after this.
    r   )url_util)TemporaryDirectory)urlparse/ro   r   r   Nr   zFile does not exist: )rp   r   is_urlstreamlit.temporary_directoryr   urllib.parser   path_check_extension_or_raiseosjoinstriprsplitprocess_gitblob_urlr_   r   r   is_dirstrexistsrG   rY   )r   r   r   r   r   temp_dirr   url_subpathrZ   urlr   path_strs               r+   main_runr      s   * #vD! 	CX-"6*//K%k2!ww||+++C077Q?C  ..v6C-s3&6B	C 	C  F|;;=&&Dt9!(+{{}$$'<TF%CDD(Dv67	C 	Cs   BD,,D5c                    t         j                  j                  |       \  }}|dd  t        vr6|dd  dk(  rt	        j
                  d      t	        j
                  d| d      y )Nro   r   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)r   r   splitextr   rG   BadArgumentUsage)r   r   	extensions      r+   r   r      s~    77##H-LAy}44QR=B((M  $$=i[ II I
 	
 5r-   c                     dd l } t        j                         j                  }|y d|j                  v rt        d      |j                  g}|j                  t        j                  dd         | j                  |      S )Nr   zstreamlit.cliz}Running streamlit via `python -m streamlit.cli <command>` is unsupported. Please use `python -m streamlit <command>` instead.ro   )

subprocessrG   get_current_contextparentcommand_pathRuntimeErrorextendrr   rs   list2cmdline)r   r   cmd_line_as_lists      r+   rq   rq     s}    &&(//F~&---P
 	

 ++,CHHQRL)""#344r-   c                    t         j                  j                  |       t        _        t        j                  |xs i        |g }|i }t               dk(  }t                t        j                  | |||       y )Nr   zstreamlit hello)
r   r   abspathrC   _main_script_pathr   load_config_optionsrq   r   r   )filer   r   is_hellos       r+   r   r     sg     !# 5G!!|/ArB|*,0AAHMM$$5r-   cachec                      y)zManage the Streamlit cache.Nr8   r8   r-   r+   r   r   :       	r-   clearc                 t    t               } | j                          t        j                  j	                          y)z1Clear st.cache_data and st.cache_resource caches.N)r   	clear_allr   cache_resourcer   )cache_storage_managers    r+   cache_clearr   @  s,     AB##%  "r-   r   c                      y)z#Manage Streamlit's config settings.Nr8   r8   r-   r+   r   r   Q  r   r-   showc                 X    t        j                  |        t        j                          y)z(Show all of Streamlit's config settings.r   N)r   r   rC   show_config)r   s    r+   config_showr   W  s    
 !!v6r-   activate)invoke_without_commandc                b    | j                   s#t        j                         j                          yy)z*Activate Streamlit by entering your email.N)invoked_subcommandr   get_currentr   )ctxs    r+   r   r   d  s'     !!!**, "r-   resetc                 H    t        j                         j                          y)zReset Activation Credentials.N)r   r   r   r8   r-   r+   activate_resetr   l  s     ##%r-   test)r>   c                      y)zuInternal-only commands used for testing.

    These commands are not included in the output of `streamlit help`.
    Nr8   r8   r-   r+   r   r   u  s     	r-   rf   c                     t                t        j                         j                  } | t	        d      | j
                  dk7  rt	        d| j
                   d      y)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parent is Nonezstreamlit testzParent command path is z not streamlit test.)rq   rG   r   r   AssertionErrorr   )r   s    r+   test_prog_namer   ~  sd      !&&(//F~-....%f&9&9%::NO
 	
 /r-   init	directoryF)requiredc                   ddl m} | r ||       n |j                         }	 |j                  dd       |dz  j                  dd	
       |dz  j                  dd	
       | rt        |       nd}t        j                  dd       t        j                  | d       t        j                  dd       t        j                  d| dd       t        j                  dd      r/|dz  }t        j                  d       t        t        |             yy# t        $ r}t        j                  d|       d}~ww xY w)zInitialize a new Streamlit project.

    If DIRECTORY is specified, create it and initialize the project there.
    Otherwise use the current directory.
    r   r   T)exist_okparentszFailed to create directory: Nzrequirements.txtz
streamlit
zutf-8)encodingr   u   import streamlit as st

st.title("🎈 My new app")
st.write(
    "Let's start building! For help and inspiration, head over to [docs.streamlit.io](https://docs.streamlit.io/)."
)
r   u!   ✨ Created new Streamlit app in F)nlblue)fgu   🚀 Run it with: zstreamlit run z/streamlit_app.pyu   ❓ Run the app now?)r   z
Starting Streamlit...)pathlibr   cwdmkdirOSErrorrG   ClickException
write_textr   sechor{   confirmr   )r   r   project_dirr^   rel_path_strapp_paths         r+   	main_initr     s/    %.$y/HDHHJKG46
 %%11-'1R %%11	  2 	 &/3y>CL	KK3>	KK<.f-	JJ#.	KK..?@VL}}+T:!33

,-#h-  ;3  G""%A!#EFFGs   D 	D?"D::D?__main__)r*   r   r6   zdict[str, Any])r*   r   r6   z5Callable[[click.Context, click.Parameter, Any], None])rH   r:   r6   r:   )rZ   r   r[   r   r6   r7   )r   )rk   r   r6   r7   )r6   r7   )r   r   r6   r7   )N)r   r   r   list[str] | Noner   r   r6   r7   )r   r   r6   r7   )r6   
str | None)NN)r   r   r   r   r   zdict[str, Any] | Noner6   r7   )r   r5   r6   r7   )r   r   r6   r7   )>__doc__
__future__r   r   rr   collections.abcr   r   r   typingr   r   r	   r
   rG   rp   r   rC   streamlit.runtimer   streamlit.runtime.credentialsr   r   streamlit.webr   *streamlit.web.cache_storage_manager_configr   streamlit.config_optionr   r   __annotations__r   r,   r9   r:   rL   r_   groupr!   Choiceversion_optionrm   commandrA   rv   r}   r   argumentr   r   rq   r   r   r   r   pass_contextr   r   r   r   r   rj   r8   r-   r+   <module>r      sX   D " 	 
 $  5 5  ' % H # 4"/ % /9
E 90: CxS)*<J 3[ABm$\U\\*5MN,
 - O C
( f    i
 
 f7 7 g-  - e"4=STb!17 " U  17h
5( "*.6
6
6 (6 
	66 G	 	
 w
# 
#  H	 	
    Jt4-  5- 
'& & F4 	 !	 k
 
, fe,(! - (!V zF r-   