DjddlZddlZddlZddlZddlmZddlmZmZm Z m Z m Z m Z ej dkrddlmZ ddlZn5#e$r-ejdejdYnwxYwddlmZmZmZdd lmZd e efd Zejejd d eejddejdddej gddejdddej!dej"eej#dej$dededed df d Z%ed!ej&d e eefd"Z'e%(d#$ej#ejd%d&d'ej gd(d)dej$d&ed dfd*Z)e%(d+$ej#ej*d,d-ej*d.d-dej$d,ed.ed dfd/Z+e%(ej#ej*d,d-dej$d,ed dfd0Z,e%(ej#ej*d,d-dej$d,ed dfd1Z-e%(dddd23ej#ejd4dd56ej*d7d8ej.9dej$d:e/d7e0ed;fd dfd<Z1d=e ed>e eefd dfd?Z2dS)@N)contextmanager)IOAnyDictIteratorListOptionalwin32)PopenzkIt seems python-dotenv is not installed with cli option. Run pip install "python-dotenv[cli]" to fix this.) dotenv_valuesset_key unset_key) __version__returnc tj}n#t$rYdSwxYwtj|d}|S)zZ Return a path for the ${pwd}/.env file. If pwd does not exist, return None. Nz.env)osgetcwdFileNotFoundErrorpathjoin)cwdrs 8C:\PYTHON\_runtimes\venv\Lib\site-packages\dotenv/cli.py enumerate_envrsP ikk tt 7<<V $ $D Ks  $$z-fz--fileT) file_okayzNLocation of the .env file, defaults to .env file in current working directory.)defaulttypehelpz-qz--quotealways)rneverautozbWhether 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.)versionctxfilequoteexportc|||d|_dS)zAThis script is used to set, get or unset values from a .env file.)QUOTEEXPORTFILEN)obj)r#r$r%r&s rclir,&s4>>CGGGrc#K t|5}|VddddS#1swxYwYdS#t$r=}td|tjtjdYd}~dSd}~wwxYw)z~ Open a file and yield the corresponding (decoded) stream. Exits with error code 2 if the file cannot be opened. NzError opening env file: )r$)openOSErrorprintsysstderrexit)rstreamexcs r stream_filer8Cs $ZZ 6LLL                    ...SZ@@@@  s,2% 2)2)2 A92A44A9list)namez--format output_formatsimple)r<jsonshellr&zlThe format in which to display the list. Default format is simple, which displays name=value without quotes.c|jd}t|5}t|}dddn #1swxYwY|dkr+tjt j|dddS|dkrd nd }t|D]?}||}|3|d vrtj |}tj||d |@dS) z!Display all the stored key/value.r*r6Nr=r/T)indent sort_keysr&zexport )r&r>=) r+r8r clickechor=dumpssortedshlexr%)r#r;r$r6valuesprefixkvs r list_valuesrNSs0 76?D T  .ff---............... 4:fQ$???@@@@@+x77R / /Aq A} $777 AA f-a--!--...  / / :>>setkey)requiredvaluec|jd}|jd}|jd}t|||||\}}}|rtj|d|dSt jddS)z Store the given key/value. This doesn't follow symlinks, to avoid accidentally modifying a file at a potentially untrusted path. r*r(r)rDr N)r+rrErFr3r5)r#rQrSr$r%r&successs r set_valuerVps 76?D GG E WX F!$UE6BBGS% c##E##$$$$$  r-c|jd}t|5}t|}dddn #1swxYwY||}|rt j|dSt jddS)z%Retrieve the value for the given key.r*r@Nr )r+r8r getrErFr3r5)r#rQr$r6rJ stored_values rrXrXs 76?D T  .ff---...............::c??L <       rOc|jd}|jd}t|||\}}|rtjd|dSt jddS)z Removes the given key. This doesn't follow symlinks, to avoid accidentally modifying a file at a potentially untrusted path. r*r(zSuccessfully removed r N)r+rrErFr3r5)r#rQr$r%rUs runsetr[sh 76?D GG ET3..LGS 030011111  r-)allow_extra_argsallow_interspersed_argsignore_unknown_options)context_settingsz--override/--no-overridezKOverride variables from the environment file with those from the .env file.)rr commandline)nargsroverride.ct|jd}tj|st jd|d|fdt |D}|s(t jdtj dtg||j |dS) z/Run command with environment variables present.r*zInvalid value for '-f' "z" does not exist.)r#c@i|]\}}|s|tjv||S)N)renviron).0rLrMrcs r zrun..s> Q =h=!2:*=*= 1*=*=*=r-zNo command given.r N) r+rrisfilerE BadParameterr itemsrFr3r5 run_commandargs)r#rcr`r$dotenv_as_dicts ` rrunros 76?D 7>>$    @ @ @ @c    #D))//11N  &'''  )+))>:::::r-commandenvcRtj}||tjdkrFt |ddd|}|\}}t j|j dStj |d||dS)aReplace 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 TrF)universal_newlinesbufsizer>rq)rmrqN) rrfcopyupdater3platformr communicater5 returncodeexecvpe)rprqcmd_envp_s rrlrls*jooG NN3 |w 'dAUPW X X X}}1  71:G999999r-)3r=rrIr3 contextlibrtypingrrrrrr rw subprocessr rE ImportErrorr4writer5mainr rrr"rstrrgroupoptionPathChoiceBOOLversion_option pass_contextContextr,PathLiker8rprNargumentrVrXr[ UNPROCESSEDbooltuplerorlr-rrs %%%%%%::::::::::::::::<7      LLLLJ < CHQKKKKK 4333333333  x}       MOO d # # # Y   111 2 2 m    F k***?U]?#?c?3?4???+*0?  bk hr#w&7    &   ;;; < < 0 /U]/3/4////&%%%%$'''5=s34('&%$%%% U]     &% %%% u} 3 4   &%   #("&    V  Re.?@@@;U];d;sCx;T;;;A@ ;( :c :c3h :D : : : : : :s>/A0/A0