Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pip/_internal/models/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pip/_internal/models/__pycache__/link.cpython-312.pyc

�

4Μg*R���ddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
mZmZmZmZmZmZddlmZddlmZddlmZddlmZmZmZmZddlm Z m!Z!erdd	l"m#Z#ejHe%�Z&d
Z'e	d��Gd
�d��Z(e	d��Gd�d��Z)dee
e*e*fdee
e*e*ffd�Z+de*de*fd�Z,de*de*fd�Z-ej\dej^�Z0de*de1de*fd�Z2de*de*fd�Z3ejhGd�d��Z5Gd�d e�Z6d!e5de6fd"�Z7ejpd�#�d$e5d%e5de1fd&��Z9y)'�N)�	dataclass)	�
TYPE_CHECKING�Any�Dict�List�Mapping�
NamedTuple�Optional�Tuple�Union)�
deprecated)�WHEEL_EXTENSION)�Hashes)�pairwise�redact_auth_from_url�split_auth_from_netloc�splitext)�path_to_url�url_to_path)�IndexContent)�sha512�sha384�sha256�sha224�sha1�md5T)�frozenc�"�eZdZUdZeed<eed<ejdjdjd�e
D�����Zdd
�Ze
ejd	��dededfd
���Zdeeeffd�Zdefd�Zdeedefd�Zy	)�LinkHasha�Links to content may have embedded hash values. This class parses those.

    `name` must be any member of `_SUPPORTED_HASHES`.

    This class can be converted to and from `ArchiveInfo`. While ArchiveInfo intends to
    be JSON-serializable to conform to PEP 610, this class contains the logic for
    parsing a hash name and value for correctness, and then checking whether that hash
    conforms to a schema with `.is_hash_allowed()`.�name�valuez[#&]({choices})=([^&]*)�|c#�FK�|]}tj|����y�w�N)�re�escape)�.0�	hash_names  �D/usr/local/lib/python3.12/site-packages/pip/_internal/models/link.py�	<genexpr>zLinkHash.<genexpr>@s����U�CT�i�R�Y�Y�y�1�CT�s�!)�choices�returnNc�,�|jtvsJ�yr$)r �_SUPPORTED_HASHES��selfs r)�
__post_init__zLinkHash.__post_init__Ds���y�y�-�-�-�-���maxsize�urlc�x�|jj|�}|�y|j�\}}|||��S)zGSearch a string for a checksum algorithm name and encoded output value.N�r r!)�_hash_url_fragment_re�search�groups)�clsr5�matchr r!s     r)�find_hash_url_fragmentzLinkHash.find_hash_url_fragmentGs>���)�)�0�0��5���=���l�l�n���e���E�*�*r2c�2�|j|jiSr$r7r/s r)�as_dictzLinkHash.as_dictQs���	�	�4�:�:�&�&r2c�F�t|j|jgi�S)z@Return a Hashes instance which checks only for the current hash.)rr r!r/s r)�	as_hasheszLinkHash.as_hashesTs���t�y�y�4�:�:�,�/�0�0r2�hashesc�V�|�y|j|j|j��S)zI
        Return True if the current hash is allowed by `hashes`.
        F)�
hex_digest)�is_hash_allowedr r!�r0rBs  r)rEzLinkHash.is_hash_allowedXs*���>���%�%�d�i�i�D�J�J�%�G�Gr2�r,N)�__name__�
__module__�__qualname__�__doc__�str�__annotations__r%�compile�format�joinr.r8r1�classmethod�	functools�	lru_cacher
r=rr?rrA�boolrE�r2r)rr+s���7��I��J�&�B�J�J�	#�)�)��H�H�U�CT�U�U�	*�	
�
	��.���Y����&�+��+��*�1E�+�'��+�'��c�3�h��'�1�6�1�H�h�v�&6�H�4�Hr2rc�4�eZdZUdZeeeefed<dd�Zy)�MetadataFilezFInformation about a core metadata file associated with a distribution.rBNc�Z�|j�td�|jD��sJ�yy)Nc3�,K�|]}|tv���y�wr$)r.)r'r s  r)r*z-MetadataFile.__post_init__.<locals>.<genexpr>is����I�[�T�t�0�0�[�s�)rB�allr/s r)r1zMetadataFile.__post_init__gs)���;�;�"��I�T�[�[�I�I�I�I�#r2rG)	rHrIrJrKr
