Format: application/x-python-code
⬇ Download File (5.8 KB)
   1  o
   2  
   3  +'h�@s�ddlZddlZddlZddlZddlmZddlmZmZm	Z	m
   4  Z
   5  mZmZzddl
   6  Z
   7  Wney@ej�d�e�d�YnwddlmZmZmZddlmZdeefd	d
   8  �Ze
   9  ��e
  10  jdde�e
  11  jd
  12  d�dd�e
  13  jddde
  14  �gd��dd�e
  15  jddde
  16  jdd�e
  17  jed�e
  18  j de
  19  j!dedededdf
  20  dd �������Z"ed!ej#de
  21  e	efd"d#��Z$e"�%�e
  22  j e
  23  jd$d%e
  24  �gd&��d'd�de
  25  j!d(e&ddfd)d*����Z'e"�%�e
  26  j e
  27  j(d+d
  28  d,�e
  29  j(d-d
  30  d,�de
  31  j!d+ed-eddfd.d/�����Z)e"�%�e
  32  j e
  33  j(d+d
  34  d,�de
  35  j!d+eddfd0d1����Z*e"�%�e
  36  j e
  37  j(d+d
  38  d,�de
  39  j!d+eddfd2d3����Z+e"j%d4d
  40  id5�e
  41  j e
  42  jd6d
  43  d7d8�e
  44  j(d9d:e
  45  j,d;�de
  46  j!d<e&d9eeddfd=d>�����Z-d?eed@eeefddfdAdB�Z.dS)C�N)�contextmanager)�Any�Dict�IO�Iterator�List�OptionalzkIt seems python-dotenv is not installed with cli option. 
  47  Run pip install "python-dotenv[cli]" to fix this.�)�
  48  dotenv_values�set_key�	unset_key)�__version__�returncCs4zt��}Wn
  49  tyYdSwtj�|d�}|S)zZ
  50      Return a path for the ${pwd}/.env file.
  51  
  52      If pwd does not exist, return None.
  53      Nz.env)�os�getcwd�FileNotFoundError�path�join)�cwdr�r�@C:\Users\shubh\Videos\agent\nova\Lib\site-packages\dotenv/cli.py�
  54  enumerate_envs�rz-fz--fileT)Z	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�exportcCs|||d�|_dS)zAThis script is used to set, get or unset values from a .env file.)�QUOTE�EXPORT�FILEN)�obj)rr r!r"rrr�cli!sr'rc
  55  cs~�zt|��
  56  }|VWd�WdS1swYWdSty>}ztd|��tjd�td�WYd}~dSd}~ww)z~
  57      Open a file and yield the corresponding (decoded) stream.
  58  
  59      Exits with error code 2 if the file cannot be opened.
  60      NzError opening env file: )r �)�open�OSError�print�sys�stderr�exit)r�stream�excrrr�stream_file2s�
  61  &���r1z--format�simple)r2�json�shellr"zlThe format in which to display the list. Default format is simple, which displays name=value without quotes.�formatcCs�|jd}t|��
  62  }t|d�}Wd�n1swY|dkr/t�tj|ddd��dS|dkr5d	nd
  63  }t|�D]}||}|durZ|dvrNt�	|�}t�|�|�d|���q;dS)
  64  z!Display all the stored key/value.r%�r/Nr3r(T)�indent�	sort_keysr"zexport �)r"r4�=)
  65  r&r1r
  66  �click�echor3�dumps�sorted�shlexr!)rr5r r/�values�prefix�k�vrrr�listBs
  67  
  68  �
  69  ��rD�key)�required�valuecCs\|jd}|jd}|jd}t|||||�\}}}|r(t�|�d|���dStd�dS)zStore the given key/value.r%r#r$r:r	N)r&rr;r<r.)rrErGr r!r"�successrrr�set[s
  70  
  71  
  72  rIcCsd|jd}t|��
  73  }t|d�}Wd�n1swY|�|�}|r,t�|�dStd�dS)z%Retrieve the value for the given key.r%r6Nr	)r&r1r
  74  �getr;r<r.)rrEr r/r@Zstored_valuerrrrJks
  75  
  76  �
  77  rJcCsH|jd}|jd}t|||�\}}|rt�d|���dStd�dS)zRemoves the given key.r%r#zSuccessfully removed r	N)r&rr;r<r.)rrEr r!rHrrr�unset|s
  78  
  79  rKZignore_unknown_options)Zcontext_settingsz--override/--no-overridezKOverride variables from the environment file with those from the .env file.)rr�commandline�����)�nargsr�overridecsj|jd}tj�|�stjd|�d�|d���fdd�t|���D�}|s.t�d�t	d�t
  80  ||�d	S)
  81  z/Run command with environment variables present.r%zInvalid value for '-f' "z" does not exist.)rcs,i|]\}}|dur�s|tjvr||�qS)N)r�environ)�.0rBrC�rOrr�
  82  <dictcomp>�s
  83  �zrun.<locals>.<dictcomp>zNo command given.r	N)r&rr�isfiler;ZBadParameterr
  84  �itemsr<r.�run_command)rrOrLr Zdotenv_as_dictrrRr�run�s
  85  
  86  
  87  �
  88  
  89  �
  90  rW�command�envcCs,tj��}|�|�tj|d||d�dS)a�Replace the current process with the specified command.
  91  
  92      Replaces the current process with the specified command and the variables from `env`
  93      added in the current environment variables.
  94  
  95      Parameters
  96      ----------
  97      command: List[str]
  98          The command and it's parameters
  99      env: Dict
 100          The additional environment variables
 101  
 102      Returns
 103      -------
 104      None
 105          This function does not return any value. It replaces the current process with the new one.
 106  
 107      r)�argsrYN)rrP�copy�update�execvpe)rXrYZcmd_envrrrrV�s
 108  
 109  rV)/r3rr?r,�
 110  contextlibr�typingrrrrrrr;�ImportErrorr-�writer.�mainr
 111  rrrr
 112  �strr�group�option�PathZChoice�BOOLZversion_optionZpass_context�Contextr'�PathLiker1rX�boolrDZargumentrIrJrKZUNPROCESSEDrWrVrrrr�<module>s~ �
 113  �
 114  �
 115  �
 116  ,�$�(&