
    5iP4                     4   S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SKJ	r	  S SK
Jr  S SKJrJrJrJrJrJrJrJr  SSKJrJr  SSKJr  \\S4   r\R8                  " \5      rS	\4S
 jr S\\   S	\\   4S jr! " S S5      r" S*S\S\S\\   S	\\   4S jjr#\S\S\\   S	\\\\   \\   4      4S j5       r$   S+S\S\S\S\S\S\\   S	\\\   \\4   4S jjr%  S,S\S\S\S\\   S	\\\   \4   4
S jjr&S\\\\\   4      S\S	\\\\   4   4S jr'S\S	\\   4S jr(   S-S \S!\S"\S	\4S# jjr)      S.S\\   S$\\\      S%\S\S&\S\\   S	\4S' jjr*     S/S\\   S$\\\      S%\S&\S\\   S	\\\\   4   4S( jjr+S\S	\4S) jr,g)0    N)OrderedDict)contextmanager)IODictIterableIteratorMappingOptionalTupleUnion   )Bindingparse_stream)parse_variableszos.PathLike[str]returnc                  x    S[         R                  ;  a  g[         R                  S   R                  5       n U S;   $ )z0
Determine if dotenv loading has been disabled.
PYTHON_DOTENV_DISABLEDF>   1tyyestrue)osenvironcasefold)values    Y/var/www/html/BTCUSD/btcusdt_trading_app/venv/lib/python3.13/site-packages/dotenv/main.py_load_dotenv_disabledr      s7      rzz1JJ/099;E222    mappingsc              #      #    U  HB  nUR                   (       a*  [        R                  SUR                  R                  5        Uv   MD     g 7f)Nz;python-dotenv could not parse statement starting at line %s)errorloggerwarningoriginalline)r    mappings     r   with_warn_for_invalid_linesr(   #   s;     ==NNM  %%  s   A
Ac                       \ rS rSr     SS\\   S\\\      S\S\\   S\S\S	S4S
 jjr	\
