o
    h                     @  s^   d dl mZ d dlZd dlmZmZmZ erd dlmZ dZ	dddZ
dddZdddZdS )    )annotationsN)TYPE_CHECKINGAnycast)
Collectionz~/.snowsql/configkeysCollection[str]source_dictdict[str, Any]returnc                 C  s(   i }| D ]}||v r| |||< q|S )a  Extract the specified keys from source_dict and return them in a new dict.

    Parameters
    ----------
    keys : Collection[str]
        The keys to extract from source_dict.
    source_dict : Dict[str, Any]
        The dict to extract keys from. Note that this function mutates source_dict.

    Returns
    -------
    Dict[str, Any]
        A new dict containing the keys/values extracted from source_dict.
    )pop)r   r	   dk r   N/var/www/vscode/kcb/lib/python3.10/site-packages/streamlit/connections/util.pyextract_from_dict    s   r   connection_namestrc                 C  s   t jt}t j|si S ddl}|jdd}|| d|  |v r,|d|   }nd|v r5|d }ni S dd | D }d	|v rM|d	 |d
< |d	= |S )z.Loads the dictionary from snowsql config file.r   N#)inline_comment_prefixeszconnections.connectionsc                 S  s$   i | ]\}}| d d|dqS )name ")replacestrip).0r   vr   r   r   
<dictcomp>M   s    z1load_from_snowsql_config_file.<locals>.<dictcomp>dbdatabase)	ospath
expanduserSNOWSQL_CONNECTION_FILEexistsconfigparserConfigParserreaditems)r   snowsql_config_filer&   configraw_conn_paramsconn_paramsr   r   r   load_from_snowsql_config_file:   s$   

r.   boolc                  C  s0   zddl m}  td|  W S  ty   Y dS w )z*Return whether this app is running in SiS.r   is_in_stored_procedurer/   F)"snowflake.snowpark._internal.utilsr1   r   ModuleNotFoundErrorr0   r   r   r   running_in_sisX   s   r4   )r   r   r	   r
   r   r
   )r   r   r   r
   )r   r/   )
__future__r   r!   typingr   r   r   collections.abcr   r$   r   r.   r4   r   r   r   r   <module>   s   

