File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/pip/_internal/metadata/importlib/__pycache__/_envs.cpython-310.pyc
Back
o ;j� � @ s� d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dl m Z mZ d dlm Z d dlmZmZmZmZ d dlmZmZ d dlmZ dd lmZmZmZmZ dd lmZ e�e �Z!ddd�Z"G dd� d�Z#G dd� de�Z$dS )� )�annotationsN)�Iterator�Sequence)�Optional)�InvalidWheelFilename�NormalizedName�canonicalize_name�parse_wheel_filename)�BaseDistribution�BaseEnvironment)�WHEEL_EXTENSION� )�BadMetadata�BasePath�get_dist_canonical_name�get_info_location)�Distribution�location�str�return�boolc C sR | � t�sdS tj�| �sdS z ttj�| �� W n ty# Y dS w t� | �S )NF) �endswithr �os�path�isfiler �basenamer �zipfile� is_zipfile)r � r �Z/opt/saltstack/salt/lib/python3.10/site-packages/pip/_internal/metadata/importlib/_envs.py�_looks_like_wheel s � r c @ sL e Zd ZdZeejjee f Z ddd�Zdd d �Zddd �Z ddd�ZdS )�_DistributionFindera$ Finder to locate distributions. The main purpose of this class is to memoize found distributions' names, so only one distribution is returned for each package name. At lot of pip code assumes this (because it is setuptools's behavior), and not doing the same can potentially cause a distribution in lower precedence path to override a higher precedence one if the caller is not careful. Eventually we probably want to make it possible to see lower precedence installations as well. It's useful feature, after all. r �Nonec C s t � | _d S �N)�set�_found_names)�selfr r r �__init__7 s z_DistributionFinder.__init__r r �Iterator[FoundResult]c c s� � t |�rdS tjj|gd�D ]8}t|�}zt|�}W n ty5 } zt�d||j � W Y d}~qd}~ww || j v r<q| j �|� ||fV qdS )z!Find distributions in a location.N)r zSkipping %s due to %s)r � importlib�metadataZ distributionsr r r �logger�warning�reasonr% �add)r&