
    vg#                         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mZ  ej"                  e      Z G d d      Zy)	    N)List)canonicalize_name)PyPI)has_tls)normalize_pathredact_auth_from_urlc            	           e Zd ZdZg dZedee   dee   dedd fd       Z	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           f/home/mcse/projects/flask/flask-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%
  '!
 	
    Nc                 .    || _         || _        || _        y Nr   )selfr   r   r   s       r%   __init__zSearchScope.__init__C   s     %$ r'   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r)   )r   ).0urls     r%   	<genexpr>z6SearchScope.get_formatted_locations.<locals>.<genexpr>k   s     SC237Ss   
)r   r   
simple_urlr   r   r   urlsplitr   netlocr   r   r   formatjoinr   )r*   linesredacted_index_urlsr/   redacted_index_urlpurls         r%   get_formatted_locationsz#SearchScope.get_formatted_locationsM   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/)	posixpathr6   r   r   quoter   endswith)r/   locr<   s     r%   mkurl_pypi_urlz<SearchScope.get_index_urls_locations.<locals>.mkurl_pypi_urlw   sG    ..V\\''(9,(GHC <<$CiJr'   )strr   )r*   r<   rD   r/   s    `  r%   get_index_urls_locationsz$SearchScope.get_index_urls_locationsp   s5    	 	 	 04?s#???s   4)__name__
__module____qualname____doc__	__slots__classmethodr   rE   boolr&   r+   r;   rF    r'   r%   r
   r
      s     9I'
I'
 I'
 	'

 
'
 '
R!I! I! 	!
 
!!  ! F@S @T#Y @r'   r
   )r   loggingr   r@   urllib.parser   typingr   pip._vendor.packaging.utilsr   pip._internal.models.indexr   pip._internal.utils.compatr   pip._internal.utils.miscr   r   	getLoggerrG   r   r
   rN   r'   r%   <module>rW      sC      	    9 + . I			8	$s@ s@r'   