Ë
    ”U.j5  ã                  óâ  — d Z ddlm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	Z	ddl
mZ ddl	mZ ddlmZ ddlmZmZmZmZ ddlmZ  ej,                  e«      Zeez   Z	 ddlZeez  Z	 ddlZeez  Zdd„Zdd„Zdd„Z dd„Z!dd„Z"dd„Z#dd„Z$ddd„Z%dd„Z&d d„Z'	 	 	 	 	 	 	 	 	 	 d!d„Z(	 d"	 	 	 	 	 	 	 d#d„Z)y# e$ r ej9                  d	«       Y Œgw xY w# e$ r ej9                  d
«       Y Œyw xY w)$zUtilities related archives.é    )ÚannotationsN)ÚIterable)ÚZipInfo)ÚInstallationError)ÚBZ2_EXTENSIONSÚTAR_EXTENSIONSÚXZ_EXTENSIONSÚZIP_EXTENSIONS)Ú
ensure_dirzbz2 module is not availablezlzma module is not availablec                 óZ   — t        j                  d«      } t        j                  | «       | S )zBGet the current umask which involves having to set it temporarily.r   )ÚosÚumask)Úmasks    ú_C:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\pip/_internal/utils/unpacking.pyÚcurrent_umaskr   -   s   € ä�8‰8�A‹;€DÜ‡H�HˆT„NØ€Kó    c                óø   — | j                  d«      j                  d«      } d| v r=d| v r#| j                  d«      | j                  d«      k  sd| vr| j                  dd«      S d| v r| j                  dd«      S | dgS )NÚ/Ú\é   Ú )ÚlstripÚfindÚsplit©Úpaths    r   Úsplit_leading_dirr   4   sz   € Ø�;‰;�sÓ×"Ñ" 4Ó(€DØ
ˆd�{Ø	�‰˜$Ÿ)™) C›.¨4¯9©9°T«?Ò:¸tÈ4Ñ?Oà�z‰z˜#˜qÓ!Ð!Ø	�‰Ø�z‰z˜$ Ó"Ð"à�bˆzÐr   c                óR   — d}| D ]   }t        |«      \  }}|s y|€|}Œ||k7  sŒ  y y)zyReturns true if all the paths have the same leading path name
    (i.e., everything is in one subdirectory in an archive)NFT)r   )ÚpathsÚcommon_prefixr   ÚprefixÚrests        r   Úhas_leading_dirr#   @   sB   € ð €MÛˆÜ(¨Ó.‰ˆ�ÙÙØÐ"Ø"‰MØ�}Ó$Ùð ð r   c                óÐ   — t         j                  j                  | «      }t         j                  j                  |«      }||k(  xs" |j                  |t         j                  z   «      S )zƒ
    Return true if the absolute path of target is within the directory
    (including when target is equal to the directory).
    )r   r   ÚabspathÚ
startswithÚsep)Ú	directoryÚtargetÚabs_directoryÚ
abs_targets       r   Úis_within_directoryr,   O   sO   € ô
 —G‘G—O‘O IÓ.€MÜ—‘—‘ Ó(€Jà˜Ñ&ÒW¨*×*?Ñ*?ÀÔPR×PVÑPVÑ@VÓ*WÐWr   c                 ó$   — dt        «        z  dz  S )Niÿ  éI   )r   © r   r   Ú!_get_default_mode_plus_executabler0   Z   s   € Ø”M“OÐ#Ñ# eÑ+Ð+r   c                ó@   — t        j                  | t        «       «       y)zx
    Make file present at path have execute for user/group/world
    (chmod +x) is no-op on windows per python docs
    N)r   Úchmodr0   r   s    r   Ú2set_extracted_file_to_default_mode_plus_executabler3   ^   s   € ô
 ‡H�HˆTÔ4Ó6Õ7r   c                ór   — | j                   dz	  }t        |xr t        j                  |«      xr |dz  «      S )Né   r.   )Úexternal_attrÚboolÚstatÚS_ISREG)ÚinfoÚmodes     r   Úzip_item_is_executabler<   f   s6   € Ø×Ñ Ñ#€Dô �Ò<œŸ™ dÓ+Ò<°°u±Ó=Ð=r   c                ó®  — t        |«       t        | d«      }	 t        j                  |d¬«      }t	        |j                  «       «      xr |}|j                  «       D �]  }|j                  }|}|rt        |«      d   }t        j                  j                  ||«      }t        j                  j                  |«      }	t        ||«      sd}
t        |
j                  | ||«      «      ‚|j!                  d«      rt        |«       Œ¨t        |	«       |j                  |«      }	 t        |d«      5 }t#        j$                  ||«       ddd«       |j'                  «        t)        |«      s�Œt+        |«       �Œ 	 |j'                  «        y# 1 sw Y   ŒFxY w# |j'                  «        t)        |«      rt+        |«       w w xY w# |j'                  «        w xY w)	aŸ  
    Unzip the file (with path `filename`) to the destination `location`.  All
    files are written based on system defaults and umask (i.e. permissions are
    not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied after being
    written. Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    ÚrbT)Ú
