� ��^iYA���UdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl ZddlZddlmZmZmZmZmZmZmZmZmZddlmZmZddlmZddlm Z m!Z!ddl"m#Z#m$Z$ddl%m&Z&dd l'm(Z(dd l)m*Z*dd l+m,Z,dd l-m.Z.dd l/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:m;Z;ddle?��Z@eeAeAeeeBeAffZCejDde*���gd�ZEeeCeFd<dZGdeHfd�ZIdeAfd�ZJGd�de ��ZKGd�de!��ZLGd �d!e��ZMGd"�d#ejN��ZOdS)$zhPipSession and supporting code, containing all pip-specific network request configuration and behavior. �N) �Any�Dict�Iterator�List�Mapping�Optional�Sequence�Tuple�Union)�requests�urllib3)�CacheControlAdapter)� BaseAdapter� HTTPAdapter)�PreparedRequest�Response)�CaseInsensitiveDict)�ConnectionPool)�InsecureRequestWarning)� __version__)�get_default_environment)�Link)�MultiDomainBasicAuth)� SafeFileCache)�has_tls)�libc_ver)�build_url_from_netloc� parse_netloc)� url_to_path�ignore)�category))�https�*r#)r#� localhostr#)r#z 127.0.0.0/8r#)r#z::1/128r#)�filer#N)�sshr#r#�SECURE_ORIGINS)� BUILD_BUILDID�BUILD_ID�CI� PIP_IS_CI�returnc�>�td�tD����S)z? Return whether it looks like pip is running under CI. c3�2K�|]}|tjvV��dS�N)�os�environ)�.0�names ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/network/session.py� z looks_like_ci..Xs)����G�G�d�t�r�z�!�G�G�G�G�G�G�)�any�CI_ENVIRONMENT_VARIABLES�r6r4� looks_like_cir:Qs"�� �G�G�.F�G�G�G� G� G�Gr6c �l�dtd�tj��dtj��id�}|dddkrtj��|dd<n�|dddkrJtj}|jd kr |d d �}d �d �|D����|dd<n]|dddkrtj��|dd<n.|dddkrtj��|dd<tj�d��r�ddl m }|� ��|� ��|� ��f}ttd�t!gd�|������}ttd�t!ddgt#��������}|r||d<|r||d<tj�d��r8tj��drdtj��dd�|d<tj��r*tj��|�di��d<tj��r*tj��|�di��d<tj��rtj��|d<t/��rdd l}|j|d<t5���d��}|�t9|j ��|d <t;jd!���z t?j d!d"gt>j!d#�$��}|�d%��r0|�"d&��d'�#��|d(<n#tH$rYnwxYwtK��rd)nd |d*<tLj'�(d+��} | �| |d,<d-�)|tUj+|d.d)�/���0��S)1z6 Return a string representing the user agent. �pip)r3�versionr3)� installer�python�implementationr@�CPythonr=�PyPy�finalN��.c�,�g|]}t|����Sr9)�str)r2�xs r4� zuser_agent..ns�� /� /� /��S��V�V� /� /� /r6�Jython� IronPython�linuxr)�distroc��|dS�N�r9�rHs r4�zuser_agent..}� ��!�A�$�r6)r3r=�idc��|dSrOr9rQs r4rRzuser_agent..�rSr6�lib�libcrM�darwin�macOS�system�release�cpu�openssl_version� setuptools�setuptools_version�rustcz --versiong�?)�stderr�timeoutsrustc � rP� rustc_versionT�ci�PIP_USER_AGENT_USER_DATA� user_dataz9{data[installer][name]}/{data[installer][version]} {json})�,�:)� separators� sort_keys)�data�json),r�platform�python_version�python_implementation�sys�pypy_version_info� releaselevel�join� startswith� pip._vendorrMr3r=�codename�dict�filter�zipr�mac_verrZ� setdefaultr[�machiner�_ssl�OPENSSL_VERSIONr�get_distributionrG�shutil�which� subprocess� check_output�STDOUT�split�decode� Exceptionr:r0r1�get�formatrm�dumps) rlrrrM�linux_distribution� distro_infosrW�ssl�setuptools_dist� rustc_outputrgs r4� user_agentr�[sk�� $� �<�<��)�+�+� �H�2�4�4� ���D� � ��f�%��2�2�,4�,C�,E�,E�� ��y�)�)� �� �� '�6� 1� 1��1�� � )�W� 4� 4� 1�"�1�"� 5� �,/�H�H� /� /�.� /� /� /�- �- �� ��y�)�)� �� �� '�8� 3� 3�,4�,C�,E�,E�� ��y�)�)� �� �� '�<� 7� 7�,4�,C�,E�,E�� ��y�)� �|���w�'�'�*�&�&�&�&�&�&�#�[�[�]�]�F�N�N�,<�,<�f�o�o�>O�>O�O��'+� ����-�-�-�/A�B�B� � �( �( � � � ����U�I�&�� � �3�3� � � � �� � (�#'�L�� � � *�)�D��N� �|���x�(�(�M�X�-=�-?�-?��-B�M�")�h�6F�6H�6H��6K�L�L��X������B�08��0A�0A�����"�%�%�f�-�����F�3;�3C�3E�3E�����"�%�%�i�0�����)��&�(�(��U� ��y�y�6�����"%�"5�� ��-�/�/�@�@��N�N�O��"�%(��)@�%A�%A�� !�"� �|�G���(� M�%�2��+�&�z�/@�#����L� �&�&�y�1�1� M�)5�(:�(:�4�(@�(@��(C�(J�(J�(L�(L��_�%���� � � � �D� ����'���2���d�D��J�� ���9�:�:�I���%��[�� F� M� M� � �Z���t� D� D� D� N� � �s�#N?�? O � O c���eZdZ d dededeeeeeeffdeee fdeee ee e ffd ee e e fd e fd �Z dd �Z dS)�LocalFSAdapterFNT�request�streamrb�verify�cert�proxiesr,c��t|j��}t��}d|_|j|_ t j|��} t j�| j d���} tj |��dpd} t| | j | d���|_t|d��|_|jj|_nm#t$$r`} d|_t'| ��j|_t-j|j�d | ���d ����|_Yd} ~ nd} ~ wwxYw|S) N��T)�usegmtrz text/plain)z Content-TypezContent-Lengthz Last-Modified�rbi�z: �utf8)r�urlr� status_coder0�stat�email�utils� formatdate�st_mtime� mimetypes� guess_typer�st_size�headers�open�raw�close�OSError�type�__name__�reason�io�BytesIO�encode) �selfr�r�rbr�r�r��pathname�resp�stats�modified� content_type�excs r4�sendzLocalFSAdapter.send�s>���w�{�+�+���z�z������;��� (��G�H�%�%�E��{�-�-�e�n�T�-�J�J�H�$�/��9�9�!�<�L� �L�.�$0�&+�m�%-�����D�L��H�d�+�+�D�H����D�J�J��%� J� J� J� #�D� ��s�)�)�,�D�K��z�T�[�"9�"9�C�"9�"9�"@�"@��"H�"H�I�I�D�H�H�H�H�H�H�����  J����(� s�C� D;�AD6�6D;c��dSr/r9)r�s r4r�zLocalFSAdapter.close�s�� �r6)FNTNN)r,N)r�� __module__� __qualname__r�boolrr �floatr rGrrr�r�r9r6r4r�r��s��������?C�#'�6:�/3�%�%� �%��%��%��u�U�E�\�':� :�;�<� %� �d�C�i� � %� �u�S�%��S��/�1�2�3� %��'�#�s�(�+�,�%� �%�%�%�%�N � � � � � r6r�c �p��eZdZdededeeefdeeeeeeffddf �fd� Z �xZ S)�InsecureHTTPAdapter�connr�r�r�r,Nc�R��t���||d|���dS�NF)r�r�r�r���super� cert_verify�r�r�r�r�r�� __class__s �r4r�zInsecureHTTPAdapter.cert_verify��,��� ������3�u�4��H�H�H�H�Hr6� r�r�r�rrGr r�rr r�� __classcell__�r�s@r4r�r����������I��I��I��d�C�i� � I� �u�S�%��S��/�1�2�3� I� � I�I�I�I�I�I�I�I�I�Ir6r�c �p��eZdZdededeeefdeeeeeeffddf �fd� Z �xZ S)�InsecureCacheControlAdapterr�r�r�r�r,Nc�R��t���||d|���dSr�r�r�s �r4r�z'InsecureCacheControlAdapter.cert_verify�r�r6r�r�s@r4r�r��r�r6r�c� ��eZdZUdZeeed<ddddd�dededeed e ed ee ed ed df�fd �Z de ed dfd�Z ddedeede d dfd�Zd eefd�Zded e fd�Zdededed ed ef �fd� Z�xZS)� PipSessionNrbrr9)�retries�cache� trusted_hosts� index_urls�argsr�r�r�r��kwargsr,c�z��t��j|i|��g|_t��|jd<t |���|_tj|gd�d���}t|���}|rBtt|��|���}tt|��|���|_ nt|���}||_ |�d|��|�d |��|�d t!����|D]} |�| d � ���d S)zj :param trusted_hosts: Domains not to emit warnings for when not using HTTPS. z User-Agent)r�)i�i�iig�?)�total�status_forcelist�backoff_factor)� max_retries)r�r�zhttps://zhttp://zfile://T)�suppress_loggingN)r��__init__�pip_trusted_originsr�r�r�authr �Retryr�rrr��_trusted_host_adapterr�mountr��add_trusted_host) r�r�r�r�r�r�r��insecure_adapter�secure_adapter�hostr�s �r4r�zPipSession.__init__s~��� �����$�)�&�)�)�)�EG�� �&0�\�\�� �\�"�)�J�?�?�?�� ��-��2�1�1� � � � ��*/�7�C�C�C�� � :�0�#�E�*�*�#����N�*E�#�E�*�*�#�*�*�*�D� &� &� )�W�=�=�=�N�)9�D� &� � � �:�~�.�.�.� � � �9�.�/�/�/� � � �9�n�.�.�/�/�/�!� ?� ?�D� � !� !�$�� !� >� >� >� >� ?� ?r6�new_index_urlsc��||j_dS)zn :param new_index_urls: New index urls to update the authentication handler with. N)r�r�)r�r�s r4�update_index_urlszPipSession.update_index_urlsSs�� .�� ���r6Fr��sourcer�c�6�|s*d|��}|� |d|�d�z }t�|��t|��}||jvr|j�|��|�t |d���dz|j��|�t |��dz|j��|dsZ|�t |d���d z|j��|�t |��d z|j��dSdS) z� :param host: It is okay to provide a host that has previously been added. :param source: An optional source string, for logging where the host string came from. zadding trusted host: Nz (from �)�http)�scheme�/rPri)�logger�inforr��appendr�rr�)r�r�r�r��msg� host_ports r4r�zPipSession.add_trusted_hostZsG�� � �2�$�2�2�C��!��*��*�*�*�*�� �K�K�� � � � ��&�&� � �D�4� 4� 4� � $� +� +�I� 6� 6� 6� � � � !�$�v� 6� 6� 6�� <�d�>X� � � � � � �(��.�.��4�d�6P�Q�Q�Q���|� V� �J�J�%�d�6�:�:�:�S�@��*� � � � �J�J�,�T�2�2�S�8�$�:T� U� U� U� U� U�  V� Vr6c#�TK�tEd{V��|jD]\}}d||�dn|fV��dS)Nr#)r'r�)r�r��ports r4�iter_secure_originszPipSession.iter_secure_originsys\����!�!�!�!�!�!�!�!��2� =� =�J�D�$���T�\�c�c�t�<� <� <� <� <� =� =r6�locationc�T�tj�t|����}|j|j|j}}}|�dd��d}|���D]�}|\}}} ||kr|dkr� tj |��} tj |��} | | vr�CnD#t$r7|r2|� ��|� ��kr|dkrY��YnwxYw|| kr | dkr| ���dSt�d||��dS)N�+rP�����r#Tz�The repository located at %s is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host %s'.F)�urllib�parse�urlparserGr��hostnamer��rsplitr�� ipaddress� ip_address� ip_network� ValueError�lowerr��warning) r�r��parsed�origin_protocol� origin_host� origin_port� secure_origin�secure_protocol� secure_host� secure_port�addr�networks r4�is_secure_originzPipSession.is_secure_origin~s����&�&�s�8�}�}�5�5�� �M� �O� �K�'2���*�0�0��a�8�8��<�� "�5�5�7�7�! �! �M�8E� 5�O�[�+��/�1�1�o��6L�6L�� � �+�K�8�8��#�.�{�;�;���w�&�&��'��� � � � ��#�)�)�+�+�{�/@�/@�/B�/B�B�B�#�s�*�*��H��� ����"�{�*�*��3�&�&��+���4�4� ��� I� � �  � � ��us�(B6�6=�X�l�%;�=�=�=�=� A��A�$�A�A�A�A�F=�c�=��=�C�=�3�=�8�=�=�=�=�=�=�=�=�=�=r6r�)P�__doc__� email.utilsr�r�rrm�loggingr�r0rnr�r�rq� urllib.parser��warnings�typingrrrrrrr r r rvr r �pip._vendor.cachecontrolr�pip._vendor.requests.adaptersrr�pip._vendor.requests.modelsrr�pip._vendor.requests.structuresr�"pip._vendor.urllib3.connectionpoolr�pip._vendor.urllib3.exceptionsrr<r�pip._internal.metadatar�pip._internal.models.linkr�pip._internal.network.authr�pip._internal.network.cacher�pip._internal.utils.compatr�pip._internal.utils.glibcr�pip._internal.utils.miscrr�pip._internal.utils.urlsr� getLoggerr�r�rGrr�filterwarningsr'rr8r�r:r�r�r�r��Sessionr�r9r6r4�r1s���������� � � � ����� � � � ��������� � � � ����� � � � ����� � � � ���������W�W�W�W�W�W�W�W�W�W�W�W�W�W�W�W�W�W�W�W�W�W�)�)�)�)�)�)�)�)�8�8�8�8�8�8�B�B�B�B�B�B�B�B�A�A�A�A�A�A�A�A�?�?�?�?�?�?�=�=�=�=�=�=�A�A�A�A�A�A�������:�:�:�:�:�:�*�*�*�*�*�*�;�;�;�;�;�;�5�5�5�5�5�5�/�.�.�.�.�.�.�.�.�.�.�.�H�H�H�H�H�H�H�H�0�0�0�0�0�0� �� �8� $� $���S�#�x��c�3�h��8�8�9� �����+A�B�B�B�B� &� &� &���\�"� � � �( ��H�t�H�H�H�H�b�C�b�b�b�b�J) �) �) �) �) �[�) �) �) �XI�I�I�I�I�+�I�I�I�I�I�I�I�I�"5�I�I�I�D=�D=�D=�D=�D=��!�D=�D=�D=�D=�D=r6