rrLrMr1rUr2r)rWrWas��P��T�#�s�(�^�$�$�Jr2rWrBr,c�v�|�y|j�D��cic]\}}|tvs�||��}}}|sy|Scc}}wr$)�itemsr.)rB�n�vs   r)�supported_hashesr_lsG���~��%�|�|�~�
H�~�t�q�!��6G�1G�a��d�~�F�
H����M��Is�5�5�partc�z�tjjtjj|��S)zP
    Clean a "part" of a URL path (i.e. after splitting on "@" characters).
    )�urllib�parse�quote�unquote�r`s r)�_clean_url_path_partrgws(��
�<�<���f�l�l�2�2�4�8�9�9r2c�z�tjjtjj|��S)z�
    Clean the first part of a URL path that corresponds to a local
    filesystem path (i.e. the first part after splitting on "@" characters).
    )rb�request�pathname2url�url2pathnamerfs r)�_clean_file_url_pathrls(���>�>�&�&�v�~�~�'B�'B�4�'H�I�Ir2z(@|%2F)�path�
is_local_pathc�,�|rt}nt}tj|�}g}t	tj|dg��D];\}}|j||��|j|j���=dj|�S)z*
    Clean the path portion of a URL.
    �)
rlrg�_reserved_chars_re�splitr�	itertools�chain�append�upperrP)rmrn�
clean_func�parts�
cleaned_parts�to_clean�reserveds       r)�_clean_url_pathr|�s����)�
�)�
�
�$�$�T�*�E��M�&�y���u�r�d�'C�D���(����Z��1�2����X�^�^�-�.�E�
�7�7�=�!�!r2r5c���tjj|�}|j}t	|j
|��}tjj
|j|���S)z�
    Make sure a link is fully quoted.
    For example, if ' ' occurs in the URL, it will be replaced with "%20",
    and without double-quoting other characters.
    )rn)rm)rbrc�urlparse�netlocr|rm�
urlunparse�_replace)r5�resultrnrms    r)�_ensure_quoted_urlr��sT���\�\�
"�
"�3�
'�F��
�
�%�M��6�;�;�m�D�D��<�<�"�"�6�?�?��?�#=�>�>r2c��eZdZdZgd�Z						d4dedeeedfdeedeed	eed
e	dee
eefddfd
�Zede
eefdededfd��Zede
eeefdedededfd��Zdefd�Zdefd�Zdefd�Zdede	fd�Zdede	fd�Zedefd��Zedefd��Zedefd��Zedefd��Zedefd��Zedefd��Zdeeeffd �Zedefd!��Z edefd"��Z!e"jFd#�Z$e"jFd$e"jJ�Z&deefd%�Z'e"jFd&�Z(edeefd'��Z)dedfd(�Z*de+fd)�Z,edeefd*��Z-edeefd+��Z.edefd,��Z/ede	fd-��Z0de	fd.�Z1ede	fd/��Z2ede	fd0��Z3ede	fd1��Z4ede	fd2��Z5dee+de	fd3�Z6y)5�Linkz:Represents a parsed link from a Package Index's simple URL)	�_parsed_url�_url�_hashes�
comes_from�requires_python�
yanked_reason�metadata_file_data�cache_link_parsing�egg_fragmentNr5r�rr�r�r�r�rBr,c��|jd�rt|�}tjj	|�|_||_tj|�}|�in|j�}	|�|	|_
ni|�|	�|_
||_|r|nd|_||_
||_||_|j!�|_y)a�
        :param url: url of the resource pointed to (href of the link)
        :param comes_from: instance of IndexContent where the link was found,
            or string.
        :param requires_python: String containing the `Requires-Python`
            metadata field, specified in PEP 345. This may be specified by
            a data-requires-python attribute in the HTML link tag, as
            described in PEP 503.
        :param yanked_reason: the reason the file has been yanked, if the
            file has been yanked, or None if the file hasn't been yanked.
            This is the value of the "data-yanked" attribute, if present, in
            a simple repository HTML link. If the file has been yanked but
            no reason was provided, this should be the empty string. See
            PEP 592 for more information and the specification.
        :param metadata_file_data: the metadata attached to the file, or None if
            no such metadata is provided. This argument, if not None, indicates
            that a separate metadata file exists, and also optionally supplies
            hashes for that file.
        :param cache_link_parsing: A flag that is used elsewhere to determine
            whether resources retrieved from this link should be cached. PyPI
            URLs should generally have this set to False, for example.
        :param hashes: A mapping of hash names to digests to allow us to
            determine the validity of a download.
        z\\N)�
startswithrrbrc�urlsplitr�r�rr=r?r�r�r�r�r�r��
_egg_fragmentr�)
r0r5r�r�r�r�r�rB�	link_hash�hashes_from_links
          r)�__init__z
Link.__init__�s���P�>�>�&�!��c�"�C�!�<�<�0�0��5�����	��3�3�C�8�	�!*�!2�2�	�8I�8I�8K���>�+�D�L�9�f�9�(8�9�D�L�$���2A��t���*���"4���"4��� �.�.�0��r2�	file_data�page_urlc���|jd�}|�yttjj	||��}|jd�}|jd�}|jdi�}|jd�}|�|jd�}t|t�rtt|��}	n|rtd�}	nd}	|rt|t�sd}n|sd}|||||||	�	�S)
zZ
        Convert an pypi json document from a simple repository page into a Link.
        r5Nzrequires-python�yankedrBz
core-metadatazdist-info-metadatarp)r�r�r�rBr�)
�getr�rbrc�urljoin�
isinstance�dictrWr_rL)
r;r�r��file_urlr5�	pyrequirer�rB�
metadata_infor�s
          r)�	from_jsonzLink.from_jsons����=�=��'����� ����!5�!5�h��!I�J���M�M�"3�4�	�!�
�
�h�/�
����x��,��"�
�
�o�6�
�� �%�M�M�*>�?�M��m�T�*�!-�.>�}�.M�!N��
�!-�d�!3��"&����M�3�!?��M�� �M����%�'��1�

�	
r2�anchor_attribs�base_urlc���|jd�}|syttjj	||��}|jd�}|jd�}|jd�}|�|jd�}|dk(rtd�}	nW|�d}	nR|j
d�\}
}}|dk(rtt|
|i��}	n!tjd	|�td�}	||||||	�
�S)z_
        Convert an anchor element's attributes in a simple repository page to a Link.
        �hrefNzdata-requires-pythonzdata-yankedzdata-core-metadatazdata-dist-info-metadata�true�=z8Index returned invalid data-dist-info-metadata value: %s)r�r�r�r�)
r�r�rbrcr�rW�	partitionr_�logger�debug)
r;r�r�r�r�r5r�r�r�r��hashname�sep�hashvals
             r)�from_elementzLink.from_element7s���!�!�&�)���� ����!5�!5�h��!E�F��"�&�&�'=�>�	�&�*�*�=�9�
�'�*�*�+?�@�
�� �*�.�.�/H�I�M��F�"�!-�d�!3��
�
"�!%��&3�%<�%<�S�%A�"�H�c�7��c�z�%1�2B�H�g�CV�2W�%X�"����N�!��&2�$�%7�"����%�'�1�
�	
r2c���|jrd|j�d�}nd}|jr't|j��d|j�d|��Stt	|j��S)Nz (requires-python:�)rpz (from )r�r�rr�rL)r0�rps  r)�__str__zLink.__str__ksf�����%�d�&:�&:�%;�1�=�B��B��?�?�*�4�9�9�5�6�g�d�o�o�=N�a�PR�t�T�T�'��D�I�I��7�7r2c��d|�d�S)Nz<Link �>rUr/s r)�__repr__z
Link.__repr__us����v�Q��r2c�,�t|j�Sr$)�hashr5r/s r)�__hash__z
Link.__hash__xs���D�H�H�~�r2�otherc�`�t|t�stS|j|jk(Sr$�r�r��NotImplementedr5�r0r�s  r)�__eq__zLink.__eq__{s%���%��&�!�!��x�x�5�9�9�$�$r2c�`�t|t�stS|j|jkSr$r�r�s  r)�__lt__zLink.__lt__�s%���%��&�!�!��x�x�%�)�)�#�#r2c��|jSr$)r�r/s r)r5zLink.url�s���y�y�r2c�
�|jjd�}tj|�}|st	|j
�\}}|Stjj|�}|sJd|j�d���|S)N�/zURL z produced no filename)
rm�rstrip�	posixpath�basenamerrrbrcrer�)r0rmr r�	user_passs     r)�filenamez
Link.filename�sw���y�y����$���!�!�$�'���!7�t�{�{� C��F�I��M��|�|�#�#�D�)���>�t�D�I�I�=�(=�>�>�t��r2c�,�t|j�Sr$)rr5r/s r)�	file_pathzLink.file_path�s���4�8�8�$�$r2c�.�|jjSr$)r��schemer/s r)r�zLink.scheme�s�����&�&�&r2c�.�|jjS)z4
        This can contain auth information.
        )r�rr/s r)rzLink.netloc�s��
���&�&�&r2c�h�tjj|jj�Sr$)rbrcrer�rmr/s r)rmz	Link.path�s#���|�|�#�#�D�$4�$4�$9�$9�:�:r2c�p�ttj|jj	d���S)Nr�)rr�r�rmr�r/s r)rz
Link.splitext�s'���	�*�*�4�9�9�+;�+;�C�+@�A�B�Br2c�(�|j�dS�N�)rr/s r)�extzLink.ext�s���}�}��q�!�!r2c�n�|j\}}}}}tjj||||df�S)Nrp)r�rbrc�
urlunsplit)r0r�rrm�query�fragments      r)�url_without_fragmentzLink.url_without_fragment�s8��04�0@�0@�-����e�X��|�|�&�&����e�R�'H�I�Ir2z[#&]egg=([^&]*)z)^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$c���|jj|j�}|sy|jd�}|jj|�st
|�d�ddd��|S)Nr�z1 contains an egg fragment with a non-PEP 508 namez8to use the req @ url syntax, and remove the egg fragmentz25.0ia-)�reason�replacement�gone_in�issue)�_egg_fragment_rer9r��group�_project_name_rer<r
)r0r<�project_names   r)r�zLink._egg_fragment�si���%�%�,�,�T�Y�Y�7�����{�{�1�~���$�$�*�*�<�8����P�Q�V���	
��r2z[#&]subdirectory=([^&]*)c�t�|jj|j�}|sy|jd�Sr�)�_subdirectory_fragment_rer9r�r�)r0r<s  r)�subdirectory_fragmentzLink.subdirectory_fragment�s0���.�.�5�5�d�i�i�@�����{�{�1�~�r2c��|j�y|j�d�}|jj�t|�St||jj��S)z<Return a link to the associated core metadata file (if any).Nz	.metadata)rB)r�r�rBr�)r0�metadata_urls  r)�
metadata_linkzLink.metadata_link�sZ���"�"�*���3�3�4�I�>���"�"�)�)�1���%�%��L��)@�)@�)G�)G�H�Hr2c�~�t|jj�D��cic]	\}}||g��c}}�Scc}}wr$)rr�r\)r0�kr^s   r)rAzLink.as_hashes�s8���$�,�,�*<�*<�*>�?�*>�$�!�Q�q�1�#�v�*>�?�@�@��?s�9
c�\�tt|jj��d�Sr$)�next�iterr��valuesr/s r)r�z	Link.hash�s!���D����,�,�.�/��6�6r2c�@�tt|j�d�Sr$)r�r�r�r/s r)r(zLink.hash_name�s���D����&��-�-r2c��tj|jjdd�djdd�d�S)N�#r�r�?)r�r�r�rrr/s r)�show_urlz
Link.show_url�s9���!�!�$�)�)�/�/�#�q�"9�!�"<�"B�"B�3��"J�1�"M�N�Nr2c� �|jdk(S)N�file)r�r/s r)�is_filezLink.is_file�s���{�{�f�$�$r2c�p�|jxr)tjj|j�Sr$)r��osrm�isdirr�r/s r)�is_existing_dirzLink.is_existing_dir�s"���|�|�=����
�
�d�n�n� =�=r2c�(�|jtk(Sr$)r�rr/s r)�is_wheelz
Link.is_wheel�s���x�x�?�*�*r2c�>�ddlm}|j|jvS)Nr)�vcs)�pip._internal.vcsr�r��all_schemes)r0r�s  r)�is_vcszLink.is_vcs�s��)��{�{�c�o�o�-�-r2c��|jduSr$)r�r/s r)�	is_yankedzLink.is_yankeds���!�!��-�-r2c�,�t|j�Sr$)rTr�r/s r)�has_hashz
Link.has_hashs���D�L�L�!�!r2c�b����yt�fd�|jj�D��S)zS
        Return True if the link has a hash and it is allowed by `hashes`.
        Fc3�H�K�|]\}}�j||����y�wr$)rE)r'r�r^rBs   �r)r*z'Link.is_hash_allowed.<locals>.<genexpr>s%�����Q�<P�D�A�q�6�)�)�!�Q�/�<P�s�")�anyr�r\rFs `r)rEzLink.is_hash_allowed	s+����>���Q�D�L�L�<N�<N�<P�Q�Q�Qr2)NNNNTN)7rHrIrJrK�	__slots__rLr
