
    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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jB                  d       ejD                  e      ejF                  dejH                  dededed
df
d                                           Z%ed!ejL                  d
e
ee      fd"       Z'e%jQ                  d#$      ejF                   ej<                  d%d&d' ej@                  g d(      d)      dejH                  d&ed
dfd*                     Z)e%jQ                  d+$      ejF                   ejT                  d,d-       ejT                  d.d-      dejH                  d,ed.ed
dfd/                            Z+e%jQ                         ejF                   ejT                  d,d-      dejH                  d,ed
dfd0                     Z,e%jQ                         ejF                   ejT                  d,d-      dejH                  d,ed
dfd1                     Z-e%jQ                  d2di3      ejF                   ej<                  d4dd56       ejT                  d7d8ej\                  9      dejH                  d:e/d7ee   d
dfd;                            Z0d<ee   d=e	eef   d
dfd>Z1y# e$ r1 ej$                  j'                  d        ej(                  d       Y .w xY w)?    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                         } t         j                  j	                  | d      }|S # t        $ r Y yw xY w)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     P/var/www/html/talentspherev1.5.2/venv/lib/python3.12/site-packages/dotenv/cli.pyenumerate_envr      sA    iik 77<<V$DK  s   8 	AA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| _         y)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 >CG    r   c              #      K   	 t        |       5 }| ddd       y# 1 sw Y   yxY w# t        $ r=}t        d| t        j                         t        j
                  d       Y d}~yd}~ww xY w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_     $Z 	6L	 	 	 (.SZZ@sC   A2) ) A2&) A2) 	A/3A*%A2*A//A2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       |dk(  r,t        j                  t        j                  dd             y|dk(  rd	nd
}t              D ]?  }||   }||dv rt        j                  |      }t        j                  | | d|        A y# 1 sw Y   xY w)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   s     776?D	T	 .ff-. 

4::fQ$?@+x7R 	/Aq	A} $77AA

fXaS!-.	/. .s   B88Csetkey)requiredvaluec                     | j                   d   }| j                   d   }| j                   d   }t        |||||      \  }}}|rt        j                  | d|        yt	        j
                  d       y)zStore the given key/value.r*   r(   r)   rD   r   N)r+   r   rE   rF   r3   r5   )r#   rP   rR   r$   r%   r&   successs          r   	set_valuerU   p   sk     776?DGGGEWWXF!$UE6BGS%

cU!E7#$r-   c                     | j                   d   }t        |      5 }t        |      }ddd       j                  |      }|rt	        j
                  |       yt        j                  d       y# 1 sw Y   HxY w)z%Retrieve the value for the given key.r*   r@   Nr   )r+   r8   r   getrE   rF   r3   r5   )r#   rP   r$   r6   rJ   stored_values         r   rW   rW      sc    
 776?D	T	 .ff-. ::c?L

< . .s   A//A8c                     | j                   d   }| j                   d   }t        |||      \  }}|rt        j                  d|        yt	        j
                  d       y)zRemoves the given key.r*   r(   zSuccessfully removed r   N)r+   r   rE   rF   r3   r5   )r#   rP   r$   r%   rT   s        r   unsetrZ      sS    
 776?DGGGET3.LGS

*3%0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                    | j                   d   }t        j                  j                  |      st	        j
                  d| d|       t        |      j                         D ci c]  \  }}||s|t        j                  vr||  }}}|s*t	        j                  d       t        j                  d       t        ||       yc c}}w )z/Run command with environment variables present.r*   zInvalid value for '-f' "z" does not exist.)r#   NzNo command given.r   )r+   r   r   isfilerE   BadParameterr   itemsenvironrF   r3   r5   run_command)r#   r`   r]   r$   rL   rM   dotenv_as_dicts          r   runrh      s     776?D77>>$  'v-?@c
 	

 $D)//1Q=h!2::*= 	
1N  

&'^,s   &#Ccommandenvc                 D   t         j                  j                         }|j                  |       t        j
                  dk(  rCt        | ddd|      }|j                         \  }}t	        j                  |j                         yt        j                  | d   | |       y)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>   rj   )argsrj   N)r   re   copyupdater3   platformr   communicater5   
returncodeexecvpe)ri   rj   cmd_envp_s        r   rf   rf      st    * jjooGNN3
||w 'dAUPWX}}1


71:G9r-   )2r=   r   rI   r3   
contextlibr   typingr   r   r   r   r   r	   rq   
subprocessr   rE   ImportErrorr4   writer5   mainr   r   r   r"   r   strr   groupoptionPathChoiceBOOLversion_optionpass_contextContextr,   PathLiker8   ri   rN   argumentrU   rW   rZ   UNPROCESSEDboolrh   rf    r-   r   <module>r      s    	  
 % : :<<7  4 3  x}  O	d	#	Y 	1	2	m 		F k*?U]] ?# ?c ?3 ?4 ?  + 0?
 bkk 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  :[  JJ	< CHHQKs   L: :2M0/M0