Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
archive_util.cpython-313.pyc81 linesDownload Raw Back to __pycache__
1�

2��j�����SrSSKrSSKrSSKrSSKrSSKrSSKrSSKJr SSK	J3r4 /SQr"SS\55rS	r
\
S4SSjjr\
4SSjjr\
4SS
jjr\
4SjrSrSr\
4S6\4Sjjr\\\4rg)z/Utilities for extracting common archive formats�N�)�ensure_directory)�DistutilsError)�unpack_archive�unpack_zipfile�unpack_tarfile�default_filter�UnrecognizedFormat�extraction_drivers�unpack_directoryc��\rSrSrSrSrg)r7�z#Couldn't recognize the archive type�N)�__name__�8__module__�__qualname__�__firstlineno__�__doc__�__static_attributes__r��]D:\code\apps\devtools\python\user_packages\Python313\site-packages\setuptools/archive_util.pyr9r10s��-rr11c��U$)z@The default progress/filter callback; returns True for all filesr)�src�dsts  rr	r	s���Jr�returnc��U=(d [H
nU"XU5  g [SU35e![a M,f=f)a]Unpack `filename` to `extract_dir`, or raise ``UnrecognizedFormat``12 13`progress_filter` is a function taking two arguments: a source path14internal to the archive ('/'-separated), and a filesystem path where it15will be extracted.  The callback must return the desired extract path16(which may be the same as the one passed in), or else ``None`` to skip17that file or directory.  The callback can thus be used to report on the18progress of the extraction, as well as to filter the items extracted or19alter their extraction paths.20 21`drivers`, if supplied, must be a non-empty sequence of functions with the22same signature as this function (minus the `drivers` argument), that raise23``UnrecognizedFormat`` if they do not support extracting the designated24archive type.  The `drivers` are tried in sequence until one is found that25does not raise an error, or until all are exhausted (in which case26``UnrecognizedFormat`` is raised).  If you do not supply a sequence of27drivers, the module's ``extraction_drivers`` constant will be used, which28means that ``unpack_zipfile`` and ``unpack_tarfile`` will be tried, in that29order.30NzNot a recognized archive type: )rr31)�filename�extract_dir�progress_filter�drivers�drivers     rrr"sT��.�/�/�/��	��8�/�:�
�
0�!�#B�8�*�!M�N�N��"�	��	�s�	/�32=�=c��[RRU5(d[US35eUSU40n[R"U5H�upEnX4upxUHIn	Xy-S-[RRX�54U[RRXI5'MK UH�n33[RRX�5nU"Xz-U5nU(dM6[
U5 [RRXJ5n34[R"X�5 [R"X�5 M� M� g)z"Unpack" a directory, using the same interface as for archives35 36Raises ``UnrecognizedFormat`` if `filename` is not a directory37z is not a directory��/N)38�os�path�isdirr39�walk�joinr�shutil�copyfile�copystat)rrr�paths�base�dirs�filesrr�d�f�targets            rrrDs���40�7�7�=�=��"�"� �H�:�-@�!A�B�B�	�2�{�#�
�E� �W�W�X�.���E��;����A�+.�7�S�=�"�'�'�,�,�s�:N�+N�E�"�'�'�,�,�t�'�(���A��W�W�\�\�#�)�F�$�S�W�f�5�F����V�$������T�%�A��O�O�A�&��O�O�A�&��	/rc���[R"U5(d[US35e[R"U5n[	X1U5 SSS5 g!,(df   g=f)z�Unpack zip `filename` to `extract_dir`41 42Raises ``UnrecognizedFormat`` if `filename` is not a zipfile (as determined43by ``zipfile.is_zipfile()``).  See ``unpack_archive()`` for an explanation44of the `progress_filter` argument.45z is not a zip fileN)�zipfile�46is_zipfiler47�ZipFile�_unpack_zipfile_obj)rrr�zs    rrr_sL�����h�'�'� �H�:�-?�!@�A�A�	����	"�a��A�O�<�48#�	"�	"�s�
A�49A$c��UR5GHnURnURS5(dSURS5;aM=[R50R"U/URS5Q76nU"XE5nU(dM~URS5(a[U5 OL[U5 URUR5n[US5nURU5 SSS5 URS-	nU(dGM[R"XX5 GM g!,(df   NC=f)z�Internal/private API used by other parts of setuptools.51Similar to ``unpack_zipfile``, but receives an already opened :obj:`zipfile.ZipFile`52object instead of a filename.53r$�..�wbN�)�infolistr�54startswith�splitr%r&r)�endswithr�read�open�write�
external_attr�chmod)	�zipfile_objrr�info�namer3�datar2�unix_attributess	         rr8r8ns���55�$�$�&���}�}���?�?�3���4�4�:�:�c�?�#:�������k�<�D�J�J�s�O�<�� ��.�����=�=�����V�$�
�V�$��#�#�D�M�M�2�D��f�d�#�q�����
�$��,�,��2���?��H�H�V�-�-'�$$�#�s�#D2�256E	c�F�Ub�UR5(dUR5(a�URnUR5(aL[R"UR575n[R"X25n[R"U5nURU5nUb.UR5(aM�UR5(aM�USL=(a' UR5=(d UR5nU(aU$[S5e)z;Resolve any links and extract link targets as normal files.NzGot unknown file type)�islnk�issym�linkname�	posixpath�dirnamerIr)�normpath�58_getmember�isfiler'�LookupError)�tar_obj�tar_member_obj�linkpathr.�is_file_or_dirs     r�_resolve_tar_file_or_dirrZ�s���59�60$������.�"6�"6�"8�"8�!�*�*�����!�!��$�$�^�%8�%8�9�D� �~�~�d�5�H� �)�)�(�3�H� �+�+�H�5���61$������.�"6�"6�"8�"8�$�4�/������9�>�#7�#7�#9�����62�-�63.�.rc#�# �SUl[R"U5 UH�nURnUR	S5(dSURS5;aM<[RR"U/URS5Q76n[X5nU"XE5nU(dM�UR[R5(aUSSnX64v� M� SSS5 g![a M�f=f!,(df   g=f7f)z1Emit member-destination pairs from a tar archive.c��g)Nr)�argss r�<lambda>� _iter_open_tar.<locals>.<lambda>�s��$rr$r;N�����)
�chown�64contextlib�closingrIr?r@r%r&r)rZrUrA�sep)rVrr�memberrI�65prelim_dst�	final_dsts       r�_iter_open_tarrh�s����'�G�M�	�	�	�G�	$��F��;�;�D����s�#�#�t�t�z�z�#��'>�������k�D�D�J�J�s�O�D�J�
�1�'�B��(��9�I����!�!�"�&�&�)�)�%�c�r�N�	��#�#�)�66%�	$���
��
��67%�	$�sB�D68�A/C9�C(�AC9�	D69�(70C6�2C9�5C6�6C9�971D�D72c��[R"U5n[	UUU5HupVURXV5 M g![Ran[US35UeSnAff=f![Ra M^f=f)z�Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir`73 74Raises ``UnrecognizedFormat`` if `filename` is not a tarfile (as determined75by ``tarfile.open()``).  See ``unpack_archive()`` for an explanation76of the `progress_filter` argument.77z- is not a compressed or uncompressed tar fileNT)�tarfilerC�TarErrorr78rh�_extract_member�ExtractError)rrr�tarobj�erergs       rrr�s�������h�'��,�������79	��"�"�6�5����#���� ��j�E�F�80��	�����#�#�	��	�s(�A�A,�A)�A$�$A)�,B�B)rN)rrbr%rPr*rjr5�_pathr�distutils.errorsr�__all__r81r	rrrr8rZrh�boolrrrrr�<module>rts���5��	��
���#�+���.��.��,:�4�O�	�O�D=K�'�6;I�=�CQ�.�</�*$�:;I��T��:&�~�~�E�r
codekingpro/portable-devtools · Team Ai