Viewing File: /opt/hc_python/lib/python3.12/site-packages/pip/_internal/utils/__pycache__/pylock.cpython-312.pyc

�

T�*j�$����ddlmZddlZddlZddlmZmZddlmZddl	m
Z
ddlmZm
Z
ddlmZmZmZmZmZmZmZmZddlmZdd	lmZdd
lmZddlmZddlm Z m!Z!e
rdd
l"m#Z#ddl$m%Z%						dd�Z&						dd�Z'ejPdejR�Z*dd�Z+dd�Z,								d d�Z-						d!d�Z.						d"d�Z/						d#d�Z0						d$d�Z1						d%d�Z2d&d�Z3						d'd�Z4y)(�)�annotationsN)�Iterable�Iterator)�Path)�
TYPE_CHECKING)�urljoin�urlsplit)�Package�PackageArchive�PackageDirectory�PackageSdist�
PackageVcs�PackageWheel�Pylock�is_valid_pylock_path)�Version)�InstallationError)�Link)�tomllib)�path_to_url�url_to_path)�
PipSession)�InstallRequirementc	�\�|j�}|j�}|j}|sJ�d}d}d}d}d}d}	|j�rv|jrct|jj|jd|jj|jj|j��}�n�|jr�ttt|j��j�j|�j!�|jj"r|jj"nd|j��}�n@|j$rX|j$j&s
t)��t+|jd|j$j&|j��}n�t)��|j,}|j$r�|j$j&s
t)��t/|j�}
|
j0r8t3|
j4|j|j$j&��g}	nAt7|
j4|j|j$j&��}n
t)��t9|j:||||||	��S)N)�type�url�path�requested_revision�	commit_id�subdirectory)r�editabler )rr�hashesr )�namerr")r#�version�vcs�	directory�archive�sdist�wheels)�resolve�get_dist�
download_info�	is_direct�vcs_inforr%rrrr �dir_inforrr�relative_to�as_posixr!�archive_infor"�NotImplementedErrorrr$r�is_wheelr�filenamer
r
�canonical_name)�ireq�base_dir�distr,�package_version�package_vcs�package_directory�package_archive�
package_sdist�package_wheels�links           �I/opt/hc_python/lib/python3.12/site-packages/pip/_internal/utils/pylock.py�(_pylock_package_from_install_requirementrB sC�����!�H��=�=�?�D��&�&�M���=��O��K����O��M��N��~�~��!�!�$�"�+�+�/�/�!�%�%��#0�#9�#9�#L�#L�'�0�0�:�:�*�7�7�
�K��
#�
#� 0���]�%6�%6�7�8��W�Y� �[��*��X�Z�%�-�-�6�6�"�*�*�3�3��*�7�7�
!���
'�
'� �-�-�4�4�)�+�+�,�!�%�%��$�1�1�8�8�*�7�7�	�O�&�'�'��,�,���%�%� �-�-�4�4�)�+�+��
�)�)�*�D��}�}� �!�]�]�)�-�-�,�9�9�@�@��"��!-����%�)�)�(�5�5�<�<�!�
�&�'�'��
�
 �
 ���#������c�\��ttd�dt�fd�|D�d�����S)Nz1.0�pipc3�6�K�|]}t|�����y�w�N)rB)�.0r7r8s  �rA�	<genexpr>z3pylock_from_install_requirements.<locals>.<genexpr>{s �����
