OwlCyberSecurity - MANAGER
Edit File: search_scope.cpython-39.pyc
a )��e$ � @ s� d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlm Z d dl mZ d dlm Z d dlmZmZ e�e�ZG dd� d�ZdS ) � N)�List)�canonicalize_name)�PyPI)�has_tls)�normalize_path�redact_auth_from_urlc @ sv e Zd ZdZg d�Zeee ee ed d�dd��Z ee ee edd�dd�Z ed �d d�Zeee d�d d�ZdS )�SearchScopezF Encapsulates the locations that pip is configured to search. �� find_links� index_urls�no_index)r r r �returnc C s� g }|D ]0}|� d�r.t|�}tj�|�r.|}|�|� qt� svt�||�D ](}t j �|�}|jdkrLt �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 Zbuilt_find_links�linkZnew_link�parsed� r �b/home/gouroczh/virtualenv/pat/3.9/lib/python3.9/site-packages/pip/_internal/models/search_scope.py�create s( ��zSearchScope.createNc C s || _ || _|| _d S �Nr )�selfr r r r r r! �__init__C s zSearchScope.__init__)r c C s� g }g }| j rt| j tjgkrt| j D ]:}t|�}tj�|�}|jsR|jsRt � d|� |�|� q"|�d�d� |��� | jr�|�d�d� dd� | jD ���� d� |�S )Nz:The index url "%s" seems invalid, please provide a scheme.zLooking in indexes: {}z, zLooking in links: {}c s s | ]}t |�V qd S r# )r ��.0�urlr r r! � <genexpr>l � z6SearchScope.get_formatted_locations.<locals>.<genexpr>� )r r � simple_urlr r r �urlsplitr �netlocr r r �format�joinr )r$ �linesZredacted_index_urlsr( Zredacted_index_url�purlr r r! �get_formatted_locationsM s, ����z#SearchScope.get_formatted_locations)�project_namer c s( t t d��fdd�� � fdd�| jD �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 �| tj�t� ���}|�d�s*|d }|S )N�/)� posixpathr0 r r �quoter �endswith)r( �loc)r4 r r! �mkurl_pypi_urlx s � z<SearchScope.get_index_urls_locations.<locals>.mkurl_pypi_urlc s g | ]}� |��qS r r r&