HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/Python311/Lib/site-packages/pip/_internal/index/__pycache__/collector.cpython-311.pyc
�

�mi9?����dZddlmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddl
ZddlmZmZmZddlmZddlmZddlmZddlmZmZmZdd	lmZdd
lmZddl m!Z!m"Z"ddl#m$Z$dd
l%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4m5Z5m6Z6e	j7e8��Z9ee:e:fZ;dId�Z<Gd�de=��Z>dJd �Z?Gd!�d"e=��Z@dKd%�ZAdLd&�ZBdMd)�ZCGd*�d+��ZDGd,�d-e��ZEdNd/�ZFeFdOd3���ZGed4�5��Gd6�d1����ZHGd7�d8e��ZI	dPdQd?�ZJ	dRdSdB�ZKdTdD�ZLGdE�dFe��ZMGdG�dH��ZNdS)UzO
The main purpose of this module is to expose LinkCollector.collect_sources().
�)�annotationsN)�Iterable�MutableMapping�Sequence)�	dataclass)�
HTMLParser)�Values)�Callable�
NamedTuple�Protocol)�requests)�Response)�
RetryError�SSLError)�NetworkConnectionError)�Link)�SearchScope)�
PipSession)�raise_for_status)�is_archive_file��redact_auth_from_url)�vcs�)�CandidatesFromPage�
LinkSource�build_source�url�str�return�
str | Nonec��tjD]D}|����|��r|t	|��dvr|cS�EdS)zgLook for VCS schemes in the URL.

    Returns the matched VCS scheme, or None if there's no match.
    z+:N)r�schemes�lower�
startswith�len)r�schemes  �?D:\Python311\Lib\site-packages\pip/_internal/index/collector.py�_match_vcs_schemer).sY��
�+�����9�9�;�;�!�!�&�)�)�	�c�#�f�+�+�.>�$�.F�	��M�M�M���4�c� ��eZdZd�fd�Z�xZS)�_NotAPIContent�content_typer�request_descr �Nonec�h��t���||��||_||_dS�N)�super�__init__r-r.)�selfr-r.�	__class__s   �r(r3z_NotAPIContent.__init__:s3���
������|�4�4�4�(���(����r*)r-rr.rr r/)�__name__�
__module__�__qualname__r3�
__classcell__�r5s@r(r,r,9s=�������)�)�)�)�)�)�)�)�)�)r*r,�responserr/c���|j�dd��}|���}|�d��rdSt	||jj���)z�
    Check the Content-Type header to ensure the response contains a Simple
    API Response.

    Raises `_NotAPIContent` if the content type is not a valid content-type.
    �Content-Type�Unknown)z	text/htmlz#application/vnd.pypi.simple.v1+html�#application/vnd.pypi.simple.v1+jsonN)�headers�getr$r%r,�request�method)r;r-�content_type_ls   r(�_ensure_api_headerrE@sg���#�'�'��	�B�B�L�!�'�'�)�)�N�� � �	
����	��
��x�'7�'>�
?�
?�?r*c��eZdZdS)�_NotHTTPN)r6r7r8�r*r(rGrGVs�������Dr*rG�sessionrc���tj�|��\}}}}}|dvrt���|�|d���}t|��t
|��dS)z�
    Send a HEAD request to the URL, and ensure the response contains a simple
    API Response.

    Raises `_NotHTTP` if the URL is not available for a HEAD request, or
    `_NotAPIContent` if the content type is not a valid content type.
    >�http�httpsT)�allow_redirectsN)�urllib�parse�urlsplitrG�headrrE)rrIr'�netloc�path�query�fragment�resps        r(�_ensure_api_responserWZss��-3�L�,A�,A�#�,F�,F�)�F�F�D�%��
