K iP4ddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z mZmZmZmZmZmZmZddlmZmZddlmZeedfZej8eZd efd Z d eed eefd Z!Gd dZ" d*dededeed eefdZ#e dedeed eee ee effdZ$ d+dedededededeed eeeeeffdZ% d,dedededeed eeeeff dZ&deeeeefded eeeeffdZ'ded eefdZ( d-d ed!ed"ed efd#Z) d.deed$ee ed%eded&edeed efd'Z* d/deed$ee ed%ed&edeed eeeeff d(Z+ded efd)Z,y)0N) OrderedDict)contextmanager)IODictIterableIteratorMappingOptionalTupleUnion)Binding parse_stream)parse_variableszos.PathLike[str]returncrdtjvrytjdj}|dvS)z8 Determine if dotenv loading has been disabled. PYTHON_DOTENV_DISABLEDF>1tyyestrue)osenvironcasefold)values Q/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/dotenv/main.py_load_dotenv_disabledrs7 rzz1 JJ/ 0 9 9 ;E 2 22mappingsc#K|D]<}|jr*tjd|jj|>yw)Nz;python-dotenv could not parse statement starting at line %s)errorloggerwarningoriginalline)r mappings rwith_warn_for_invalid_linesr(#sA == NNM  %%  sAAceZdZ ddeedeeededeedededdfd Ze de eefd Z de eeeffd Z de eeeeffd Zdefd ZdedeefdZy)DotEnvN dotenv_pathstreamverboseencoding interpolateoverridercf||_||_d|_||_||_||_||_yN)r+r,_dictr-r.r/r0)selfr+r,r-r.r/r0s r__init__zDotEnv.__init__.s7/:)/ 9= $ '/ !,& rc#K|jrDt|jr/t|j|j5}|dddy|j|jy|j r$t jd|jxsdtjdy#1swYyxYww)Nr.z3python-dotenv could not find configuration file %s..env) r+_is_file_or_fifoopenr.r,r-r#infoioStringIO)r4r,s r _get_streamzDotEnv._get_stream?s    01A1A Bd&&? 6    [[ $++ || I$$.++b/ !  sACB6 A,C6B?;Cc|jr |jS|j}|jr1tt ||j |_|jSt||_|jS)zReturn dotenv as dict)r0)r3parser/rresolve_variablesr0)r4 raw_valuess rdictz DotEnv.dictNse :::: ZZ\   $!*t}}EDJ zz%Z0DJzzrc#K|j5}tt|D])}|j|j|jf+ dddy#1swYyxYwwr2)r?r(rkeyr)r4r,r's rrAz DotEnv.parse^s^     566|F7KL 5;;*!++w}}44 5 5 5 5s!A*$AA A*A'#A*c|jsy|jjD]:\}}|tjvr |js%|(|tj|<<y)zI Load the current dotenv as system environment variable. FT)rDitemsrrr0)r4kvs rset_as_environment_variablesz#DotEnv.set_as_environment_variablesds]yy{IIK%%' "DAqBJJt}}} ! 1  " rrFc|j}||vr||S|jr!tjd||jy) zKey %s not found in %s.N)rDr-r#r$r+)r4rFdatas rgetz DotEnv.getss?yy{ $;9  << NN4c4;K;K Lr)NFNTT)__name__ __module__ __qualname__r StrPathrstrboolr5rrr?rrDr rArKrOrrr*r*-s%)"& 'g&'C!' ' 3- '  '' '" "Xbg. " "d3 -. 5xc8C=&8 9:5 d  s x} rr*r+ key_to_getr.c<t|d|j|S)z Get the value of a given key from the given .env. Returns `None` if the key isn't found or doesn't have a value. T)r-r.)r*rO)r+rWr.s rget_keyrYs +th ? C CJ OOrpathc#Ktj|jtjd|d5}d} t ||5}||fdddddd!tjj|ytjj|d#1swYVxYw#t $r }|}Yd}~id}~wwxYw#1swYrxYww)NwF)moder.deleter7) pathlibPathtouchtempfileNamedTemporaryFiler; BaseExceptionshutilmovenamerunlink)rZr.destr"sourceerrs rrewriterls  LL  $ $# OSW dX. %&tn$ % } DIIt$ $)) % % E  sY>+ &A;O\!!G x 04NVT2<3GH 4G{{l* 7++223  44  =|[ \!! L  44s ACCvaluesr0cHi}|D]\}}|d}nt|}i|r1jtjj|n0j|jtjdj fd|D}|||<|S)Nr9c3@K|]}|jywr2)resolve).0atomenvs r z$resolve_variables..sA4T\\#.As)rupdaterrjoin)rr0 new_valuesrgrresultatomsrs @rrBrBs,.J" e =F#E*E,.C 2::& :& :& 2::&WWA5AAF! 4" rc#Ktjj|s tdtjj |rtjj |}d}tjj |}||k7rd|tjj tjj|tjj}||}}||k7rcyyw)zL Yield directories starting from the given directory up to the root zStarting path not foundN) rrZrIOErrorisfiledirnameabspathrpardir)rZlast_dir current_dir parent_dirs r _walk_to_rootr s 77>>$ /00 ww~~dwwt$H''//$'K k !WW__RWW\\+rww~~%NO +Z+ k !s C1C64C6filenameraise_error_if_not_foundusecwdcVd}d}|s|s|sttddrtj}n tj}t }|j j|k(s3tjj|j jsh|jJ|j}|j j|k(r4tjj|j jsh|j j}tjjtjj|}t|D]1} tjj| |} t| s/| cS|r t!dy)z Search in increasingly higher folders for the given file Returns path to the file if found, or an empty string otherwise cttdsttdry tddddg}t|d S#t$rYywxYw) z._is_interactive*sU 3 '#u"5 j$ |LD4,,,#  sA A  A c.tjduSr2)rgettracerVrr _is_debuggerz!find_dotenv.._is_debugger4s||~T))rfrozenFzFile not foundr9)getattrrrgetcwd _getframerf_code co_filenamerZrf_backrrrrr:r) rrrrrrZframe current_fileframe_filenamer check_paths r find_dotenvrs5-*"lnXu8Uyy{  ll&&,6bggnn LL $ $? <<+ ++LLE ll&&,6bggnn LL $ $? 11wwrww~>? &WW\\'84 J '   &'' rr,r-r/ctrtjdy| | t}t ||||||}|j S)aParse a .env file and then load all the variables found as environment variables. Parameters: dotenv_path: Absolute or relative path to .env file. stream: Text stream (such as `io.StringIO`) with .env content, used if `dotenv_path` is `None`. verbose: Whether to output a warning the .env file is missing. override: Whether to override the system environment variables with the variables from the `.env` file. encoding: Encoding to be used to read the file. Returns: Bool: True if at least one environment variable is set else False If both `dotenv_path` and `stream` are `None`, `find_dotenv()` is used to find the .env file with it's default parameters. If you need to change the default parameters of `find_dotenv()`, you can explicitly call `find_dotenv()` and pass the result to this function as `dotenv_path`. If the environment variable `PYTHON_DOTENV_DISABLED` is set to a truthy value, .env loading is disabled. zSpython-dotenv: .env loading disabled by PYTHON_DOTENV_DISABLED environment variableFr+r,r-r/r0r.)rr#debugrr*rK)r+r,r-r0r/r.dotenvs r load_dotenvrRs\: a v~!m  F  . . 00rc\| | t}t||||d|jS)a Parse a .env file and return its content as a dict. The returned dict will have `None` values for keys without values in the .env file. For example, `foo=bar` results in `{"foo": "bar"}` whereas `foo` alone results in `{"foo": None}` Parameters: dotenv_path: Absolute or relative path to the .env file. stream: `StringIO` object with .env content, used if `dotenv_path` is `None`. verbose: Whether to output a warning if the .env file is missing. encoding: Encoding to be used to read the file. If both `dotenv_path` and `stream` are `None`, `find_dotenv()` is used to find the .env file. Tr)rr*rD)r+r,r-r/r.s r dotenv_valuesrs=.v~!m    df rctjj|ry tj|}tj |jS#tt f$rYywxYw)zN Return True if `path` exists and is either a regular file or a FIFO. TF)rrZrstatFileNotFoundErrorOSErrorS_ISFIFOst_mode)rZsts rr:r:sW ww~~d WWT] == $$ w 'sAA('A()utf-8)rrFr)rrr)r8FF)NNFFTr)NNFTr)-r=loggingrr_rerrrb collectionsr contextlibrtypingrrrrr r r r parserrr variablesrrTrS getLoggerrPr#rUrr(r*rYrlrrrBrrrrr:rVrrrsA   #%PPP)& '' (   8 $3t3(7*;@QPPl& P P Psm Pc] P smeBsGRW$%&2% -*-*-*-* -*  -* sm -* 8D>3 #$-*f% !!!!sm !  8D>3  !B U3 -. / S(3-  288 8&%*00"0 0 0h&* $% .1'".1 RW .1.1 .1  .1 sm .1 .1d&* $% ! '"! RW ! !  ! sm !  #x}  ! H %7 %t %r