allowZip64r   zQThe zip file ({}) has a file ({}) trying to install outside target directory ({}))r   r   ÚwbN)r   ÚopenÚzipfileÚZipFiler#   ÚnamelistÚinfolistÚfilenamer   r   r   ÚjoinÚdirnamer,   r   ÚformatÚendswithÚshutilÚcopyfileobjÚcloser<   r3   )rF   ÚlocationÚflattenÚzipfpÚzipÚleadingr:   ÚnameÚfnÚdirÚmessageÚfpÚdestfps                r   Ú
unzip_filerY   m   sp  € ô ˆxÔÜ�˜4Ó €Eð Ü�o‰o˜e°Ô5ˆÜ! #§,¡,£.Ó1Ò=°gˆØ—L‘L—NˆDØ—=‘=ˆDØˆBÙÜ& tÓ,¨QÑ/�Ü—‘—‘˜h¨Ó+ˆBÜ—'‘'—/‘/ "Ó%ˆCÜ& x°Ô4ð4ð ô (¨¯©°xÀÀXÓ(NÓOÐOØ�{‰{˜;Ô'ä˜2•ä˜3”ð —X‘X˜d“^�ðOÜ˜b $œ¨6Ü×*Ñ*¨2¨vÔ6÷ (ð —H‘H”JÜ-¨dÖ3ÜJÈ2ÖNñ7 #ð: 	�‰�÷ (˜ûð —H‘H”JÜ-¨dÔ3ÜJÈ2ÕNð 4ûð 	�‰�úsB   ™DG Ä"FÄ.F
ÅFÅG Å*G Æ
F	ÆFÆ)F?Æ?G ÇGc                ó  ‡ ‡‡‡— t        ‰«       ‰ j                  «       j                  d«      s‰ j                  «       j                  d«      rd}n†‰ j                  «       j                  t        «      rd}n`‰ j                  «       j                  t        «      rd}n:‰ j                  «       j                  d«      rd}nt
        j                  d‰ «       d	}t        j                  ‰ |d
¬«      }	 t        |j                  «       D �cg c]  }|j                  ‘Œ c}«      }	 t        j                  Št        «       Š|rj|j                  «       D ]W  }t        |j                  «      \  }}||_        |j                  «       sŒ3t        |j                   «      \  }}	||k(  sŒQ|	|_        ŒY dˆˆˆ ˆfd„}
|j#                  ‰|
¬«       |j)                  «        yc c}w # t$        $ r t'        ‰ ‰||«       Y Œ/w xY w# |j)                  «        w xY w)a¡  
    Untar the file (with path `filename`) to the destination `location`.
    All files are written based on system defaults and umask (i.e. permissions
    are not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied on top of the
    default.  Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    z.gzz.tgzzr:gzzr:bz2zr:xzz.tarÚrz-Cannot determine compression type for file %szr:*zutf-8)Úencodingc                ó|  •— | j                   }	 	  ‰| ‰«      } | j                  «       r|dz  r	‰| _         | S d | _         | S # t        j                  $ r0 t        j                  d d dv rt        j
                  | ‰«      } n‚ Y Œiw xY w# t        j                  $ r"}d}t        |j                  ‰|«      «      ‚d }~ww xY w)Né   >   ©r^   é	   é   ©r^   é
   é   ©r^   é   é   z%Invalid member in the tar file {}: {}r.   )
r;   ÚtarfileÚLinkOutsideDestinationErrorÚsysÚversion_infoÚ
tar_filterÚTarErrorr   rI   Úisfile)	Úmemberr   Ú	orig_modeÚexcrV   Údata_filterÚdefault_mode_plus_executablerF   rN   s	        €€€€r   Ú
pip_filterzuntar_file.<locals>.pip_filterÎ   sÛ   ø€ Ø"ŸK™K�	ðð"Ù!,¨V°XÓ!>˜ð2 —=‘=”? y°5Ò'8Ø">�F”Kð �ð #'�F”KØ�øôA #×>Ñ>ò "Ü×+Ñ+¨B¨QÐ/ð 4ñ ô &-×%7Ñ%7¸ÀÓ%I™Fà!ñ #ð"ûô ×'Ñ'ò 	ØE�Gô ,ØŸ™Ø$Øóóð ûð		ús0   �	A  Á A BÂ B ÂBÂB ÂB;ÂB6Â6B;)ÚfilterN)ro   útarfile.TarInfor   ÚstrÚreturnrv   )r   ÚlowerrJ   r   r	   ÚloggerÚwarningrh   rA   r#   Ú
getmembersrS   rr   r0   r   ÚislnkÚlinknameÚ
extractallÚAttributeErrorÚ_untar_without_filterrM   )rF   rN   r;   Útarro   rR   Ú	name_leadÚ	name_restÚlnk_leadÚlnk_restrt   rr   rs   s   ``         @@r   Ú
untar_filer‡   ›   s´  û€ ô ˆxÔØ‡~�~Ó× Ñ  Ô'¨8¯>©>Ó+;×+DÑ+DÀVÔ+LØ‰Ø	�‰Ó	×	"Ñ	"¤>Ô	2Ø‰Ø	�‰Ó	×	"Ñ	"¤=Ô	1Ø‰Ø	�‰Ó	×	"Ñ	" 6Ô	*Ø‰ä�‰Ø;Øô	
ð ˆä
�,‰,�x °Ô
8€CðCÜ!¸S¿^¹^Ô=MÓ"NÑ=M°6 6§;£;Ð=MÑ"NÓOˆð
:	8Ü!×-Ñ-ˆKô ,MÓ+NÐ(áð "Ÿn™nÖ.�FÜ+<¸V¿[¹[Ó+IÑ(�I˜yØ"+�F”KØ—|‘|•~Ü->¸v¿¹Ó-OÑ*˜ (Ø# yÓ0Ø.6˜F�Oð /÷%ð %ðN �N‰N˜8¨JˆNÔ7ð 	�	‰	�ùòE #Oøô ò 	DÜ! (¨H°c¸7ÖCð	Dûðv 	�	‰	�úsO   Ã0G7 ÄGÄG7 Ä"G Ä2AG7 ÆG7 Æ%G7 ÇG7 ÇG4Ç1G7 Ç3G4Ç4G7 Ç7H	c                óJ  — t         j                  j                  t         j                  j                  |j                  «      |j
                  «      }t         j                  j                  |«      }|j                  dd«      }	 | j                  |«       y# t        $ r Y yw xY w)zGCheck if the file pointed to by the symbolic link is in the tar archiver   r   TF)
r   r   rG   rH   rS   r~   ÚnormpathÚreplaceÚ	getmemberÚKeyError)r‚   Útarinfor~   s      r   Úis_symlink_target_in_tarrŽ   û   sy   € ä�w‰w�|‰|œBŸG™GŸO™O¨G¯L©LÓ9¸7×;KÑ;KÓL€Hä�w‰w×Ñ Ó)€HØ×Ñ  cÓ*€HðØ�‰�hÔØøÜò Ùðús   ÂB Â	B"Â!B"c                óP  — |j                  «       D �]Ž  }|j                  }|rt        |«      d   }t        j                  j                  ||«      }t        ||«      sd}t        |j                  | ||«      «      ‚|j                  «       rt        |«       Œ†|j                  «       rRt        ||«      s2d}t        |j                  | |j                  |j                  «      «      ‚	 |j                  ||«       Œè	 |j%                  |«      }	t        t        j                  j+                  |«      «       |	€J ‚t-        |d«      5 }
t/        j0                  |	|
«       ddd«       |	j3                  «        |j5                  ||«       |j6                  dz  s�Œ„t9        |«       �Œ‘ y# t        $ r-}t         j#                  d| |j                  |«       Y d}~�ŒÄd}~ww xY w# t&        t(        f$ r-}t         j#                  d| |j                  |«       Y d}~�Œd}~ww xY w# 1 sw Y   ŒÃxY w)z/Fallback for Python without tarfile.data_filterr   zQThe tar file ({}) has a file ({}) trying to install outside target directory ({})z/In the tar file %s the member %s is invalid: %sNr@   r.   )r|   rS   r   r   r   rG   r,   r   rI   Úisdirr   ÚissymrŽ   r~   Ú_extract_memberÚ	Exceptionrz   r{   ÚextractfilerŒ   r€   rH   rA   rK   rL   rM   Úutimer;   r3   )rF   rN   r‚   rR   ro   rT   r   rV   rq   rW   rX   s              r   r�   r�   	  sÔ  € ð —.‘.×"ˆØ�[‰[ˆÙÜ" 2Ó& qÑ)ˆBÜ�w‰w�|‰|˜H bÓ)ˆÜ" 8¨TÔ2ð0ð ô $ G§N¡N°8¸TÀ8Ó$LÓMÐMØ�<‰<Œ>Ü�tÕØ�\‰\Œ^Ü+¨C°Ô8ð4ð ô (Ø—N‘N 8¨V¯[©[¸&¿/¹/ÓJóð ðØ×#Ñ# F¨DÕ1ðØ—_‘_ VÓ,�ô ”r—w‘w—‘ tÓ,Ô-Ø�>Ð!�>Ü�d˜DÔ! VÜ×"Ñ" 2 vÔ.÷ "à�H‰HŒJà�I‰I�f˜dÔ#à�{‰{˜UÔ"ÜBÀ4ÖHñq #øô0 ò 	ô —‘ØEØØ—K‘KØô	õ ûð	ûô œnÐ-ò 	ô —‘ØEØØ—K‘KØô	õ ûð	ú÷ "Ð!ús<   Ã&F$Ã:GÅHÆ$	GÆ-"GÇGÇHÇ,"HÈHÈH%	c                ó|  ‡ ‡‡— t         j                  j                  ‰ «      Š ‰ j                  d«       Šd	ˆ ˆˆfd„}d	ˆ ˆfd„}|dk(  r |«       S |dk(  r |«       S ‰ j	                  «       j                  t
        «      r |«       S ‰ j	                  «       j                  t        t        z   t        z   «      r |«       S t        j                  ‰ «      }t        j                  ‰ «      }|r	|s |«       S |r	|s |«       S |r|rt        j                  d‰ «       t        j                  d‰ ‰|«       t!        d‰› �«      ‚)
zÑUnpack ``filename`` into ``location``.

    Archive format is chosen in order of decreasing reliability:
    ``content_type``, then filename extension, then magic signature
    (unambiguous matches only).
    z.whlc                 ó"   •— t        ‰ ‰‰¬«       y )N)rO   )rY   )rF   rN   Úzip_flattens   €€€r   Ú_unzipzunpack_file.<locals>._unzip\  s   ø€ Ü�8˜X¨{Ö;r   c                 ó   •— t        ‰ ‰«       y ©N)r‡   )rF   rN   s   €€r   Ú_untarzunpack_file.<locals>._untar_  s   ø€ Ü�8˜XÕ&r   zapplication/zipzapplication/x-gzipzAmbiguous file signature in %s.zZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz#Cannot determine archive format of )rx   ÚNone)r   r   ÚrealpathrJ   ry   r
   r   r   r	   rB   Ú
is_zipfilerh   Ú
is_tarfilerz   ÚerrorÚcriticalr   )rF   rN   Úcontent_typer™   rœ   rŸ   r    r˜   s   ``     @r   Úunpack_filer¤   N  s  ú€ ô �w‰w×Ñ Ó)€HØ×'Ñ'¨Ó/Ð/€K÷<ö'ð Ð(Ò(Ù‹xˆØÐ+Ò+Ù‹xˆà‡~�~Ó× Ñ ¤Ô0Ù‹xˆØ‡~�~Ó× Ñ ¤´.Ñ!@Ä=Ñ!PÔQÙ‹xˆô ×#Ñ# HÓ-€JÜ×#Ñ# HÓ-€JÙ™*Ù‹xˆÙ™*Ù‹xˆÙ‘jÜ�‰Ð6¸ÔAä
‡O�Oð	'àØØôô ÐAÀ(ÀÐLÓ
MÐMr   )rx   Úint)r   rw   rx   z	list[str])r   zIterable[str]rx   r7   )r(   rw   r)   rw   rx   r7   )r   rw   rx   r�   )r:   r   rx   r7   )T)rF   rw   rN   rw   rO   r7   rx   r�   )rF   rw   rN   rw   rx   r�   )r‚   útarfile.TarFiler�   rv   rx   r7   )
rF   rw   rN   rw   r‚   r¦   rR   r7   rx   r�   r›   )rF   rw   rN   rw   r£   z
str | Nonerx   r�   )*Ú__doc__Ú
__future__r   Úloggingr   rK   r8   rj   rh   rB   Úcollections.abcr   r   Úpip._internal.exceptionsr   Úpip._internal.utils.filetypesr   r   r	   r
   Úpip._internal.utils.miscr   Ú	getLoggerÚ__name__rz   ÚSUPPORTED_EXTENSIONSÚbz2ÚImportErrorÚdebugÚlzmar   r   r#   r,   r0   r3   r<   rY   r‡   rŽ   r�   r¤   r/   r   r   Ú<module>rµ      sb  ðÙ !å "ã Û 	Û Û Û 
Û Û Ý $Ý å 6÷ó õ 0à	ˆ×	Ñ	˜8Ó	$€ð &¨Ñ6Ð ð0Ûà˜NÑ*Ðð1ãà˜MÑ)Ðó
ó	óóXó,ó8ó>ô+ó\]ó@ðBIØðBIàðBIð 
ðBIð ð	BIð
 
óBIðP  $ð/NØð/Nàð/Nð ð/Nð 
ô	/Nøð[	 ò 0Ø
‡L�LÐ.Ö/ð0ûð ò 1Ø
‡L�LÐ/Ö0ð1ús$   Á!	B9 Á+	C Â9CÃCÃC.Ã-C.