rrWrTrr�rQrrr�r�r�r��intr�r�r��propertyr5r�r�r�rrmrrr�r�r%rNr��
IGNORECASEr�r�r�r�r�rrAr�r(r�r�r�r�rrrrErUr2r)r�r��s��D�
�I�<@�)-�'+�59�#'�.2�=1�
�=1��U�3��#6�7�8�=1�"�#��	=1�
 ��}�=1�%�\�2�
=1�!�=1����c��*�+�=1�
�=1�~�0
���S��>�0
��0
�
�&�	�	0
��0
�d�1
��S�(�3�-�/�0�1
��1
��	1
�

�&�	�1
��1
�f8��8� �#� ��#��%�C�%�D�%�
$�C�$�D�$�
��S������#�����%�3�%��%��'��'��'��'��'��'��;�c�;��;�C�%��S��/�C��"�S�"��"��J�c�J��J�"�r�z�z�"4�5��"�r�z�z�4�b�m�m����x��}��$!+��
�
�+F� G��
��x��}����I�x��/�I�A�6�A��7�h�s�m�7��7��.�8�C�=�.��.��O�#�O��O��%��%��%�>��>��+�$�+��+��.��.��.�
�.�4�.��.��"�$�"��"�R�h�v�&6�R�4�Rr2r�c�|�eZdZUdZej
jed<ee	e
e	fed<e	ed<ee	e	fed<y)�_CleanResulta�Convert link for equivalency check.

    This is used in the resolver to check whether two URL-specified requirements
    likely point to the same distribution and can be considered equivalent. This
    equivalency logic avoids comparing URLs literally, which can be too strict
    (e.g. "a=1&b=2" vs "b=2&a=1") and produce conflicts unexpecting to users.

    Currently this does three things:

    1. Drop the basic auth part. This is technically wrong since a server can
       serve different content based on auth, but if it does that, it is even
       impossible to guarantee two URLs without auth are equivalent, since
       the user can input different auth information when prompted. So the
       practical solution is to assume the auth doesn't affect the response.
    2. Parse the query to avoid the ordering issue. Note that ordering under the
       same key in the query are NOT cleaned; i.e. "a=1&a=2" and "a=2&a=1" are
       still considered different.
    3. Explicitly drop most of the fragment part, except ``subdirectory=`` and
       hash values, since it should have no impact the downloaded content. Note
       that this drops the "egg=" part historically used to denote the requested
       project (and extras), which is wrong in the strictest sense, but too many
       people are supplying it inconsistently to cause superfluous resolution
       conflicts, so we choose to also ignore them.
    �parsedr��subdirectoryrBN)rHrIrJrKrbrc�SplitResultrMrrLrrUr2r)r