�&�&���j�j���<�<��T�<�2�2�D��T�����t�����r*c���tt|��j��rt||���t�dt
|����|�|d�gd���dd����}t|��t|��t�dt
|��|j�d	d
����|S)aYAccess an Simple API response with GET, and return the response.

    This consists of three parts:

    1. If the URL looks suspiciously like an archive, send a HEAD first to
       check the Content-Type is HTML or Simple API, to avoid downloading a
       large file. Raise `_NotHTTP` if the content type cannot be determined, or
       `_NotAPIContent` if it is not HTML or a Simple API.
    2. Actually perform the request. Raise HTTP exceptions on network failures.
    3. Check the Content-Type header to make sure we got a Simple API response,
       and raise `_NotAPIContent` otherwise.
    �rIzGetting page %sz, )r?z*application/vnd.pypi.simple.v1+html; q=0.1ztext/html; q=0.01z	max-age=0)�Acceptz
Cache-Control)r@zFetched page %s as %sr=r>)rr�filenamerW�logger�debugrrA�joinrrEr@)rrIrVs   r(�_get_simple_responser_ls����t�C�y�y�)�*�*�3��S�'�2�2�2�2�
�L�L�"�$8��$=�$=�>�>�>��;�;���i�i������()�+
�
����D�4�T�����t����
�L�L���S�!�!�������3�3�����Kr*r@�ResponseHeadersc��|rSd|vrOtj���}|d|d<|�d��}|rt	|��SdS)z=Determine if we have any encoding information in our headers.r=zcontent-type�charsetN)�email�message�Message�	get_paramr)r@�mrbs   r(�_get_encoding_from_headersrh�sb��� �>�W�,� ��M�!�!�#�#��#�N�3��.���+�+�i�(�(���	 ��w�<�<���4r*c�&�eZdZd
d�Zdd	�Zdd�ZdS)�CacheablePageContent�page�IndexContentr r/c�&�|jsJ�||_dSr1)�cache_link_parsingrk�r4rks  r(r3zCacheablePageContent.__init__�s���&�&�&�&���	�	�	r*�other�object�boolc�p�t|t|����o|jj|jjkSr1)�
isinstance�typerkr)r4rps  r(�__eq__zCacheablePageContent.__eq__�s*���%��d���,�,�P����%�*�.�1P�Pr*�intc�4�t|jj��Sr1)�hashrkr�r4s r(�__hash__zCacheablePageContent.__hash__�s���D�I�M�"�"�"r*N)rkrlr r/)rprqr rr)r rw)r6r7r8r3rvr{rHr*r(rjrj�sT����������Q�Q�Q�Q�#�#�#�#�#�#r*rjc��eZdZdd�ZdS)�
ParseLinksrkrlr �Iterable[Link]c��dSr1rHros  r(�__call__zParseLinks.__call__�s���r*N�rkrlr r~)r6r7r8r�rHr*r(r}r}�s������A�A�A�A�A�Ar*r}�fnc�|���tjd	�fd����tj���d
��fd���}|S)z�
    Given a function that parses an Iterable[Link] from an IndexContent, cache the
    function's result (keyed by CacheablePageContent), unless the IndexContent
    `page` has `page.cache_link_parsing == False`.
    �cacheable_pagerjr �
list[Link]c�>��t�|j����Sr1)�listrk)r�r�s �r(�wrapperz*with_cached_index_content.<locals>.wrapper�s����B�B�~�*�+�+�,�,�,r*rkrlc�r��|jr�t|����St�|����Sr1)rnrjr�)rkr�r�s ��r(�wrapper_wrapperz2with_cached_index_content.<locals>.wrapper_wrapper�s;����"�	7��7�/��5�5�6�6�6��B�B�t�H�H�~�~�r*)r�rjr r�)rkrlr r�)�	functools�cache�wraps)r�r�r�s` @r(�with_cached_index_contentr��sr�����_�-�-�-�-�-��_�-��_�R������������
�r*rkrlr~c#�K�|j���}|�d��rUtj|j��}|�dg��D]#}tj||j	��}|��|V��$dSt|j	��}|jpd}|�|j�
|����|j	}|jp|}|jD] }	tj|	||���}|��|V��!dS)z\
    Parse a Simple API's Index Content, and yield its anchor elements as Link objects.
    r?�filesNzutf-8)�page_url�base_url)r-r$r%�json�loads�contentrAr�	from_jsonr�HTMLLinkParser�encoding�feed�decoder��anchors�from_element)
