� ,�Re� ����ddlZddlZddlZddlZddlZddlZddlZejdkrddlm Z ne Z dgZ d�Z d�Z e jZ d�ZGd�d ej��ZGd �d e��Zd �ZGd �d��ZdS)�N)��)� OrderedDict�Pathc�H�tjt|��dd��S)a2 Given a path with elements separated by posixpath.sep, generate all parents of that path. >>> list(_parents('b/d')) ['b'] >>> list(_parents('/b/d/')) ['/b'] >>> list(_parents('b/d/f/')) ['b/d', 'b'] >>> list(_parents('b')) [] >>> list(_parents('')) [] �N)� itertools�islice� _ancestry��paths ��/builddir/build/BUILDROOT/alt-python311-setuptools-65.6.3-2.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/setuptools/_vendor/zipp.py�_parentsrs�� � �I�d�O�O�Q�� 5� 5�5�c#��K�|�tj��}|r?|tjkr3|V�tj|��\}}|r|tjk�-dSdSdSdS)aR Given a path with elements separated by posixpath.sep, generate all elements of that path >>> list(_ancestry('b/d')) ['b/d', 'b'] >>> list(_ancestry('/b/d/')) ['/b/d', '/b'] >>> list(_ancestry('b/d/f/')) ['b/d/f', 'b/d', 'b'] >>> list(_ancestry('b')) ['b'] >>> list(_ancestry('')) [] N)�rstrip� posixpath�sep�split)r �tails rr r %s����� �;�;�y�}� %� %�D� �+�4�9�=�(�(�� � � ��_�T�*�*� ��d� �+�4�9�=�(�(�(�(�+�+�+�+�(�(rc�P�tjt|��j|��S)zZ Return items in minuend not in subtrahend, retaining order with O(1) lookup. )r � filterfalse�set� __contains__)�minuend� subtrahends r� _differencer?s �� � ��Z���!=�w� G� G�Grc�Z��eZdZdZed���Z�fd�Zd�Zd�Ze d���Z �xZ S)� CompleteDirszk A ZipFile subclass that ensures that implied directories are always included in the namelist. c��tj�tt|����}d�|D��}t t ||����S)Nc3�4K�|]}|tjzV��dS�N)rr)�.0�ps r� z-CompleteDirs._implied_dirs..Ps)����6�6��1�y�}�$�6�6�6�6�6�6r)r �chain� from_iterable�mapr�_deduper)�names�parents�as_dirss r� _implied_dirszCompleteDirs._implied_dirsMsL���/�/�/��H�e�0D�0D�E�E��6�6�g�6�6�6���{�7�E�2�2�3�3�3rc���tt|�����}|t|�|����zSr")�superr�namelist�listr-)�selfr*� __class__s �rr0zCompleteDirs.namelistSs?����l�D�)�)�2�2�4�4���t�D�.�.�u�5�5�6�6�6�6rc�D�t|�����Sr")rr0�r2s r� _name_setzCompleteDirs._name_setWs���4�=�=�?�?�#�#�#rc�P�|���}|dz}||vo||v}|r|n|S)zx If the name represents a directory, return that name as a directory (with the trailing slash). �/)r6)r2�namer*�dirname� dir_matchs r� resolve_dirzCompleteDirs.resolve_dirZs?�� ��� � ����*����%�:�'�U�*:� �#�-�w�w��-rc���t|t��r|St|tj��s|t |����Sd|jvrt}||_|S)zl Given a source (filename or zipfile), return an appropriate CompleteDirs subclass. �r)� isinstancer�zipfile�ZipFile�_pathlib_compat�moder3)�cls�sources r�makezCompleteDirs.makedsh�� �f�l� +� +� ��M��&�'�/�2�2� 0��3��v�.�.�/�/� /� �f�k� !� !��C����� r) �__name__� __module__� __qualname__�__doc__� staticmethodr-r0r6r<� classmethodrF� __classcell__�r3s@rrrGs���������� �4�4��\�4� 7�7�7�7�7�$�$�$�.�.�.�����[�����rrc�,��eZdZdZ�fd�Z�fd�Z�xZS)� FastLookupzV ZipFile subclass to ensure implicit dirs exist and are resolved rapidly. c����tjt��5|jcddd��S#1swxYwYt t |�����|_|jSr")� contextlib�suppress�AttributeError�_FastLookup__namesr/rPr0�r2r3s �rr0zFastLookup.namelist~s���� � �� 0� 0� � ��<� � � � � � � � � � � � ���� � � � ��Z��.�.�7�7�9�9�� ��|�� �/�3�3c����tjt��5|jcddd��S#1swxYwYt t |�����|_|jSr")rRrSrT�_FastLookup__lookupr/rPr6rVs �rr6zFastLookup._name_set�s���� � �� 0� 0� !� !��=� !� !� !� !� !� !� !� !� !� !� !� !���� !� !� !� !��j�$�/�/�9�9�;�;�� ��}�rW)rGrHrIrJr0r6rMrNs@rrPrPxs[��������� ����� ��������rrPc�j� |���S#t$rt|��cYSwxYw)zi For path-like objects, convert to a filename for compatibility on Python 3.6.1 and earlier. )� __fspath__rT�strr s rrBrB�sD�� ���� � � �� �����4�y�y�������s ��2�2c���eZdZdZdZdd�Zddd�d�Zed ���Zed ���Z ed ���Z ed ���Z ed ���Z d�Z d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZeZed���ZdS)ru4 A pathlib-compatible interface for zip files. Consider a zip file with this structure:: . ├── a.txt └── b ├── c.txt └── d └── e.txt >>> data = io.BytesIO() >>> zf = zipfile.ZipFile(data, 'w') >>> zf.writestr('a.txt', 'content of a') >>> zf.writestr('b/c.txt', 'content of c') >>> zf.writestr('b/d/e.txt', 'content of e') >>> zf.filename = 'mem/abcde.zip' Path accepts the zipfile object itself or a filename >>> root = Path(zf) From there, several path operations are available. Directory iteration (including the zip file itself): >>> a, b = root.iterdir() >>> a Path('mem/abcde.zip', 'a.txt') >>> b Path('mem/abcde.zip', 'b/') name property: >>> b.name 'b' join with divide operator: >>> c = b / 'c.txt' >>> c Path('mem/abcde.zip', 'b/c.txt') >>> c.name 'c.txt' Read text: >>> c.read_text() 'content of c' existence: >>> c.exists() True >>> (b / 'missing.txt').exists() False Coercion to string: >>> import os >>> str(c).replace(os.sep, posixpath.sep) 'mem/abcde.zip/b/c.txt' At the root, ``name``, ``filename``, and ``parent`` resolve to the zipfile. Note these attributes are not valid and will raise a ``ValueError`` if the zipfile has no filename. >>> root.name 'abcde.zip' >>> str(root.filename).replace(os.sep, posixpath.sep) 'mem/abcde.zip' >>> str(root.parent) 'mem' z>{self.__class__.__name__}({self.root.filename!r}, {self.at!r})�c�R�t�|��|_||_dS)aX Construct a Path from a ZipFile or filename. Note: When the source is an existing ZipFile object, its type (__class__) will be mutated to a specialized type. If the caller wishes to retain the original type, the caller should either create a separate ZipFile object or pass a filename. N)rPrF�root�at)r2r`ras r�__init__z Path.__init__�s"���O�O�D�)�)�� �����rr>N��pwdc�J�|���rt|���|d}|���s|dkrt|���|j�|j||���}d|vr|s|rtd���|Stj |g|�Ri|��S)z� Open this entry as text or binary following the semantics of ``pathlib.Path.open()`` by passing arguments through to io.TextIOWrapper(). rr>rc�bz*encoding args invalid for binary operation) �is_dir�IsADirectoryError�exists�FileNotFoundErrorr`�openra� ValueError�io� TextIOWrapper)r2rCrd�args�kwargs�zip_mode�streams rrkz Path.open�s��� �;�;�=�=� *�#�D�)�)� )���7���{�{�}�}� *��S���#�D�)�)� )��������s��;�;�� �$�;�;�� O�v� O� �!M�N�N�N��M����8��8�8�8��8�8�8rc�V�tj|j��jp |jjSr")�pathlibrrar9�filenamer5s rr9z Path.name�!���|�D�G�$�$�)�?�T�]�-?�?rc�V�tj|j��jp |jjSr")rtrra�suffixrur5s rrxz Path.suffix s!���|�D�G�$�$�+�C�t�}�/C�Crc�V�tj|j��jp |jjSr")rtrra�suffixesrur5s rrzz Path.suffixes s!���|�D�G�$�$�-�G���1G�Grc�V�tj|j��jp |jjSr")rtrra�stemrur5s rr|z Path.stemrvrc�n�tj|jj���|j��Sr")rtrr`ru�joinpathrar5s rruz Path.filenames'���|�D�I�.�/�/�8�8���A�A�Arc��|jdg|�Ri|��5}|���cddd��S#1swxYwYdS)Nr>�rk�read)r2rorp�strms r� read_textzPath.read_texts��� �T�Y�s� ,�T� ,� ,� ,�V� ,� ,� ���9�9�;�;� � � � � � � � � � � � ���� � � � � � s �3�7�7c��|�d��5}|���cddd��S#1swxYwYdS)N�rbr�)r2r�s r� read_byteszPath.read_bytess~�� �Y�Y�t�_�_� ���9�9�;�;� � � � � � � � � � � � ���� � � � � � s �7�;�;c��tj|j�d����|j�d��kS�Nr8)rr:rar)r2r s r� _is_childzPath._is_child!s4��� ������!4�!4�5�5������9L�9L�L�Lrc�8�|�|j|��Sr")r3r`)r2ras r�_nextz Path._next$s���~�~�d�i��,�,�,rc�F�|j p|j�d��Sr�)ra�endswithr5s rrgz Path.is_dir's!���7�{�3�d�g�.�.�s�3�3�3rc�T�|���o|��� Sr")rirgr5s r�is_filez Path.is_file*s ���{�{�}�}�2�T�[�[�]�]�!2�2rc�B�|j|j���vSr")rar`r6r5s rriz Path.exists-s���w�$�)�-�-�/�/�/�/rc���|���std���t|j|j�����}t |j|��S)NzCan't listdir a file)rgrlr(r�r`r0�filterr�)r2�subss r�iterdirz Path.iterdir0sR���{�{�}�}� 5��3�4�4� 4��4�:�t�y�1�1�3�3�4�4���d�n�d�+�+�+rc�J�tj|jj|j��Sr")r�joinr`rurar5s r�__str__z Path.__str__6s���~�d�i�0�$�'�:�:�:rc�8�|j�|���S)Nr5)� _Path__repr�formatr5s r�__repr__z Path.__repr__9s���{�!�!�t�!�,�,�,rc��tj|jgtt|���R�}|�|j�|����Sr")rr�rar(rBr�r`r<)r2�other�nexts rr~z Path.joinpath<sG���~�d�g�D��O�U�(C�(C�D�D�D���z�z�$�)�/�/��5�5�6�6�6rc��|js |jjStj|j�d����}|r|dz }|�|��Sr�)raru�parentrr:rr�)r2� parent_ats rr�z Path.parentBsY���w� (��=�'� '��%�d�g�n�n�S�&9�&9�:�:� � � � �� �I��z�z�)�$�$�$r)r^)r>)rGrHrIrJr�rbrk�propertyr9rxrzr|rur�r�r�r�rgr�rir�r�r�r~� __truediv__r��rrrr�s�������K�K�ZN�F� � � � �9��9�9�9�9�9�$�@�@��X�@��D�D��X�D��H�H��X�H��@�@��X�@��B�B��X�B�������M�M�M�-�-�-�4�4�4�3�3�3�0�0�0�,�,�,� ;�;�;�-�-�-�7�7�7��K� �%�%��X�%�%�%r)rmrr@r rR�sysrt� version_info� collectionsr�dict�__all__rr �fromkeysr)rrArrPrBrr�rr�r�s]�� � � � ����������������� � � � �������f���'�'�'�'�'�'�'��K� �(��6�6�6�&+�+�+�, � ��/�H�H�H�.�.�.�.�.�7�?�.�.�.�b���������&���s%�s%�s%�s%�s%�s%�s%�s%�s%�s%r