
    ,hd0                        d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlmZ d dl	m
Z
 d dlmZmZmZmZmZmZmZmZ ddlmZmZ ddlmZ eedf   Z ej6                  e      Zd	ee   d
ee   fdZ G d d      Z	 d(dededee   d
ee   fdZ e
dedee   d
eeee   ee   f      fd       Z!	 	 	 d)dedededede"dee   d
eee"   eef   fdZ#	 	 d*dedededee   d
eee"   ef   f
dZ$deeeee   f      de"d
eeee   f   fdZ%ded
ee   fdZ&	 	 	 d+ded e"d!e"d
efd"Z'	 	 	 	 	 	 d,dee   d#eee      d$e"de"d%e"dee   d
e"fd&Z(	 	 	 	 	 d-dee   d#eee      d$e"d%e"dee   d
eeee   f   fd'Z)y).    N)OrderedDict)contextmanager)IODictIterableIteratorMappingOptionalTupleUnion   )Bindingparse_stream)parse_variableszos.PathLike[str]mappingsreturnc              #      K   | D ]<  }|j                   r*t        j                  d|j                  j                         | > y w)Nz;python-dotenv could not parse statement starting at line %s)errorloggerwarningoriginalline)r   mappings     M/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/dotenv/main.pywith_warn_for_invalid_linesr      sA      ==NNM  %% s   AAc                       e Zd Z	 	 	 	 	 ddee   deee      dedee   dededdfd	Ze	de
ee      fd
       Zdeeee   f   fdZde
eeee   f      fdZdefdZdedee   fdZy)DotEnvNdotenv_pathstreamverboseencodinginterpolateoverrider   c                 f    || _         || _        d | _        || _        || _        || _        || _        y N)r   r   _dictr    r!   r"   r#   )selfr   r   r    r!   r"   r#   s          r   __init__zDotEnv.__init__#   s7     /:)/9=
$'/!,&    c              #     K   | j                   rXt        j                  j                  | j                         r/t	        | j                   | j
                        5 }| d d d        y | j                  | j                   y | j                  r$t        j                  d| j                   xs d       t        j                  d       y # 1 sw Y   y xY ww)Nr!   z3python-dotenv could not find configuration file %s..env )r   ospathisfileopenr!   r   r    r   infoioStringIO)r'   r   s     r   _get_streamzDotEnv._get_stream4   s     t/?/? @d&&? 6 [[$++||I$$. ++b/! s   ACC
A,C
CCc                    | j                   r| j                   S | j                         }| j                  r1t        t	        || j
                              | _         | j                   S t        |      | _         | j                   S )zReturn dotenv as dict)r#   )r&   parser"   r   resolve_variablesr#   )r'   
raw_valuess     r   dictzDotEnv.dictC   se    ::::ZZ\
$!*t}}EDJ zz %Z0DJzzr)   c              #      K   | j                         5 }t        t        |            D ])  }|j                  |j                  |j                  f + 	 d d d        y # 1 sw Y   y xY wwr%   )r5   r   r   keyvalue)r'   r   r   s      r   r7   zDotEnv.parseS   s^      	566|F7KL 5;;*!++w}}445	5 	5 	5s!   A*$AA	A*A'#A*c                     | j                         sy| j                         j                         D ]:  \  }}|t        j                  v r| j                  s%|(|t        j                  |<   < y)zI
        Load the current dotenv as system environment variable.
        FT)r:   itemsr.   environr#   )r'   kvs      r   set_as_environment_variablesz#DotEnv.set_as_environment_variablesY   s]     yy{IIK%%' 	"DAqBJJt}}} !

1		" r)   r<   c                     | j                         }||v r||   S | j                  r!t        j                  d|| j                         y) zKey %s not found in %s.N)r:   r    r   r   r   )r'   r<   datas      r   getz
DotEnv.geth   s?    yy{$;9<<NN4c4;K;KLr)   )NFNTT)__name__
__module____qualname__r
   StrPathr   strboolr(   r   r   r5   r   r:   r   r7   rC   rG    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                 <    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   rG   )r   rO   r!   s      r   get_keyrQ   u   s     +th?CCJOOr)   r/   c              #     K   t        j                  |       j                          t        j                  d|d      5 }d }	 t        | |      5 }||f d d d        d d d        !t        j                  j                  |        y t        j                  j                         |d # 1 sw Y   VxY w# t        $ r}|}Y d }~id }~ww xY w# 1 sw Y   rxY ww)NwF)moder!   deleter+   )pathlibPathtouchtempfileNamedTemporaryFiler1   BaseExceptionshutilmovenamer.   unlink)r/   r!   destr   sourceerrs         r   rewriterc      s     
 LL		$	$#	O SW	dX. %&tn$% }DIIt$
		$))% % 	E	 sY   <CCB7B+B7AC+B4	0B77	C CCCCCC
key_to_setvalue_to_set
quote_modeexportc                    |dvrt        d|       |dk(  xs |dk(  xr |j                          }|r"dj                  |j                  dd            }n|}|r
d| d	| d
}n| d	| d
}t	        | |      5 \  }	}
d}d}t        t        |	            D ]p  }|j                  |k(  r|
j                  |       d}&|
j                  |j                  j                         |j                  j                  j                  d
       }r |s$|r|
j                  d
       |
