
    )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y)    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y)SearchScopezF
    Encapsulates the locations that pip is configured to search.
    
find_links
index_urlsno_indexr   r   r   returnc                    g }|D ]P  }|j                  d      r,t        |      }t        j                  j	                  |      r|}|j                  |       R t               s`t        j                  ||      D ]G  }t        j                  j                  |      }|j                  dk(  s2t        j                  d        n  | |||      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           T/var/www/html/venv/lib/python3.12/site-packages/pip/_internal/models/search_scope.pycreatezSearchScope.create   s     ') 	*Ds#)$/77>>(+#D##D)	* y!
4DE ..t4==G+NN%
  '!
 	
    c                 j   g }g }| j                   r| j                   t        j                  gk7  r| j                   D ]k  }t        |      }t        j
                  j                  |      }|j                  s"|j                  st        j                  d|       |j                  |       m |j                  dj                  dj                  |                   | j                  r@|j                  dj                  dj                  d | j                  D                           dj                  |      S )Nz:The index url "%s" seems invalid, please provide a scheme.zLooking in indexes: {}z, zLooking in links: {}c              3   2   K   | ]  }t        |        y w)N)r	   ).0urls     r'   	<genexpr>z6SearchScope.get_formatted_locations.<locals>.<genexpr>f   s     SC237Ss   
)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   s     ??t4??2CC ?%9#%>" ||,,-?@ {{4;;NNT*
 $**+=>#?& LL(//		:M0NO ??LL&--IIS4??SS
 yyr)   project_namec                 r    dt         dt         ffd}| j                  D cg c]
  } ||       c}S c c}w )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                  j	                  t                          }|j                  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   sG    ..V\\''(9,(GHC <<$CiJr)   )strr   )r5   r;   rC   r-   s    `  r'   get_index_urls_locationsz$SearchScope.get_index_urls_locationsk   s5    	 	 	 04?s#???s   4N)__name__
__module____qualname____doc__	__slots__r   rD   __annotations__boolclassmethodr(   r:   rE    r)   r'   r   r      s     9IS	S	N'
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	   	getLoggerrF   r    r   rN   r)   r'   <module>rX      s\      	   !  9 + . I			8	$ $l@ l@ l@r)   