rkrD�data�file�link�parserr�rr��anchors
          r(�parse_linksr��s'�����&�,�,�.�.�N�� � �!F�G�G���z�$�,�'�'���H�H�W�b�)�)�	�	�D��>�$���1�1�D��
���J�J�J�J���
�D�H�
%�
%�F��}�'��H�
�K�K���#�#�H�-�-�.�.�.�
�(�C���%�#�H��.����� ��#��I�I�I���	���
�
�
�
�	�r*T)�frozenc�R�eZdZUdZded<ded<ded<ded<d	Zd
ed<dd
�ZdS)rla�Represents one response (or page), along with its URL.

    :param encoding: the encoding to decode the given content.
    :param url: the URL from which the HTML was downloaded.
    :param cache_link_parsing: whether links parsed from this page's url
                               should be cached. PyPI index urls should
                               have this set to False, for example.
    �bytesr�rr-r!r�rTrrrnr c�*�t|j��Sr1)rrrzs r(�__str__zIndexContent.__str__s��#�D�H�-�-�-r*N)r r)r6r7r8�__doc__�__annotations__rnr�rHr*r(rlrl�sr����������N�N�N����������H�H�H�#��#�#�#�#�.�.�.�.�.�.r*c�4��eZdZdZd
�fd�Zdd
�Zdd�Z�xZS)r�zf
    HTMLParser that keeps the first base HREF and a list of all anchor
    elements' attributes.
    rrr r/c�v��t���d���||_d|_g|_dS)NT)�convert_charrefs)r2r3rr�r�)r4rr5s  �r(r3zHTMLLinkParser.__init__s7���
�����$��/�/�/����$(��
�46����r*�tag�attrs�list[tuple[str, str | None]]c���|dkr)|j�"|�|��}|�	||_dSdS|dkr)|j�t	|����dSdS)N�base�a)r��get_hrefr��append�dict)r4r�r��hrefs    r(�handle_starttagzHTMLLinkParser.handle_starttags}���&�=�	-�T�]�	-��=�=��'�'�D��
%� $��
�
�
�
%�
%�
�C�Z�	-��L����U���,�,�,�,�,�	-�	-r*r!c�*�|D]\}}|dkr|cS�dS)Nr�rH)r4r��name�values    r(r�zHTMLLinkParser.get_href!s4�� �	�	�K�D�%��v�~�
�����
��tr*)rrr r/)r�rr�r�r r/)r�r�r r!)r6r7r8r�r3r�r�r9r:s@r(r�r�so���������
7�7�7�7�7�7�-�-�-�-��������r*r�r�r�reason�str | Exception�meth�Callable[..., None] | Nonec�<�|�tj}|d||��dS)Nz%Could not fetch URL %s: %s - skipping)r\r])r�r�r�s   r(�_handle_get_simple_failr�(s.��
���|���D�	0�$��?�?�?�?�?r*rnrrc�|�t|j��}t|j|jd||j|���S)Nr=)r�rrn)rhr@rlr�r)r;rnr�s   r(�_make_index_contentr�2sG��*�(�*:�;�;�H�������(���L�-����r*�IndexContent | Nonec���|j�dd��d}t|��}|rt�d||��dSt
j�|��\}}}}}}|dkr�tj	�
t
j�|����rU|�
d��s|dz
}t
j�|d��}t�d|��	t!||�	��}t#||j�
��S#t&$rt�d|��Y�n
t($r1}t�d||j|j��Yd}~n�d}~wt.$r}t1||��Yd}~n�d}~wt2$r}t1||��Yd}~n�d}~wt4$r:}d
}	|	t7|��z
}	t1||	tj���Yd}~nRd}~wt:j$r}t1|d|����Yd}~n(d}~wt:j$rt1|d��YnwxYwdS)N�#rrzICannot look at %s URL %s because it does not support lookup as web pages.r��/z
index.htmlz# file: URL is directory, getting %srY)rnz`Skipping page %s because it looks like an archive, and cannot be checked by a HTTP HEAD request.z�Skipping page %s because the %s request got Content-Type: %s. The only supported Content-Types are application/vnd.pypi.simple.v1+json, application/vnd.pypi.simple.v1+html, and text/htmlz4There was a problem confirming the ssl certificate: )r�zconnection error: z	timed out) r�splitr)r\�warningrNrO�urlparse�osrS�isdirrB�url2pathname�endswith�urljoinr]r_r�rnrGr,r.r-rr�rrr�infor
�ConnectionError�Timeout)
r�rIr�
vcs_schemer'�_rSrV�excr�s
          r(�_get_index_contentr�?s��
�(�.�.��a�
 �
 ��
#�C�#�3�'�'�J������W���	
�	
�	
�
�t� &�|�4�4�S�9�9��F�A�t�Q��1�
���
A�B�G�M�M�&�.�*E�*E�d�*K�*K�L�L�
A��|�|�C� � �	��3�J�C�
�l�"�"�3��5�5�����:�C�@�@�@�U�#�C��9�9�9��:#�4�D�<S�T�T�T�T��9�
�
�
����
1��	
�	
�	
�	
�	
�
�
�
�
����
A�
�����
	
�	
�	
�	
�	
�	
�	
�	
�����"�+�+�+���c�*�*�*�*�*�*�*�*������+�+�+���c�*�*�*�*�*�*�*�*������@�@�@�G���#�c�(�(�����f�6�;�?�?�?�?�?�?�?�?�?������#�B�B�B���&@�3�&@�&@�A�A�A�A�A�A�A�A�������3�3�3���k�2�2�2�2�2�3�����4sT�D6�6%I(�	I(�''F�
I(� F5�5
I(�G�
I(�$0H�I(�+I�"I(�'I(c�$�eZdZUded<ded<dS)�CollectedSourceszSequence[LinkSource | None]�
find_links�
index_urlsN)r6r7r8r�rHr*r(r�r�|s*�������+�+�+�+�+�+�+�+�+�+r*r�c�^�eZdZdZdd�Ze	ddd���Zedd���Zd d�Z	d!d�Z
dS)"�
LinkCollectorz�
    Responsible for collecting Link objects from all configured locations,
    making network requests as needed.

    The class's main method is its collect_sources() method.
    rIr�search_scoperr r/c�"�||_||_dSr1)r�rI)r4rIr�s   r(r3zLinkCollector.__init__�s��
)�������r*F�optionsr	�suppress_no_indexrrc��|jg|jz}|jr<|s:t�dd�d�|D������g}|jpg}tj|||j���}t||���}|S)z�
        :param session: The Session to use to make requests.
        :param suppress_no_index: Whether to ignore the --no-index option
            when constructing the SearchScope object.
        zIgnoring indexes: %s�,c3�4K�|]}t|��V��dSr1r)�.0rs  r(�	<genexpr>z'LinkCollector.create.<locals>.<genexpr>�s+����I�I�s�-�c�2�2�I�I�I�I�I�Ir*)r�r��no_index)rIr�)
�	index_url�extra_index_urlsr�r\r]r^r�r�creater�)�clsrIr�r�r�r�r��link_collectors        r(r�zLinkCollector.create�s����'�(�7�+C�C�
���	�$5�	��L�L�&����I�I�j�I�I�I�I�I�
�
�
��J��'�-�2�
�"�)�!�!��%�
�
�
��
'��%�
�
�
���r*�	list[str]c��|jjSr1)r�r�rzs r(r�zLinkCollector.find_links�s��� �+�+r*�locationrr�c�.�t||j���S)z>
        Fetch an HTML page containing package links.
        rY)r�rI)r4r�s  r(�fetch_responsezLinkCollector.fetch_response�s��"�(�D�L�A�A�A�Ar*�project_namer�candidates_from_pagerr�c�z����tj���fd��j����D�������}tj���fd��jD�������}t�tj	��red�tj||��D��}t|���d��d�g|z}t�
d�|����tt!|��t!|�����S)Nc	3�V�K�|]#}t|��jjdd����V��$dS)F�r��page_validator�
expand_dirrnr�N�rrI�is_secure_origin�r��locr�r�r4s  ���r(r�z0LinkCollector.collect_sources.<locals>.<genexpr>�s_�����
4
�
4
��
��%9�#�|�<� �#(�)�

�
�
�
4
�
4
�
4
�
4
�
4
�
4
r*c	3�V�K�|]#}t|��jjdd����V��$dS)Tr�Nr�r�s  ���r(r�z0LinkCollector.collect_sources.<locals>.<genexpr>�s_�����
5
�
5
��
��%9�#�|�<��#'�)�

�
�
�
5
�
5
�
5
�
5
�
5
�
5
r*c�4�g|]}|�|j�d|j����S)Nz* )r�)r��ss  r(�
<listcomp>z1LinkCollector.collect_sources.<locals>.<listcomp>�sB��������&'�V���Q�V�
�
���r*z' location(s) to search for versions of �:�
)r�r�)�collections�OrderedDictr��get_index_urls_locations�valuesr�r\�isEnabledFor�logging�DEBUG�	itertools�chainr&r]r^r�r�)r4r�r��index_url_sources�find_links_sources�liness```   r(�collect_sourceszLinkCollector.collect_sources�s������(�3�
4
�
4
�
4
�
4
�
4
�
4
��(�A�A�,�O�O�
4
�
4
�
4
�

�

��&�(�(�	�)�4�
5
�
5
�
5
�
5
�
5
�
5
���
5
�
5
�
5
�

�

��&�(�(�	����w�}�-�-�
	+���"��);�=N�O�O����E��u�:�:�3�3�#/�3�3�3����E�
�L�L����5�)�)�*�*�*���.�/�/��-�.�.�
�
�
�	
r*N)rIrr�rr r/)F)rIrr�r	r�rrr r�)r r�)r�rr r�)r�rr�rr r�)r6r7r8r�r3�classmethodr��propertyr�r�r
rHr*r(r�r��s��������������
#(�	�����[��B�,�,�,��X�,�B�B�B�B�,
�,
�,
�,
�,
�,
r*r�)rrr r!)r;rr r/)rrrIrr r/)rrrIrr r)r@r`r r!)r�r}r r}r�r1)r�rr�r�r�r�r r/)T)r;rrnrrr rl)r�rrIrr r�)Or��
__future__rr�
email.messagercr�rr�rr��urllib.parserN�urllib.request�collections.abcrrr�dataclassesr�html.parserr�optparser	�typingr
rr�pip._vendorr
�pip._vendor.requestsr�pip._vendor.requests.exceptionsrr�pip._internal.exceptionsr�pip._internal.models.linkr�!pip._internal.models.search_scoper�pip._internal.network.sessionr�pip._internal.network.utilsr�pip._internal.utils.filetypesr�pip._internal.utils.miscr�pip._internal.vcsr�sourcesrrr�	getLoggerr6r\rr`r)�	Exceptionr,rErGrWr_rhrjr}r�r�rlr�r�r�r�r�r�rHr*r(�<module>r's�����#�"�"�"�"�"�������������������������	�	�	�	���������>�>�>�>�>�>�>�>�>�>�!�!�!�!�!�!�"�"�"�"�"�"�����������������!� � � � � �)�)�)�)�)�)�@�@�@�@�@�@�@�@�;�;�;�;�;�;�*�*�*�*�*�*�9�9�9�9�9�9�4�4�4�4�4�4�8�8�8�8�8�8�9�9�9�9�9�9�9�9�9�9�9�9�!�!�!�!�!�!�A�A�A�A�A�A�A�A�A�A�	��	�8�	$�	$�� ��c��*������)�)�)�)�)�Y�)�)�)�@�@�@�@�,	�	�	�	�	�y�	�	�	�����$<�<�<�<�~����	#�	#�	#�	#�	#�	#�	#�	#�B�B�B�B�B��B�B�B�����(�������8��$����.�.�.�.�.�.�.���.�(�����Z����>(,�@�@�@�@�@�48�
�
�
�
�
�:�:�:�:�z,�,�,�,�,�z�,�,�,�
h
�h
�h
�h
�h
�h
�h
�h
�h
�h
r*