j                  |       ddd       d||fS # 1 sw Y   xY w)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: ri   rj   z'{}''z\'zexport =
r+   FTN)
ValueErrorisalnumformatreplacerc   r   r   r<   writer   stringendswith)r   rd   re   rf   rg   r!   quote	value_outline_outra   r`   replacedmissing_newliner   s                 r   set_keyr{      sf    44/
|<==(" f;\%9%9%;!; 
 MM,"6"6sE"BC	 	ZL)B7 \9+R0	x	0 !NVT2<3GH 	MG{{j(

8$

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

4 JJx ! \))! !s   9B5D;;Ekey_to_unsetc                    t         j                  j                  |       st        j	                  d|        d|fS d}t        | |      5 \  }}t        t        |            D ]9  }|j                  |k(  rd}|j                  |j                  j                         ; 	 ddd       |st        j	                  d||        d|fS ||fS # 1 sw Y   *xY w)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.NFr+   Tz/Key %s not removed from %s - key doesn't exist.)r.   r/   existsr   r   rc   r   r   r<   rs   r   rt   )r   r|   rf   r!   removedra   r`   r   s           r   	unset_keyr      s     77>>+&A;O\!!G	x	0 4NVT2<3GH 	4G{{l*

7++223		44 =|[	
 \!!L  4 4s   	ACCvaluesr#   c                 H   i }| D ]  \  }}|d }nt        |      }i |r1j                  t        j                         j                  |       n0j                  |       j                  t        j                         dj	                  fd|D              }|||<    |S )Nr-   c              3   @   K   | ]  }|j                          y wr%   )resolve).0atomenvs     r   	<genexpr>z$resolve_variables.<locals>.<genexpr>   s     A4T\\#.As   )r   updater.   r@   join)r   r#   
new_valuesr^   r=   resultatomsr   s          @r   r8   r8      s     ,.J "e=F#E*E,.C

2::&

:&

:&

2::&WWA5AAF!
4"  r)   c              #     K   t         j                  j                  |       st        d      t         j                  j	                  |       rt         j                  j                  |       } d}t         j                  j                  |       }||k7  rd| t         j                  j                  t         j                  j                  |t         j                  j                              }||}}||k7  rcyyw)zL
    Yield directories starting from the given directory up to the root
    zStarting path not foundN)	r.   r/   r~   IOErrorr0   dirnameabspathr   pardir)r/   last_dircurrent_dir
parent_dirs       r   _walk_to_rootr     s      77>>$/00	ww~~dwwt$H''//$'K
k
!WW__RWW\\+rww~~%NO
 +Z+ k
!s   C1C64C6filenameraise_error_if_not_foundusecwdc                 ~   d }d }|s |       s |       st        t        dd      rt        j                         }n t        j                         }t
        }|j                  j                  |k(  s3t        j                  j                  |j                  j                        sh|j                  J |j                  }|j                  j                  |k(  r4t        j                  j                  |j                  j                        sh|j                  j                  }t        j                  j                  t        j                  j                  |            }t        |      D ]E  }	t        j                  j                  |	|       }
t        j                  j                  |
      sC|
c S  |rt!        d      y)z
    Search in increasingly higher folders for the given file

    Returns path to the file if found, or an empty string otherwise
    c                  \    	 t        ddddg      } t        | d       S # t        $ r Y yw xY w)z<Decide whether this is running in a REPL or IPython notebook__main__N__file__)fromlistF)
__import__ModuleNotFoundErrorhasattr)mains    r   _is_interactivez$find_dotenv.<locals>._is_interactive  s?    	j$
|LD 4,,, # 		s    	++c                  .    t        j                         d uS r%   )sysgettracerN   r)   r   _is_debuggerz!find_dotenv.<locals>._is_debugger'  s    ||~T))r)   frozenFzFile not foundr-   )getattrr   r.   getcwd	_getframer   f_codeco_filenamer/   r~   f_backr   r   r   r   r0   r   )r   r   r   r   r   r/   framecurrent_fileframe_filenamer   
check_paths              r   find_dotenvr     s:   -* "lnXu8Uyy{ ll&&,6bggnnLL$$?
 <<++LLE	 ll&&,6bggnnLL$$?

 11wwrww~>? & WW\\'84
77>>*%
  &''r)   r   r    r"   c                 `    | |
t               } t        | |||||      }|j                         S )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`.
    r   r   r    r"   r#   r!   )r   r   rC   )r   r   r    r#   r"   r!   dotenvs          r   load_dotenvr   E  sB    4 v~!mF ..00r)   c                 \    | |
t               } t        | |||d|      j                         S )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   )r   r   r:   )r   r   r    r"   r!   s        r   dotenv_valuesr   m  s=    . v~!m dfr)   )utf-8)ri   Fr   )ri   r   )r,   FF)NNFFTr   )NNFTr   )*r3   loggingr.   rV   r\   r   rY   collectionsr   
contextlibr   typingr   r   r   r   r	   r
   r   r   parserr   r   	variablesr   rL   rK   	getLoggerrH   r   r   r   rQ   rc   rM   r{   r   r8   r   r   r   r   rN   r)   r   <module>r      s   	  	   
  # % P P P ) & ''
(			8	$(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& %*..". . 		.d &* $%%1'"%1RW%1 %1 	%1
 %1 sm%1 
%1R &* $%!'"!RW! ! 	!
 sm! 
#x}
!r)   