a
    <Bìj›  ã                   @   sŽ   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 e¡Zedd�G d	d
„ d
ƒƒZdS )é    N)Ú	dataclass)Úcanonicalize_name)ÚPyPI)Úhas_tls)Únormalize_pathÚredact_auth_from_urlT)Úfrozenc                   @   s|   e Zd ZU dZg d¢Zee ed< ee ed< eed< e	ee ee ed dœdd„ƒZ
ed	œd
d„Zeee dœdd„ZdS )ÚSearchScopezF
    Encapsulates the locations that pip is configured to search.
    ©Ú
find_linksÚ
index_urlsÚno_indexr   r   r   )r   r   r   Úreturnc                 C   s„   g }|D ]0}|  d¡r.t|ƒ}tj |¡r.|}| |¡ qtƒ svt ||¡D ](}t	j
 |¡}|jdkrLt d¡  qvqL| |||d�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Úparsed© r#   ú`/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/pip/_internal/models/search_scope.pyÚcreate   s(    

ÿýzSearchScope.create)r   c                 C   s¦   g }g }| j rt| j tjgkrt| j D ]:}t|ƒ}tj |¡}|jsR|jsRt	 
d|¡ | |¡ q"| d d |¡¡¡ | jrœ| d 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                 s   s   | ]}t |ƒV  qd S )N)r   ©Ú.0Úurlr#   r#   r$   Ú	<genexpr>e   ó    z6SearchScope.get_formatted_locations.<locals>.<genexpr>Ú
)r   r   Ú
simple_urlr   r   r   Úurlsplitr   Únetlocr   r   r   ÚformatÚjoinr   )ÚselfÚlinesÚredacted_index_urlsr(   Úredacted_index_urlÚpurlr#   r#   r$   Úget_formatted_locationsG   s,    
þÿÿÿz#SearchScope.get_formatted_locations)Úproject_namer   c                    s(   t t dœ‡fdd„‰ ‡ fdd„| jD ƒS )z²Returns 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                    s.   t  | tj tˆ ƒ¡¡}| d¡s*|d }|S )Nú/)Ú	posixpathr0   r   r   Úquoter   Úendswith)r(   Úloc)r7   r#   r$   Úmkurl_pypi_urlq   s    ÿ
z<SearchScope.get_index_urls_locations.<locals>.mkurl_pypi_urlc                    s   g | ]}ˆ |ƒ‘qS r#   r#   r&   )r=   r#   r$   Ú
<listcomp>~   r*   z8SearchScope.get_index_urls_locations.<locals>.<listcomp>)Ústrr   )r1   r7   r#   )r=   r7   r$   Úget_index_urls_locationsj   s    z$SearchScope.get_index_urls_locationsN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__Úlistr?   Ú__annotations__ÚboolÚclassmethodr%   r6   r@   r#   r#   r#   r$   r	      s   
û)#r	   )r   Úloggingr   r9   Úurllib.parser   Zdataclassesr   Zpip._vendor.packaging.utilsr   Úpip._internal.models.indexr   Úpip._internal.utils.compatr   Úpip._internal.utils.miscr   r   Ú	getLoggerrA   r   r	   r#   r#   r#   r$   Ú<module>   s   
