
    жvg                     F   d Z ddlZddlZddl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 g dZ ed          ZdZ ej        d          Z G d	 d
e          Z	 dde
eef         dee         dedee         dee         f
dZ	 dde
eef         dee         dedee         def
dZdeed                  ddfdZdede
eef         fdZe G d d                      Z G d d          Ze G d d                      Zeeeef         Ze G d d                      Z dS ) z	 PEP 610     N)	dataclass)AnyClassVarDictIterableOptionalTypeTypeVarUnion)	DirectUrlDirectUrlValidationErrorDirInfoArchiveInfoVcsInfoTzdirect_url.jsonz.^\$\{[A-Za-z0-9-_]+\}(:\$\{[A-Za-z0-9-_]+\})?$c                       e Zd ZdS )r   N)__name__
__module____qualname__     \/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/pip/_internal/models/direct_url.pyr   r      s        Dr   r   dexpected_typekeydefaultreturnc                 r    || vr|S | |         }t          ||          st          |d| d| d          |S )z3Get value from dictionary and verify expected type.z has unexpected type for z (expected ))
isinstancer   r   r   r   r   values        r   _getr#      sb     !||cFEe]++ 
&QQQQQQQ
 
 	
 Lr   c                 R    t          | |||          }|t          | d          |S )Nz must have a value)r#   r   r!   s        r   _get_requiredr%   )   s8     M300E}&#'A'A'ABBBLr   infosInfoTypec                     d | D             } | st          d          t          |           dk    rt          d          | d         J | d         S )Nc                     g | ]}||S Nr   ).0infos     r   
<listcomp>z#_exactly_one_of.<locals>.<listcomp>3   s    888dt'7T'7'7'7r   z/missing one of archive_info, dir_info, vcs_info   z1more than one of archive_info, dir_info, vcs_infor   )r   len)r&   s    r   _exactly_one_ofr0   2   ss    88e888E 
&=
 
 	
 5zzA~~&?
 
 	
 88Or   kwargsc                  >    d |                                  D             S )z Make dict excluding None values.c                     i | ]
\  }}|||S r*   r   )r+   kvs      r   
<dictcomp>z _filter_none.<locals>.<dictcomp>B   s    ===TQq}Aq}}}r   )items)r1   s    r   _filter_noner8   @   s    ==V\\^^====r   c                       e Zd ZU dZeed<   eed<   eed<   dZee         ed<   e	dee
eef                  ded          fd	            Zde
eef         fd
ZdS )r   vcs_infonamevcs	commit_idNrequested_revisionr   r   c           	          |d S  | t          |t          d          t          |t          d          t          |t          d                    S )Nr<   r=   r>   )r<   r=   r>   )r%   strr#   clsr   s     r   
_from_dictzVcsInfo._from_dictM   sS    94sae,,#AsK88#As,@AA
 
 
 	
r   c                 D    t          | j        | j        | j                  S )N)r<   r>   r=   )r8   r<   r>   r=   selfs    r   _to_dictzVcsInfo._to_dictW   s)    #6n
 
 
 	
r   )r   r   r   r;   r   __annotations__r@   r>   r   classmethodr   r   rC   rG   r   r   r   r   r   E   s         D(	HHHNNN(,,,,
8DcN3 
8K 
 
 
 [

$sCx. 
 
 
 
 
 
r   r   c                      e Zd ZdZ	 	 ddee         deeeef                  ddfdZedee         fd            Z	e	j
        dee         ddfd	            Z	ed
eeeef                  ded          fd            Zdeeef         fdZdS )r   archive_infoNhashhashesr   c                 "    || _         || _        d S r*   )rM   rL   )rF   rL   rM   s      r   __init__zArchiveInfo.__init__b   s     			r   c                     | j         S r*   )_hashrE   s    r   rL   zArchiveInfo.hashk   s
    zr   r"   c                    |}	 |                     dd          \  }}n # t          $ r t          d|          w xY w| j        
||i| _        n1|| j        vr(| j                                        | _        || j        |<   || _        d S )N=r.   z"invalid archive_info.hash format: )split
ValueErrorr   rM   copyrQ   )rF   r"   	hash_name
hash_values       r   rL   zArchiveInfo.hasho   s    (-C(;(;%	::   .BBB   {"(*5$+--"k..00)3I&


s    ;r   c                 t    |d S  | t          |t          d          t          |t          d                    S )NrL   rM   rL   rM   )r#   r@   dictrA   s     r   rC   zArchiveInfo._from_dict   s9    94sQV,,T!T85L5LMMMMr   c                 8    t          | j        | j                  S )NrZ   )r8   rL   rM   rE   s    r   rG   zArchiveInfo._to_dict   s    4;????r   )NN)r   r   r   r;   r   r@   r   rO   propertyrL   setterrI   r   rC   rG   r   r   r   r   r   _   s6       D #+/ sm c3h( 
	    hsm    X 
[(3- D    [" N8DcN3 N8O N N N [N
@$sCx. @ @ @ @ @ @r   r   c                       e Zd ZU dZeed<   dZeed<   ede	e
eef                  de	d          fd            Zde
eef         fdZd	S )
r   dir_infor;   Feditabler   r   c                 N    |d S  | t          |t          dd                    S )Nra   F)r   ra   )r%   boolrA   s     r   rC   zDirInfo._from_dict   s0    94sM!T:uMMMNNNNr   c                 0    t          | j        pd           S )Nrc   )r8   ra   rE   s    r   rG   zDirInfo._to_dict   s    T]%:d;;;;r   N)r   r   r   r;   r   rH   ra   rd   rI   r   r   r@   r   rC   rG   r   r   r   r   r      s         D(HdO8DcN3 O8K O O O [O
<$sCx. < < < < < <r   r   c                       e Zd ZU eed<   eed<   dZee         ed<   dedefdZe	defd            Z
dd	Zed
eeef         dd fd            Zdeeef         fdZededd fd            ZdefdZdefdZdS )r   urlr,   Nsubdirectorynetlocr   c                     d|vr|S |                     dd          \  }}t          | j        t                    r| j        j        dk    r|dk    r|S t
                              |          r|S |S )N@r.   git)rT   r    r,   r   r<   