r
s@���2
�L�L�$�$�$���T�#�Y��������c��N�r2r
�linkc��|j}|jjdd�d}|jdk(r|sd}tj
j
|j�}d|vrtjd|�	|dd	}tD�cic]}||vs�|||d	��}}t|j|d
d
��tj
j
|j�||��S#ttf$rd
}Y�zwxYwcc}w)
N�@r����r��	localhost�eggzIgnoring egg= fragment in %srrrp)rr�r�)rr�rrB)r�r�rsplitr�rbrc�parse_qsr�r�r��
IndexError�KeyErrorr.r
r�r�)rrrr�rr�rBs       r)�_clean_linkr2s��
�
�
�F�
�]�]�
!�
!�#�q�
)�"�
-�F�
�}�}���v����|�|�$�$�V�_�_�5�H�������3�T�:�� ��/��2��
*;�
L�):�A�a�8�m�a��!��Q���):�F�
L�����f�B���D��l�l�#�#�F�L�L�1�!��	���
��!������Ms�C2�	D	�D	�2D�Dr3�link1�link2c�0�t|�t|�k(Sr$)r)rrs  r)�links_equivalentrLs���u���U�!3�3�3r2):rRrs�loggingr�r�r%�urllib.parserb�dataclassesr�typingrrrrrr	r
rr�pip._internal.utils.deprecationr
�pip._internal.utils.filetypesr�pip._internal.utils.hashesr�pip._internal.utils.miscrrrr�pip._internal.utils.urlsrr�pip._internal.index.collectorr�	getLoggerrHr�r.rrWrLr_rgrlrNrrqrTr|r��total_orderingr�r
rrSrrUr2r)�<module>r,s������	��	��!�
�
�
�7�9�-���>��:�	��	�	�8�	$��
L���$��2H�2H��2H�j�$��J�J��J��X�d�3��8�n�5��(�4��S��>�:R��:�s�:�s�:�
J�s�
J�s�
J� �R�Z�Z�	�2�=�=�9��"�#�"�d�"�s�"�,?�C�?�C�?����YR�YR��YR�x
�:��@�d��|��4����T�"�4�D�4��4�$�4�#�4r2

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists