403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/pip/_internal/index/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/pip/_internal/index/__pycache__/collector.cpython-311.pyc
�

�/�cx@�	��dZddlZddlZddlZddlZddlZddlZddlZddl	Z
ddlZ
ddlm
Z
ddlmZddlmZmZmZmZmZmZmZmZmZmZmZddlmZddlmZddl m!Z!m"Z"dd	l#m$Z$dd
l%m&Z&ddl'm(Z(ddl)m*Z*dd
l+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4m5Z5m6Z6erddlm7Z7ne8Z7ej9e:��Z;ee<e<fZ=de<dee<fd�Z>Gd�de?��Z@deddfd�ZAGd�de?��ZBde<de*ddfd�ZCde<de*defd�ZDd e=dee<fd!�ZEGd"�d#��ZFGd$�d%e7��ZGd&eGdeGfd'�ZHeHd(d)dee&fd*���ZIGd+�d)��ZJGd,�d-e
��ZK	d;d.e&d/ee<e?fd0eed1ddfd2�ZL	d<ded4eMdeJfd5�ZNd.e&de*ded)fd6�ZOGd7�d8e��ZPGd9�d:��ZQdS)=zO
The main purpose of this module is to expose LinkCollector.collect_sources().
�N)�
HTMLParser)�Values)�
TYPE_CHECKING�Callable�Dict�Iterable�List�MutableMapping�
NamedTuple�Optional�Sequence�Tuple�Union)�requests)�Response)�
RetryError�SSLError)�NetworkConnectionError)�Link)�SearchScope)�
PipSession)�raise_for_status)�is_archive_file��redact_auth_from_url)�vcs�)�CandidatesFromPage�
LinkSource�build_source)�Protocol�url�returnc��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  �?/usr/lib/python3/dist-packages/pip/_internal/index/collector.py�_match_vcs_schemer+7sW��
�+�����9�9�;�;�!�!�&�)�)�	�c�#�f�+�+�.>�$�.F�.F��M�M�M���4�c�,��eZdZdededdf�fd�Z�xZS)�_NotAPIContent�content_type�request_descr#Nc�h��t���||��||_||_dS�N)�super�__init__r/r0)�selfr/r0�	__class__s   �r*r4z_NotAPIContent.__init__Cs3���
������|�4�4�4�(���(����r,)�__name__�
__module__�__qualname__�strr4�
__classcell__�r6s@r*r.r.BsR�������)�S�)��)��)�)�)�)�)�)�)�)�)�)r,r.�responsec���|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_headerrGIsg���#�'�'��	�B�B�L�!�'�'�)�)�N�� � �	
����	��
��x�'7�'>�
?�
?�?r,c��eZdZdS)�_NotHTTPN)r7r8r9�r,r*rIrI_s�������Dr,rI�sessionc���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�urlsplitrI�headrrG)r"rKr)�netloc�path�query�fragment�resps        r*�_ensure_api_responserYcsq��-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.
    �rKzGetting page %sz, )rAz*application/vnd.pypi.simple.v1+html; q=0.1ztext/html; q=0.01z	max-age=0)�Acceptz
Cache-Control)rBzFetched page %s as %sr?r@)rr�filenamerY�logger�debugrrC�joinrrGrB)r"rKrXs   r*�_get_simple_responseraus����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,rBc��|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:)rB�mrcs   r*�_get_encoding_from_headersri�s`��� �>�W�,�,��M�!�!�#�#��#�N�3��.���+�+�i�(�(���	 ��w�<�<���4r,c�2�eZdZd	d�Zdedefd�Zdefd�ZdS)
�CacheablePageContent�page�IndexContentr#Nc�&�|jsJ�||_dSr2)�cache_link_parsingrl�r5rls  r*r4zCacheablePageContent.__init__�s���&�&�&�&���	�	�	r,�otherc�p�t|t|����o|jj|jjkSr2)�
isinstance�typerlr")r5rqs  r*�__eq__zCacheablePageContent.__eq__�s*���%��d���,�,�P����%�*�.�1P�Pr,c�4�t|jj��Sr2)�hashrlr"�r5s r*�__hash__zCacheablePageContent.__hash__�s���D�I�M�"�"�"r,)rlrmr#N)	r7r8r9r4�object�boolru�intryrJr,r*rkrk�sk����������Q�F�Q�t�Q�Q�Q�Q�#�#�#�#�#�#�#�#r,rkc�*�eZdZdddeefd�ZdS)�
ParseLinksrlrmr#c��dSr2rJrps  r*�__call__zParseLinks.__call__�s���r,N)r7r8r9rrr�rJr,r*r~r~�s:�������^����������r,r~�fnc�����tjd���dtdttf�fd����tj���dddttf��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`.
    N)�maxsize�cacheable_pager#c�>��t�|j����Sr2)�listrl)r�r�s �r*�wrapperz*with_cached_index_content.<locals>.wrapper�s����B�B�~�*�+�+�,�,�,r,rlrmc�r��|jr�t|����St�|����Sr2)rorkr�)rlr�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,)�	functools�	lru_cacherkr	r�wraps)r�r�r�s` @r*�with_cached_index_contentr��s��������&�&�&�-� 4�-��d��-�-�-�-�-�'�&�-��_�R����n���d�����������
�r,rlrmc#�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.
    rA�filesNzutf-8)�page_url�base_url)r/r&r'�json�loads�contentrCr�	from_jsonr"�HTMLLinkParser�encoding�feed�decoder��anchors�from_element)
rlrF�data�file�link�parserr�r"r��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,c
�N�eZdZdZ	ddededeedededd	fd
�Zdefd�Z	d	S)
rmz5Represents one response (or page), along with its URLTr�r/r�r"ror#Nc�L�||_||_||_||_||_dS)am
        :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.
        N)r�r/r�r"ro)r5r�r/r�r"ros      r*r4zIndexContent.__init__s/�����(��� ��
����"4����r,c�*�t|j��Sr2)rr"rxs r*�__str__zIndexContent.__str__s��#�D�H�-�-�-r,�T)
r7r8r9�__doc__�bytesr:rr{r4r�rJr,r*rmrms�������?�?�$(�
5�5��5��5��3�-�	5�
�5�!�
5�
�5�5�5�5�*.��.�.�.�.�.�.r,c���eZdZdZdeddf�fd�Zdedeeeeefddfd�Z	deeeeefdeefd	�Z
�xZS)
r�zf
    HTMLParser that keeps the first base HREF and a list of all anchor
    elements' attributes.
    r"r#Nc�v��t���d���||_d|_g|_dS)NT)�convert_charrefs)r3r4r"r�r�)r5r"r6s  �r*r4zHTMLLinkParser.__init__#s7���
�����$��/�/�/����'+��
�79����r,�tag�attrsc���|dkr)|j�"|�|��}|�	||_dSdS|dkr)|j�t	|����dSdS)N�base�a)r��get_hrefr��append�dict)r5r�r��hrefs    r*�handle_starttagzHTMLLinkParser.handle_starttag*sn���&�=�=�T�]�2��=�=��'�'�D��� $��
�
�
� ��
�C�Z�Z��L����U���,�,�,�,�,��Zr,c�*�|D]\}}|dkr|cS�dS)Nr�rJ)r5r��name�values    r*r�zHTMLLinkParser.get_href2s1�� �	�	�K�D�%��v�~�~�������tr,)r7r8r9r�r:r4r	rrr�r�r;r<s@r*r�r�s����������
:�C�:�D�:�:�:�:�:�:�-�3�-�t�E�#�x��}�:L�4M�/N�-�SW�-�-�-�-��d�5��h�s�m�);�#<�=��(�3�-��������r,r�r��reason�meth).Nc�<�|�tj}|d||��dS)Nz%Could not fetch URL %s: %s - skipping)r^r_)r�r�r�s   r*�_handle_get_simple_failr�9s+��
�|��|���D�	0�$��?�?�?�?�?r,Troc�|�t|j��}t|j|jd||j|���S)Nr?)r�r"ro)rirBrmr�r")r=ror�s   r*�_make_index_contentr�CsG��*�(�*:�;�;�H�������(���L�-����r,c���|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 %sr[)roz`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^�warningrPrQ�urlparse�osrU�isdirrD�url2pathname�endswith�urljoinr_rar�rorIr.r0r/rr�rrr:�infor�ConnectionError�Timeout)
r�rKr"�
vcs_schemer)�_rUrX�excr�s
          r*�_get_index_contentr�Ps��
�(�.�.��a�
 �
 ��
#�C�#�3�'�'�J������W���	
�	
�	
�
�t� &�|�4�4�S�9�9��F�A�t�Q��1�
����B�G�M�M�&�.�*E�*E�d�*K�*K�L�L���|�|�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�T�eZdZUeeeed<eeeed<dS)�CollectedSources�
find_links�
index_urlsN)r7r8r9r
rr�__annotations__rJr,r*r�r��s>���������*�-�.�.�.�.���*�-�.�.�.�.�.�.r,r�c
��eZdZdZdededdfd�Ze	ddeded	e	ddfd
���Z
edee
fd���Zdedeefd
�Zde
dedefd�ZdS)�
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.
    rK�search_scoper#Nc�"�||_||_dSr2)r�rK)r5rKr�s   r*r4zLinkCollector.__init__�s��
)�������r,F�options�suppress_no_indexc��|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��dSr2r)�.0r"s  r*�	<genexpr>z'LinkCollector.create.<locals>.<genexpr>�s+����I�I�s�-�c�2�2�I�I�I�I�I�Ir,)r�r��no_index)rKr�)
�	index_url�extra_index_urlsr�r^r_r`r�r�creater�)�clsrKr�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,c��|jjSr2)r�r�rxs r*r�zLinkCollector.find_links�s��� �+�+r,�locationc�.�t||j���S)z>
        Fetch an HTML page containing package links.
        r[)r�rK)r5r�s  r*�fetch_responsezLinkCollector.fetch_response�s��"�(�D�L�A�A�A�Ar,�project_name�candidates_from_pagec�t���tj��fd��j�|��D�������}tj��fd��jD�������}t�tj	��red�tj||��D��}t|���d|�d�g|z}t�
d�|����tt!|��t!|�����S)Nc3�T�K�|]"}t|��jjdd���V��#dS)F�r��page_validator�
expand_dirroN�r rK�is_secure_origin�r��locr�r5s  ��r*r�z0LinkCollector.collect_sources.<locals>.<genexpr>�s\�����	4
�	4
��
��%9�#�|�<� �#(�
�
�
�	4
�	4
�	4
�	4
�	4
�	4
r,c3�T�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>�s6�������=�Q�V�%7��Q�V�
�
�%7�%7�%7r,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�)r5r�r��index_url_sources�find_links_sources�liness` `   r*�collect_sourceszLinkCollector.collect_sources�s�����(�3�	4
�	4
�	4
�	4
�	4
��(�A�A�,�O�O�	4
�	4
�	4
�	
�	
��&�(�(�	�)�4�	5
�	5
�	5
�	5
�	5
���	5
�	5
�	5
�	
�	
��&�(�(�	����w�}�-�-�
	+���"��);�=N�O�O����E��u�:�:�3�3�#/�3�3�3����E�
�L�L����5�)�)�*�*�*���.�/�/��-�.�.�
�
�
�	
r,)F)r7r8r9r�rrr4�classmethodrr{r��propertyr	r:r�rrrmr�rr�rrJr,r*r�r��s'�����������"��
�	�����
#(�	������ �	�

�����[��B�,�D��I�,�,�,��X�,�B�t�B���0F�B�B�B�B�*
��*
�1�*
�
�	*
�*
�*
�*
�*
�*
r,r�r2r�)Rr�r��
email.messagerdr�rr�rr��urllib.parserP�urllib.request�html.parserr�optparser�typingrrrrr	r
rrr
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 r!rz�	getLoggerr7r^r:�ResponseHeadersr+�	Exceptionr.rGrIrYrarirkr~r�r�rmr�r�r{r�r�r�r�rJr,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�����������H�	��	�8�	$�	$�� ��c��*���3��8�C�=�����)�)�)�)�)�Y�)�)�)�@��@�d�@�@�@�@�,	�	�	�	�	�y�	�	�	��c��J��4�����$<�c�<�J�<�8�<�<�<�<�~���H�S�M�����	#�	#�	#�	#�	#�	#�	#�	#����������
�*�������(��n���$��������8.�.�.�.�.�.�.�.�8�����Z����>+/�@�@�
�@��#�y�.�!�@��8�I�&�
'�@�
�	@�@�@�@�48�
�
��
�,0�
��
�
�
�
�:�T�:�z�:�h�~�>V�:�:�:�:�z/�/�/�/�/�z�/�/�/�
g
�g
�g
�g
�g
�g
�g
�g
�g
�g
r,

Youez - 2016 - github.com/yon3zu
LinuXploit