
     h                         d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ d dlmZmZ  ej        e          Z ed	           G d
 d                      ZdS )    N)	dataclass)List)canonicalize_name)PyPI)has_tls)normalize_pathredact_auth_from_urlT)frozenc            	           e Zd ZU dZg dZee         ed<   ee         ed<   eed<   e	dee         dee         dedd fd            Z
defdZd	edee         fd
ZdS )SearchScopezF
    Encapsulates the locations that pip is configured to search.
    
find_links
index_urlsno_indexr   r   r   returnc                    g }|D ]\}|                     d          r0t          |          }t          j                            |          r|}|                    |           ]t                      s^t          j        ||          D ]H}t          j
                            |          }|j        dk    rt                              d            nI | |||          S )zQ
        Create a SearchScope object after normalizing the `find_links`.
        ~httpszipip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.r   )
startswithr   ospathexistsappendr   	itertoolschainurllibparseurlparseschemeloggerwarning)clsr   r   r   built_find_linkslinknew_linkparseds           `/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/pip/_internal/models/search_scope.pycreatezSearchScope.create   s    ') 	* 	*Ds## $)$//7>>(++ $#D##D)))) yy 		!
4DEE  ..t44=G++NN%  
 E , s'!
 
 
 	
    c                 r   g }g }| j         r| j         t          j        gk    r| j         D ]n}t          |          }t          j                            |          }|j        s"|j        st          
                    d|           |                    |           o|                    d                    d                    |                               | j        rJ|                    d                    d                    d | j        D                                            d                    |          S )Nz:The index url "%s" seems invalid, please provide a scheme.zLooking in indexes: {}z, zLooking in links: {}c              3   4   K   | ]}t          |          V  d S )N)r	   ).0urls     r'   	<genexpr>z6SearchScope.get_formatted_locations.<locals>.<genexpr>f   s+      SSC2377SSSSSSr)   
)r   r   
simple_urlr	   r   r   urlsplitr   netlocr    r!   r   formatjoinr   )selflinesredacted_index_urlsr-   redacted_index_urlpurls         r'   get_formatted_locationsz#SearchScope.get_formatted_locationsH   sG    ? 	t4?2CCC ? ?%9#%>%>" |,,-?@@ { 4; NNT*  
 $**+=>>>>LL(//		:M0N0NOO   ? 	LL&--IISS4?SSSSS   
 yyr)   project_namec                 T    dt           dt           ffdfd| j        D             S )zReturns the locations found via self.index_urls

        Checks the url_name on the main (first in the list) index and
        use this url_name to produce all locations
        r-   r   c                     t          j        | t          j                            t                                        }|                    d          s|dz   }|S )N/)	posixpathr4   r   r   quoter   endswith)r-   locr;   s     r'   mkurl_pypi_urlz<SearchScope.get_index_urls_locations.<locals>.mkurl_pypi_urlr   sV    .V\''(9,(G(GHH C <<$$  CiJr)   c                 &    g | ]} |          S  rE   )r,   r-   rC   s     r'   
<listcomp>z8SearchScope.get_index_urls_locations.<locals>.<listcomp>   s#    ???s##???r)   )strr   )r5   r;   rC   s    `@r'   get_index_urls_locationsz$SearchScope.get_index_urls_locationsk   sO    	 	 	 	 	 	 	 	 @???t????r)   N)__name__
__module____qualname____doc__	__slots__r   rG   __annotations__boolclassmethodr(   r:   rH   rE   r)   r'   r   r      s           988IS	S	NNN'
I'
 I'
 	'

 
'
 '
 '
 ['
R!  !  !  !  ! F@S @T#Y @ @ @ @ @ @r)   r   )r   loggingr   r?   urllib.parser   dataclassesr   typingr   pip._vendor.packaging.utilsr   pip._internal.models.indexr   pip._internal.utils.compatr   pip._internal.utils.miscr   r	   	getLoggerrI   r    r   rE   r)   r'   <module>rZ      s        				         ! ! ! ! ! !       9 9 9 9 9 9 + + + + + + . . . . . . I I I I I I I I		8	$	$ $l@ l@ l@ l@ l@ l@ l@ l@ l@ l@r)   