3
g                 @   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jeZG dd dZdS )	    N)List)canonicalize_name)PyPI)has_tls)normalize_pathredact_auth_from_urlc               @   sr   e Zd ZdZddgZeee ee d dddZ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)r	   r
   returnc             C   s   g }x8|D ]0}|j dr0t|}tjj|r0|}|j| q
W t s|x6tj||D ]&}t	j
j|}|jdkrRtjd P qRW | ||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	   r
   )
startswithr   ospathexistsappendr   	itertoolschainurllibparseurlparseschemeloggerwarning)clsr	   r
   Zbuilt_find_linkslinkZnew_linkparsed r   _/var/www/tester-filtro-web/env/lib/python3.6/site-packages/pip/_internal/models/search_scope.pycreate   s"    


zSearchScope.createNc             C   s   || _ || _d S )N)r	   r
   )selfr	   r
   r   r   r   __init__A   s    zSearchScope.__init__)r   c             C   s   g }g }| j r|| j tjgkr|xH| j D ]>}t|}tjj|}|j rX|j rXt	j
d| |j| q$W |jdjdj| | jr|jdjdjd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             s   s   | ]}t |V  qd S )N)r   ).0urlr   r   r   	<genexpr>h   s    z6SearchScope.get_formatted_locations.<locals>.<genexpr>
)r
   r   
simple_urlr   r   r   urlsplitr   netlocr   r   r   formatjoinr	   )r!   linesZredacted_index_urlsr$   Zredacted_index_urlpurlr   r   r   get_formatted_locationsI   s$    z#SearchScope.get_formatted_locations)project_namer   c                s(   t t dfdd  fd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                s.   t j| tjjt }|jds*|d }|S )N/)	posixpathr+   r   r   quoter   endswith)r$   loc)r/   r   r   mkurl_pypi_urlt   s
    
z<SearchScope.get_index_urls_locations.<locals>.mkurl_pypi_urlc                s   g | ]} |qS r   r   )r#   r$   )r5   r   r   
<listcomp>   s    z8SearchScope.get_index_urls_locations.<locals>.<listcomp>)strr
   )r!   r/   r   )r5   r/   r   get_index_urls_locationsm   s    z$SearchScope.get_index_urls_locations)__name__
__module____qualname____doc__	__slots__classmethodr   r7   r    r"   r.   r8   r   r   r   r   r      s   %$r   )r   loggingr   r1   urllib.parser   typingr   pip._vendor.packaging.utilsr   pip._internal.models.indexr   pip._internal.utils.compatr   pip._internal.utils.miscr   r   	getLoggerr9   r   r   r   r   r   r   <module>   s   
