
    \c                        d dl Z d dlZd dlZd dlZd dlmZ d dlmZmZm	Z	 	 d dl
Z
n5# e$ r- ej                            d            ej        d           Y nw xY wddlmZmZmZmZ ddlmZ  e
j                     e
j        dd	ej                             ej                    d
           e
j        d          d           e
j        ddd e
j        g d          d           e
j        ddde
j        d           e
j        e          e
j        de
j         dedededdf
d                                                                        Z!e!"                                e
j         e
j        dd  e
j        g d!          d"          de
j         d#e#ddfd$                                    Z$e!"                                e
j         e
j%        d%d&           e
j%        d'd&          de
j         d%ed'eddfd(                                                Z&e!"                                e
j         e
j%        d%d&          de
j         d%eddfd)                                    Z'e!"                                e
j         e
j%        d%d&          de
j         d%eddfd*                                    Z(e!"                    d+di,          e
j         e
j        d-dd./           e
j%        d0d1e
j)        2          de
j         d3e#d0e	e*         ddfd4                                                Z+d5e	e*         d6ee*e*f         de,fd7Z-dS )8    N)Popen)AnyDictListzkIt seems python-dotenv is not installed with cli option. 
Run pip install "python-dotenv[cli]" to fix this.   )dotenv_valuesget_keyset_key	unset_key)__version__z-fz--filez.envT)	file_okayzNLocation of the .env file, defaults to .env file in current working directory.)defaulttypehelpz-qz--quotealways)r   neverautozbWhether to quote or not the variable values. Default mode is always. This does not affect parsing.z-ez--exportFz;Whether to write the dot file as an executable bash script.)versionctxfilequoteexportreturnc                 P    i | _         || j         d<   || j         d<   || j         d<   dS )zAThis script is used to set, get or unset values from a .env file.QUOTEEXPORTFILEN)obj)r   r   r   r   s       *lib/python3.11/site-packages/dotenv/cli.pyclir       s2     CGCGGCGHCGFOOO    z--formatsimple)r"   jsonshellr   zlThe format in which to display the list. Default format is simple, which displays name=value without quotes.formatc                    | j         d         }t          j                            |          st	          j        d|z  |           t          |          }|dk    r+t	          j        t          j	        |dd                     dS |dk    rd	nd
}t          |          D ]?}||         }|3|dv rt          j        |          }t	          j        ||d|           @dS )z!Display all the stored key/value.r   Path "%s" does not exist.r   r#      T)indent	sort_keysr   zexport  N)r   r$   =)r   ospathisfileclickBadParameterr   echor#   dumpssortedshlexr   )r   r%   r   dotenv_as_dictprefixkvs          r   listr;   '   s    76?D7>>$ 
 '40
 
 
 	
 #4((N 	7
4:nQ$GGGHHHHH$08b'' 	7 	7Aq!A 700 'AA
115666	7 	7r!   key)requiredvaluec                     | j         d         }| j         d         }| j         d         }t          |||||          \  }}}|rt          j        |d|           dS t	          d           dS )zStore the given key/value.r   r   r   r-   r   N)r   r
   r1   r3   exit)r   r<   r>   r   r   r   successs          r   setrB   B   s{     76?DGGEWXF!$UE6BBGS% 
ccc55)*****Qr!   c                     | j         d         }t          j                            |          st	          j        d|z  |           t          ||          }|rt	          j        |           dS t          d           dS )z%Retrieve the value for the given key.r   r'   r(   r   N)	r   r.   r/   r0   r1   r2   r	   r3   r@   )r   r<   r   stored_values       r   getrE   R   s    
 76?D7>>$ 
 '40
 
 
 	
 4%%L 
<     Qr!   c                     | j         d         }| j         d         }t          |||          \  }}|rt          j        d|z             dS t	          d           dS )zRemoves the given key.r   r   zSuccessfully removed %sr   N)r   r   r1   r3   r@   )r   r<   r   r   rA   s        r   unsetrG   d   sc    
 76?DGGET3..LGS 
,s233333Qr!   ignore_unknown_options)context_settingsz--override/--no-overridezKOverride variables from the environment file with those from the .env file.)r   r   commandline)nargsr   overridec                 t   | j         d         }t          j                            |          st	          j        d|z  |           fdt          |                                          D             }|s#t	          j        d           t          d           t          ||          }t          |           dS )z/Run command with environment variables present.r   z+Invalid value for '-f' "%s" does not exist.r(   c                 @    i | ]\  }}|s|t           j        v||S )N)r.   environ).0r9   r:   rM   s      r   
<dictcomp>zrun.<locals>.<dictcomp>   sP       Q ' +,2:*=	1  r!   zNo command given.r   N)r   r.   r/   r0   r1   r2   r   itemsr3   r@   run_command)r   rM   rJ   r   r7   rets    `    r   runrV   r   s     76?D7>>$ 
 ;tD
 
 
 	
   #D))//11  N  
&'''Q
k>
2
2CIIIIIr!   commandenvc                     t           j                                        }|                    |           t	          | ddd|          }|                                \  }}|j        S )aw  Run command in sub process.

    Runs the command in a sub process with the variables from `env`
    added in the current environment variables.

    Parameters
    ----------
    command: List[str]
        The command and it's parameters
    env: Dict
        The additional environment variables

    Returns
    -------
    int
        The return code of the command

    Tr   F)universal_newlinesbufsizer$   rX   )r.   rP   copyupdater   communicate
returncode)rW   rX   cmd_envp_s        r   rT   rT      sd    * jooGNN3g!%		 	 	A
 ==??DAq<r!   ).r#   r.   r6   sys
subprocessr   typingr   r   r   r1   ImportErrorstderrwriter@   mainr   r	   r
   r   r   r   groupoptionr/   joingetcwdPathChoiceBOOLversion_optionpass_contextContextr    rW   boolr;   argumentrB   rE   rG   UNPROCESSEDstrrV   intrT    r!   r   <module>rz      s    				  



       " " " " " " " " " "LLLL   J I J J JCHQKKKKK
 = < < < < < < < < < < <             dHbgll929;;&G&G5:---ce e e dIx5< ; ; ;<<wy y y dJ:PR R R k***U] # c 3 4     +*R Ry ye e  j(5< E E EFF?@ @ @7em 7T 7d 7 7 7	@ @  7* %%%$'''	U] 	 	S 	T 	 	 	 (' &%  	 %%%U]      &%   %%%u} 3 4    &%   7>??	V  
 Re.?@@@U] d c t    A@   @?*c c3h C      s   ' /AA