�0�D�9��x�H�0�s�c��|jSrG)r#)�ps rA�<lambda>z2pylock_from_install_requirements.<locals>.<lambda>s��!�&�&rC)�key)�lock_version�
created_by�packages)rr�sorted)�install_requirementsr8s `rA� pylock_from_install_requirementsrSts6�����U�^���
�0�
�!�
�
�
rCz^(http|https|file)://c�>�ttj|��SrG)�bool�
_SCHEME_RE�match)�ss rA�_is_urlrY�s���
� � ��#�$�$rCc��t|�r;tt|�jj	d�d�}t|�St|�}t|�S)N�/���)rYrr	r�
rpartitionr)r5rs  rA�is_valid_pylock_filenamer^�sR���x���H�X�&�+�+�6�6�s�;�B�?�@�� ��%�%��H�~����%�%rCc�X�|��tjj|�s]t|�rt	||�Sttjj
tjj|�|��St|�rtd|�d|����t|�S|�J�|S)z�Compute an url from a Pylock package path and url.

    Give priority to path over url. If path is relative,
    compute an url using the pylock file location as base.
    zFAbsolute paths are not supported in pylock files obtained from a URL: z in )	�osr�isabsrYrr�join�dirnamer)�pylock_path_or_urlrrs   rA�_package_dist_urlre�s������w�w�}�}�T�"��)�*��1�4�8�8�"��G�G�L�L������1C�!D�d�K���
�)�*�'�#�#'�(�$�/A�.D�F����t�$�$������
rCc���t||j|j�}|j�d|�d|j��}|j
r(d|vrt
d|�d|�d���|d|j
zz
}|S)N�+�@�#�Package URL �E cannot contain fragments in combination with subdirectory field (in �)�#subdirectory=)rerrrrr r)rdr;�dist_urlrs    rA�package_vcs_requirement_urlro�s���!�!3�[�5E�5E�{���W�H�
�
�
��a��z��;�+@�+@�*A�
B�C�����#�:�#��s�g�&/�/A�.D�A�G��
�	��+�":�":�:�:���JrCc��t||j|j�}|jr(d|vrt	d|�d|�d���|d|jzz
}|S)Nrirjrkrlrm)rerrr r)rdr=rs   rA�package_archive_requirement_urlrq�sw����O�0�0�/�2E�2E��C��#�#��#�:�#��s�g�&/�/A�.D�A�G��
�	��/�">�">�>�>���JrCc�<�t|�r|jd�std|����t||jd�}|jd�sJ�|jd�s|dz
}|jr%||jz
}|jd�s|dz
}|S)Nzfile://z:Directory entries are not supported in remote pylock.toml r[)rY�
startswithrrer�endswithr )rdr<rs   rA�!package_directory_requirement_urlru�s����!�"�+=�+H�+H��+S��H�!�$�
&�
�	
��.�0A�0F�0F��
M�C��>�>�)�$�$�$��<�<����s�
���%�%�� �-�-�-���|�|�C� ��3�J�C��JrCc�D�t||j|j�SrG�rerr)rdr>s  rA�package_sdist_requirement_urlrx�� ���/��1C�1C�]�EV�EV�W�WrCc�D�t||j|j�SrGrw)rd�
package_wheels  rA�package_wheel_requirement_urlr|�ryrCc��t|�j}|dvr+ddlm}|j	|�}||�|j
St
|�jd��S)N)�http�https�filer)�raise_for_statuszutf-8)�encoding)r	�scheme�pip._internal.network.utilsr��get�textr�	read_text)�path_or_url�sessionr�r��resps     rA�_get_pylock_path_or_url_contentr��sY��
�k�
"�
)�
)�F�
�*�*�@��{�{�;�'������y�y�����&�&��&�8�8rCc#�K�	t||�}	tjtj|��}	|j�Ed{���y#t$r}td|�d|���|�d}~wwxYw#t$r}td|�d|���|�d}~wwxYw7�K#t$r}td|�d|���|�d}~wwxYw�w)NzError reading pylock file z: zInvalid pylock file z,Cannot select requirements from pylock file )r��	Exceptionrr�	from_dictr�loads�select)rdr��pylock_content�exc�locks     rA�select_from_pylock_path_or_urlr��s������8�9K�W�U�������
�
�n� =�>����;�;�=� � �����(�);�(>�b���F�
��	�������"�#5�"8��3�%�@�
��	����	!�����:�;M�:P�PR�SV�RW�X�
��	���st�B>�A�(A6�B�
B�B�B>�	A3�A.�.A3�3B>�6	B�?B�B�B>�B�	B;�$B6�6B;�;B>)r7rr8r�returnr
)rRzIterable[InstallRequirement]r8rr�r)rX�strr�rU)r5r�r�rU)rdr�r�
str | Nonerr�r�r�)rdr�r;rr�r�)rdr�r=rr�r�)rdr�r<rr�r�)rdr�r>r
r�r�)rdr�r{rr�r�)r�r�r�rr�r�)rdr�r�rr�zfIterator[tuple[Package, PackageVcs | PackageDirectory | PackageArchive | PackageWheel | PackageSdist]])5�
__future__rr`�re�collections.abcrr�pathlibr�typingr�urllib.parserr	�pip._vendor.packaging.pylockr
rrr
rrrr�pip._vendor.packaging.versionr�pip._internal.exceptionsr�pip._internal.models.linkr�pip._internal.utils.compatr�pip._internal.utils.urlsrr�pip._internal.network.sessionr�pip._internal.req.req_installrrBrS�compile�
IGNORECASErVrYr^rerorqrurxr|r�r��rCrA�<module>r�s���"�	�	�.�� �*�	�	�	�2�6�*�.�=��8�@�Q�
�Q�(,�Q��Q�h
�6�
�BF�
��
� �R�Z�Z�/����
?�
�%�&����#-��4>����<���*4����
��
�.<�
��
� ���0@����&X��X�,8�X��X�X��X�,8�X��X�
9� ���
���rC
Back to Directory File Manager