
    %e                         d dl Z d dlZd dlmZmZmZmZ dZdee         deeef         deeef         fdZ	dedeeef         fd	Z
defd
ZdS )    N)Any
CollectionDictcastz~/.snowsql/configkeyssource_dictreturnc                 L    i }| D ]}||v r|                     |          ||<   |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ks       :lib/python3.11/site-packages/streamlit/connections/util.pyextract_from_dictr      s>    " 	A & &??1%%AaDH    connection_namec                    t           j                            t                    }t           j                            |          si S t          j        d          }|                    |           d|  |v r|d|           }nd|v r	|d         }ni S d |                                D             }d|v r|d         |d<   |d= |S )z.Loads the dictionary from snowsql config file.#)inline_comment_prefixeszconnections.connectionsc                 h    i | ]/\  }}|                     d d          |                    d          0S )name ")replacestrip).0r   vs      r   
<dictcomp>z1load_from_snowsql_config_file.<locals>.<dictcomp>G   sC       041		&"qwws||  r   dbdatabase)	ospath
expanduserSNOWSQL_CONNECTION_FILEexistsconfigparserConfigParserreaditems)r   snowsql_config_fileconfigraw_conn_paramsconn_paramss        r   load_from_snowsql_config_filer.   7   s    ',,-DEE7>>-.. 	&sCCCF
KK#$$$'o''611 !A!A!AB	&	 	  /	 8G8M8M8O8O  K {"-d"3Jr   c                  H    ddl m}  t          t           |                       S )z*Return whether this app is running in SiS.r   is_in_stored_procedure)"snowflake.snowpark._internal.utilsr1   r   boolr0   s    r   running_in_sisr4   R   s<          ,,..///r   )r&   r!   typingr   r   r   r   r$   strr   r.   r3   r4    r   r   <module>r8      s   ,     				 . . . . . . . . . . . .- 
S/(,S#X	#s(^   43 4S>    60 0 0 0 0 0 0r   