
    k i%                        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	m
Z
mZmZ ej        dk    rd dl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 dd	lmZ d
ee         fdZ ej                     ej        dd e             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d!ej&        d
e
ee                  fd"            Z'e%(                    d#$          ej#         ej        d%d&d' ej         g d(          d)          dej$        d&ed
dfd*                                    Z)e%(                    d+$          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d0                                    Z,e%(                                ej#         ej*        d,d-          dej$        d,ed
dfd1                                    Z-e%(                    d2di3          ej#         ej        d4dd56           ej*        d7d8ej.        9          dej$        d:e/d7ee         d
dfd;                                                Z0d<ee         d=e	eef         d
dfd>Z1dS )?    N)contextmanager)IOAnyDictIteratorListOptionalwin32)PopenzkIt seems python-dotenv is not installed with cli option. 
Run pip install "python-dotenv[cli]" to fix this.   )dotenv_valuesset_key	unset_key)__version__returnc                      	 t          j                    } n# t          $ r Y dS w xY wt           j                            | d          }|S )zZ
    Return a path for the ${pwd}/.env file.

    If pwd does not exist, return None.
    Nz.env)osgetcwdFileNotFoundErrorpathjoin)cwdr   s     A/var/www/findabus/venv/lib/python3.11/site-packages/dotenv/cli.pyenumerate_envr      sP    ikk   tt7<<V$$DKs    
$$z-fz--fileT)	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exportc                     |||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       r   clir,   &   s    4 >>CGGG    r   c              #      K   	 t          |           5 }|V  ddd           dS # 1 swxY w Y   dS # t          $ r=}t          d| t          j                   t          j        d           Y d}~dS d}~ww xY w)z~
    Open a file and yield the corresponding (decoded) stream.

    Exits with error code 2 if the file cannot be opened.
    NzError opening env file: )r$      )openOSErrorprintsysstderrexit)r   streamexcs      r   stream_filer8   C   s      $ZZ 	6LLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   ...SZ@@@@s,   2 %2 )2 )2 
A92A44A9list)namez--formatoutput_formatsimple)r<   jsonshellr&   zlThe format in which to display the list. Default format is simple, which displays name=value without quotes.c                    | j         d         }t          |          5 }t          |          }ddd           n# 1 swxY w Y   |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*   r6   Nr=   r/   T)indent	sort_keysr&   zexport  )r&   r>   =)
r+   r8   r   clickechor=   dumpssortedshlexr%   )r#   r;   r$   r6   valuesprefixkvs           r   list_valuesrN   S   s0    76?D	T		 .ff---. . . . . . . . . . . . . . . 
4:fQ$???@@@@@+x77R 	/ 	/Aq	A} $777AA
f-a--!--...	/ 	/   :>>setkey)requiredvaluec                     | j         d         }| j         d         }| j         d         }t          |||||          \  }}}|rt          j        | d|            dS t	          j        d           dS )zStore the given key/value.r*   r(   r)   rD   r   N)r+   r   rE   rF   r3   r5   )r#   rQ   rS   r$   r%   r&   successs          r   	set_valuerV   p   s     76?DGGEWXF!$UE6BBGS% 
c##E##$$$$$r-   c                    | j         d         }t          |          5 }t          |          }ddd           n# 1 swxY w Y   |                    |          }|rt	          j        |           dS t          j        d           dS )z%Retrieve the value for the given key.r*   r@   Nr   )r+   r8   r   getrE   rF   r3   r5   )r#   rQ   r$   r6   rJ   stored_values         r   rX   rX      s    
 76?D	T		 .ff---. . . . . . . . . . . . . . . ::c??L 
<     rO   c                     | j         d         }| j         d         }t          |||          \  }}|rt          j        d|            dS t	          j        d           dS )zRemoves the given key.r*   r(   zSuccessfully removed r   N)r+   r   rE   rF   r3   r5   )r#   rQ   r$   r%   rU   s        r   unsetr[      sh    
 76?DGGET3..LGS 
030011111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                 b   | j         d         }t          j                            |          st	          j        d| d|           fdt          |                                          D             }|s(t	          j        d           t          j
        d           t          ||           dS )	z/Run command with environment variables present.r*   zInvalid value for '-f' "z" does not exist.)r#   c                 @    i | ]\  }}|s|t           j        v||S )N)r   environ).0rL   rM   ra   s      r   
<dictcomp>zrun.<locals>.<dictcomp>   s>       Q=h=!2:*=*= 	
1*=*=*=r-   zNo command given.r   N)r+   r   r   isfilerE   BadParameterr   itemsrF   r3   r5   run_command)r#   ra   r^   r$   dotenv_as_dicts    `   r   runrl      s     76?D7>>$ 
 @@@@c
 
 
 	
   #D))//11  N  
&'''^,,,,,r-   commandenvc                 R   t           j                                        }|                    |           t          j        dk    rFt          | ddd|          }|                                \  }}t	          j        |j	                   dS t          j
        | d         | |           dS )a  Replace the current process with the specified command.

    Replaces the current process with the specified command and 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
    -------
    None
        This function does not return any value. It replaces the current process with the new one.

    r
   Tr   F)universal_newlinesbufsizer>   rn   )argsrn   N)r   rd   copyupdater3   platformr   communicater5   
returncodeexecvpe)rm   rn   cmd_envp_s        r   rj   rj      s    * jooGNN3
|w 'dAUPWXXX}}1

71:G999999r-   )2r=   r   rI   r3   
contextlibr   typingr   r   r   r   r   r	   ru   
subprocessr   rE   ImportErrorr4   writer5   mainr   r   r   r"   r   strr   groupoptionPathChoiceBOOLversion_optionpass_contextContextr,   PathLiker8   rm   rN   argumentrV   rX   r[   UNPROCESSEDboolrl   rj    r-   r   <module>r      s    				  



 % % % % % % : : : : : : : : : : : : : : : :<7      LLLL   J	<   CHQKKKKK 4 3 3 3 3 3 3 3 3 3            x}     MOO	d	#	#	#	Y   	111	2	2	m   		F   k***?U] ?# ?c ?3 ?4 ? ? ?  +*    0?
 bk hr#w&7     &	;;;	<	<
0  /U] /3 /4 / / /   /& %%%%$'''	5= 	s 	3 	4 	 	 	 (' &%  	 %%%U]      &%   %%%u} 3 4    &%   7>??	V  
 Re.?@@@-U] -d -c -t - - - A@   @?-& :c  :c3h  :D  :  :  :  :  :  :s   > /A0/A0