K i%ddlZddlZddlZddlZddlmZddlmZmZm Z m Z m Z m Z ejdk(rddlmZ ddlZddlmZmZmZdd lmZd e efd Zej:ej<d d eej>ddej<dddej@gddej<dddejBdejDeejFdejHdededed df d Z%ed!ejLd e eefd"Z'e%jQd#$ejFej<d%d&d'ej@gd(d)dejHd&ed dfd*Z)e%jQd+$ejFejTd,d-ejTd.d-dejHd,ed.ed dfd/Z+e%jQejFejTd,d-dejHd,ed dfd0Z,e%jQejFejTd,d-dejHd,ed dfd1Z-e%jQd2di3ejFej<d4dd56ejTd7d8ej\9dejHd:e/d7e ed dfd;Z0dZ1y#e$r1ej$j'dej(dY.wxYw)?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}tjj |d}|S#t$rYywxYw)zZ Return a path for the ${pwd}/.env file. If pwd does not exist, return None. Nz.env)osgetcwdFileNotFoundErrorpathjoin)cwdrs P/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/dotenv/cli.py enumerate_envrsA iik 77<<V $D K s8 AAz-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|_y)zAThis script is used to set, get or unset values from a .env file.)QUOTEEXPORTFILEN)obj)r#r$r%r&s rclir,&s4>CGrc#K t|5}|dddy#1swYyxYw#t$r=}td|tjtj dYd}~yd}~wwxYww)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_ $Z 6L     (.SZZ@  sCA2 ))A2&)A2) A/3A*%A2*A//A2list)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|}ddd|dk(r,tjt j ddy|dk(rd nd }tD]?}||}| |d vrtj|}tj||d |Ay#1swYxYw) 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_valuesrNSs 776?D T .ff-. 4::fQ$?@+x7R /Aq A} $77 AA fXaS!-.  /..s B88Csetkey)requiredvaluec|jd}|jd}|jd}t|||||\}}}|rtj|d|yt j dy)zStore the given key/value.r*r(r)rDr N)r+rrErFr3r5)r#rPrRr$r%r&successs r set_valuerUpsk 776?D GGG E WWX F!$UE6BGS% cU!E7#$  r-c|jd}t|5}t|}dddj|}|rt j |yt jdy#1swYHxYw)z%Retrieve the value for the given key.r*r@Nr )r+r8r getrErFr3r5)r#rPr$r6rJ stored_values rrWrWsc 776?D T .ff-.::c?L <   ..s A//A8c|jd}|jd}t|||\}}|rtjd|yt j dy)zRemoves the given key.r*r(zSuccessfully removed r N)r+rrErFr3r5)r#rPr$r%rTs runsetrZsS 776?D GGG ET3.LGS *3%01  r-ignore_unknown_options)context_settingsz--override/--no-overridezKOverride variables from the environment file with those from the .env file.)rr commandline)nargsroverridec|jd}tjj|st j d|d|t |jDcic]\}}||s|tjvr|| }}}|s*t jdtjdt||ycc}}w)z/Run command with environment variables present.r*zInvalid value for '-f' "z" does not exist.)r#NzNo command given.r ) r+rrisfilerE BadParameterr itemsenvironrFr3r5 run_command)r#r`r]r$rLrMdotenv_as_dicts rrunrhs 776?D 77>>$   'v-? @c  $D)//1 Q =h!2::*= 1N  &'   ^,s&#CcommandenvcDtjj}|j|tj dk(rCt |ddd|}|j\}}t j|jytj|d||y)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>rj)argsrjN) rrecopyupdater3platformr communicater5 returncodeexecvpe)rirjcmd_envp_s rrfrfst*jjooG NN3 ||w 'dAUPW X}}1  71:G9r-)2r=rrIr3 contextlibrtypingrrrrrr rq subprocessr rE ImportErrorr4writer5mainr rrr"rstrrgroupoptionPathChoiceBOOLversion_option pass_contextContextr,PathLiker8rirNargumentrUrWrZ UNPROCESSEDboolrhrfr-rrs %::<<7 43  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}}34&7>?   V  Re.?.?@-U]]-d-c-t-A @-& :c :c3h :D :[JJ < CHHQK sL::2M0/M0