ENV_VAR_REmatch)rF   ri   	user_passnetloc_no_user_passs       r   _remove_auth_from_netlocz"DirectUrl._remove_auth_from_netloc   s    fM)/c1)=)=&	&ty'**		&&U""MI&& 	M""r   c                     t           j                            | j                  }|                     |j                  }t           j                            |j        ||j        |j	        |j
        f          }|S )zurl with user:password part removed unless it is formed with
        environment variables as specified in PEP 610, or it is ``git``
        in the case of a git URL.
        )urllibparseurlsplitrg   rq   ri   
urlunsplitschemepathqueryfragment)rF   purlri   surls       r   redacted_urlzDirectUrl.redacted_url   sd     |$$TX....t{;;|&&[&$)TZG
 
 r   c                 T    |                      |                                            d S r*   )	from_dictto_dictrE   s    r   validatezDirectUrl.validate   s"    t||~~&&&&&r   r   c                    t          t          |t          d          t          |t          d          t	          t
                              t          |t          d                    t                              t          |t          d                    t                              t          |t          d                    g                    S )Nrg   rh   rK   r`   r:   )rg   rh   r,   )
r   r%   r@   r#   r0   r   rC   r[   r   r   rA   s     r   r   zDirectUrl.from_dict   s    ae,,an55 **44+H+HII&&tAtZ'@'@AA&&tAtZ'@'@AA 

 

 

 
	
r   c                     t          | j        | j                  }| j                                        || j        j        <   |S )N)rg   rh   )r8   r}   rh   r,   rG   r;   )rF   ress     r   r   zDirectUrl.to_dict   sE    !*
 
 
 #i0022DIN
r   sc                 P    |                      t          j        |                    S r*   )r   jsonloads)rB   r   s     r   	from_jsonzDirectUrl.from_json   s    }}TZ]]+++r   c                 R    t          j        |                                 d          S )NT)	sort_keys)r   dumpsr   rE   s    r   to_jsonzDirectUrl.to_json   s    z$,,..D9999r   c                 N    t          | j        t                    o| j        j        S r*   )r    r,   r   ra   rE   s    r   is_local_editablezDirectUrl.is_local_editable   s    $)W--D$)2DDr   )r   N)r   r   r   r@   rH   r'   rh   r   rq   r]   r}   r   rI   r   r   r   r   r   r   rd   r   r   r   r   r   r      s]        	HHH
NNN"&L(3-&&&#s #s # # # # 
c 
 
 
 X
' ' ' ' 
$sCx. 
[ 
 
 
 [
c3h     ,# ,+ , , , [,: : : : :E4 E E E E E Er   r   r*   )!__doc__r   reurllib.parsers   dataclassesr   typingr   r   r   r   r   r	   r
   r   __all__r   DIRECT_URL_METADATA_NAMEcompilerm   	Exceptionr   r@   r#   r%   r0   r8   r   r   r   r'   r   r   r   r   <module>r      s     				     ! ! ! ! ! ! P P P P P P P P P P P P P P P P P P P P   GCLL, RZIJJ
	 	 	 	 	y 	 	 	
 QU CH~&*1g47BJ1+a[    QU CH~&*1g47BJ1+   8HZ$89 j    >3 >4S> > > > >
 
 
 
 
 
 
 
 
2)@ )@ )@ )@ )@ )@ )@ )@X < < < < < < < < gw./ AE AE AE AE AE AE AE AE AE AEr   