S	\\\      4S j5       rS	\\\\   4   4S jrS	\\\\\   4      4S jrS	\4S jrS\S	\\   4S jrSrg)DotEnv-   Ndotenv_pathstreamverboseencodinginterpolateoverrider   c                 Z    Xl         X l        S U l        X0l        X@l        XPl        X`l        g N)r,   r-   _dictr.   r/   r0   r1   )selfr,   r-   r.   r/   r0   r1   s          r   __init__DotEnv.__init__.   s+     /:)/9=
$'/!,&r   c              #     #    U R                   (       aF  [        U R                   5      (       a,  [        U R                   U R                  S9 nUv   S S S 5        g U R                  b  U R                  v   g U R
                  (       a)  [        R                  SU R                   =(       d    S5        [        R                  " S5      v   g ! , (       d  f       g = f7f)Nr/   z3python-dotenv could not find configuration file %s..env )
r,   _is_file_or_fifoopenr/   r-   r.   r#   infoioStringIO)r5   r-   s     r   _get_streamDotEnv._get_stream?   s      01A1A B Bd&&?6 @?[[$++||I$$. ++b/! @?s   A
CC	A8C	
CCc                    U R                   (       a  U R                   $ U R                  5       nU R                  (       a-  [        [	        XR
                  S95      U l         U R                   $ [        U5      U l         U R                   $ )zReturn dotenv as dict)r1   )r4   parser0   r   resolve_variablesr1   )r5   
raw_valuess     r   dictDotEnv.dictN   sc    ::::ZZ\
$!*}}EDJ zz %Z0DJzzr   c              #      #    U R                  5        n[        [        U5      5       H,  nUR                  c  M  UR                  UR                  4v   M.     S S S 5        g ! , (       d  f       g = f7fr3   )rA   r(   r   keyr   )r5   r-   r'   s      r   rD   DotEnv.parse^   sP     66|F7KL;;*!++w}}44 M  s!   A2#A!A!	A2!
A/+A2c                     U R                  5       (       d  gU R                  5       R                  5        HD  u  pU[        R                  ;   a  U R                  (       d  M,  Uc  M1  U[        R                  U'   MF     g)z9
Load the current dotenv as system environment variable.
FT)rG   itemsr   r   r1   )r5   kvs      r   set_as_environment_variables#DotEnv.set_as_environment_variablesd   sX     yy{{IIK%%'DABJJt}}} !

1	 ( r   rJ   c                     U R                  5       nX;   a  X!   $ U R                  (       a   [        R                  SXR                  5        g)r;   zKey %s not found in %s.N)rG   r.   r#   r$   r,   )r5   rJ   datas      r   get
DotEnv.gets   s9    yy{;9<<NN4c;K;KLr   )r4   r,   r/   r0   r1   r-   r.   )NFNTT)__name__
__module____qualname____firstlineno__r
   StrPathr   strboolr6   r   r   rA   r   rG   r   rD   rP   rT   __static_attributes__ r   r   r*   r*   -   s     %)"& 'g&' C!' 	'
 3-' ' ' 
'" "Xbg. " "d3-.  5xc8C=&8 9: 5d 
s 
x} 
r   r*   r,   
key_to_getr/   c                 6    [        U SUS9R                  U5      $ )zs
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*   rT   )r,   r_   r/   s      r   get_keyra      s     +th?CCJOOr   pathc              #     #    [         R                  " U 5      R                  5         [        R                  " SUSS9 nS n [        XS9 nXB4v   S S S 5        S S S 5        Wc"  [        R                  " WR                  U 5        g [        R                  " WR                  5        US e! , (       d  f       N^= f! [         a  nUn S nANrS nAff = f! , (       d  f       N= f7f)NwF)moder/   deleter9   )pathlibPathtouchtempfileNamedTemporaryFiler=   BaseExceptionshutilmovenamer   unlink)rb   r/   destr"   sourceerrs         r   rewritert      s     
 LL		$	$#	OSW	d.&n$ / 
P }DIIt$
		$)) /. 	E	 
P	Ose   ;C#C	B9
B(B9AC#(
B6	2B95C6B99
CC
C
CC
C C#
key_to_setvalue_to_set
quote_modeexportc                    US;  a  [        SU 35      eUS:H  =(       d!    US:H  =(       a    UR                  5       (       + nU(       a"  SR                  UR                  SS5      5      nOUnU(       a
  SU S	U S
3nOU S	U S
3n[	        XS9 u  pSnSn[        [        U	5      5       Hw  nUR                  U:X  a  U
R                  U5        SnM(  U
R                  UR                  R                  5        UR                  R                  R                  S
5      (       + nMy     U(       d)  U(       a  U
R                  S
5        U
R                  U5        SSS5        SX4$ ! , (       d  f       N= f)z
Adds or Updates a key/value to the given .env

If the .env path given doesn't exist, fails instead of risking creating
an orphan .env somewhere in the filesystem
)alwaysautoneverzUnknown quote_mode: rz   r{   z'{}''z\'zexport =
r9   FTN)
ValueErrorisalnumformatreplacert   r(   r   rJ   writer%   stringendswith)r,   ru   rv   rw   rx   r/   quote	value_outline_outrr   rq   replacedmissing_newliner'   s                 r   set_keyr      sS    44/
|<==(" f;\%9%9%;!; 
 MM,"6"6sE"BC	 	ZL)B7 \9+R0		0NV2<3GHG{{j(

8$

7++223&-&6&6&=&=&F&Ft&L"L I 

4 JJx  
1 )) 
1	0s   CE!!
E/key_to_unsetc                    [         R                  R                  U 5      (       d  [        R	                  SU 5        SU4$ Sn[        XS9 u  pV[        [        U5      5       H<  nUR                  U:X  a  SnM  UR                  UR                  R                  5        M>     SSS5        U(       d  [        R	                  SX5        SU4$ XA4$ ! , (       d  f       N2= f)z
Removes a given key from the given `.env` file.

If the .env path given doesn't exist, fails.
If the given key doesn't exist in the .env, fails.
z(Can't delete from %s - it doesn't exist.NFr9   Tz/Key %s not removed from %s - key doesn't exist.)r   rb   existsr#   r$   rt   r(   r   rJ   r   r%   r   )r,   r   rw   r/   removedrr   rq   r'   s           r   	unset_keyr      s     77>>+&&A;O\!!G		0NV2<3GHG{{l*

7++223	 I 
1 =|	
 \!!   
1	0s   
AC
Cvaluesr1   c                 V  ^ 0 nU  H  u  p4Uc  S nO[        U5      n0 mU(       a1  TR                  [        R                  5        TR                  U5        O0TR                  U5        TR                  [        R                  5        SR	                  U4S jU 5       5      nXRU'   M     U$ )Nr;   c              3   D   >#    U  H  oR                  T5      v   M     g 7fr3   )resolve).0atomenvs     r   	<genexpr>$resolve_variables.<locals>.<genexpr>  s     A54\\#..5s    )r   updater   r   join)r   r1   
new_valuesro   r   resultatomsr   s          @r   rE   rE      s     ,.J=F#E*E,.C

2::&

:&

:&

2::&WWA5AAF!4   r   c              #     #    [         R                  R                  U 5      (       d  [        S5      e[         R                  R	                  U 5      (       a  [         R                  R                  U 5      n Sn[         R                  R                  U 5      nX:w  ac  Uv   [         R                  R                  [         R                  R                  U[         R                  R                  5      5      nX#p!X:w  a  Mb  gg7f)zD
Yield directories starting from the given directory up to the root
zStarting path not foundN)	r   rb   r   IOErrorisfiledirnameabspathr   pardir)rb   last_dircurrent_dir
parent_dirs       r   _walk_to_rootr     s      77>>$/00	ww~~dwwt$H''//$'K

!WW__RWW\\+rww~~%NO
 ++ 
!s   C9C?=C?filenameraise_error_if_not_foundusecwdc                    S nS nU(       d.  U" 5       (       d"  U" 5       (       d  [        [        SS5      (       a  [        R                  " 5       nGO0[        R                  " 5       n[
        nUR                  R                  U:X  d8  [        R                  R                  UR                  R                  5      (       dq  UR                  c   eUR                  nUR                  R                  U:X  a  M7  [        R                  R                  UR                  R                  5      (       d  Mq  UR                  R                  n[        R                  R                  [        R                  R                  U5      5      n[        U5       H6  n	[        R                  R                  X5      n
[        U
5      (       d  M4  U
s  $    U(       a  [!        S5      eg)z{
Search in increasingly higher folders for the given file

Returns path to the file if found, or an empty string otherwise
c                      [        [        S5      (       d  [        [        S5      (       a  g [        SSSS/S9n [        U S5      (       + $ ! [         a     gf = f)	z<Decide whether this is running in a REPL or IPython notebookps1ps2T__main__N__file__)fromlistF)hasattrsys
__import__ModuleNotFoundError)mains    r   _is_interactive$find_dotenv.<locals>._is_interactive*  s[    3'#u"5"5	j$
|LD 4,,, # 		s   A 
AAc                  0    [         R                  " 5       S L$ r3   )r   gettracer^   r   r   _is_debugger!find_dotenv.<locals>._is_debugger4  s    ||~T))r   frozenFzFile not foundr;   )getattrr   r   getcwd	_getframer   f_codeco_filenamerb   r   f_backr   r   r   r   r<   r   )r   r   r   r   r   rb   framecurrent_fileframe_filenamer   
check_paths              r   find_dotenvr     sC   -* ""lnnXu8U8Uyy{ ll&&,6bggnnLL$$?
 ?
 <<+++LLE	 ll&&,6bggnnLL$$?
 ?

 11wwrww~>? &WW\\'4
J'' '
  &''r   r-   r.   r0   c           	          [        5       (       a  [        R                  S5        gU c  Uc
  [        5       n [	        U UUUUUS9nUR                  5       $ )a  Parse 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 variableFr,   r-   r.   r0   r1   r/   )r   r#   debugr   r*   rP   )r,   r-   r.   r1   r0   r/   dotenvs          r   load_dotenvr   R  s_    : a	
 v~!mF ..00r   c           	      Z    U c  Uc
  [        5       n [        U UUUSUS9R                  5       $ )aa  
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   )r   r*   rG   )r,   r-   r.   r0   r/   s        r   dotenv_valuesr     s=    . v~!m dfr   c                     [         R                  R                  U 5      (       a  g [         R                  " U 5      n[        R                  " UR                  5      $ ! [        [
        4 a     gf = f)zF
Return True if `path` exists and is either a regular file or a FIFO.
TF)r   rb   r   statFileNotFoundErrorOSErrorS_ISFIFOst_mode)rb   sts     r   r<   r<     sZ     
ww~~dWWT] ==$$ w' s   A A0/A0)utf-8)rz   Fr   )rz   r   )r:   FF)NNFFTr   )NNFTr   )-r?   loggingr   rg   rm   r   r   rj   collectionsr   
contextlibr   typingr   r   r   r   r	   r
   r   r   parserr   r   	variablesr   r[   rZ   	getLoggerrV   r#   r\   r   r(   r*   ra   rt   r   r   rE   r   r   r   r   r<   r^   r   r   <module>r      s?   	  	    
  # % P P P ) & ''
(			8	$3t 3(7*; @Q P Pl &
P
P
P sm
P c]	
P 
sm eBsGRW$%& 2 %-*-*-* -* 	-*
 -* sm-* 8D>3#$-*f %	!!! ! sm	!
 8D>3!BU3-./ S(3- 28 8 8& %*00"0 0 		0h &* $%.1'".1RW.1 .1 	.1
 .1 sm.1 
.1d &* $%!'"!RW! ! 	!
 sm! 
#x}
!H%7 %t %r   