U
    ƒIÀd½b  ã                   @   s   d dl Z d dlZd dlZ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
mZmZmZmZmZmZmZmZmZmZmZmZ d dlmZ d dlmZmZ d dlmZ d dlmZm Z  d dl!m"Z" d dl#m$Z$m%Z% d d	l&m'Z'm(Z(m)Z) d d
l*m+Z+ d dl,m-Z- d dl.m/Z/m0Z0 d dl1m2Z2 d dl3m4Z4 ddl5m6Z6 e�rDd dl	m7Z7 ne8Z7eee f Z9ee:ej;f Z<e =e>¡Z?G dd„ de7ƒZ@ee:df ee:df e:dœdd„ZAG dd„ deƒZBG dd„ de7ƒZCG dd„ dƒZDG dd„ de7ƒZEG d d!„ d!eEƒZFG d"d#„ d#eEƒZGdS )$é    N)ÚIOÚTYPE_CHECKINGÚAnyÚ
CollectionÚ	ContainerÚDictÚIterableÚIteratorÚListÚ
NamedTupleÚOptionalÚTupleÚUnion)ÚRequirement)ÚInvalidSpecifierÚSpecifierSet)ÚNormalizedName)ÚLegacyVersionÚVersion)ÚNoneMetadataError)Úsite_packagesÚ	user_site)ÚDIRECT_URL_METADATA_NAMEÚ	DirectUrlÚDirectUrlValidationError)Ústdlib_pkgs)Úegg_link_path_from_sys_path)Úis_localÚnormalize_path)Ú
safe_extra)Úurl_to_pathé   )Úmsg_to_json)ÚProtocolc                   @   sB   e Zd Zeedœdd„ƒZeedœdd„ƒZeedœdd„ƒZdS )	ÚBaseEntryPoint©Úreturnc                 C   s
   t ƒ ‚d S ©N©ÚNotImplementedError©Úself© r,   úT/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/pip/_internal/metadata/base.pyÚname:   s    zBaseEntryPoint.namec                 C   s
   t ƒ ‚d S r'   r(   r*   r,   r,   r-   Úvalue>   s    zBaseEntryPoint.valuec                 C   s
   t ƒ ‚d S r'   r(   r*   r,   r,   r-   ÚgroupB   s    zBaseEntryPoint.groupN)Ú__name__Ú
__module__Ú__qualname__ÚpropertyÚstrr.   r/   r0   r,   r,   r,   r-   r$   9   s   r$   .)ÚentryÚinfor&   c                 C   sV   | rD| d dkrD|r |d dkr*|d7 }n|dd… }| dd… } q t tj|| žŽ ƒS )aì  Convert a legacy installed-files.txt path into modern RECORD path.

    The legacy format stores paths relative to the info directory, while the
    modern format stores paths relative to the package root, e.g. the
    site-packages directory.

    :param entry: Path parts of the installed-files.txt entry.
    :param info: Path parts of the egg-info directory relative to package root.
    :returns: The converted entry.

    For best compatibility with symlinks, this does not use ``abspath()`` or
    ``Path.resolve()``, but tries to work with path parts:

    1. While ``entry`` starts with ``..``, remove the equal amounts of parts
       from ``info``; if ``info`` is empty, start appending ``..`` instead.
    2. Join the two directly.
    r   ú..éÿÿÿÿ)r8   Nr!   ©r5   ÚpathlibÚPath)r6   r7   r,   r,   r-   Ú_convert_installed_files_pathG   s    
r=   c                   @   s&   e Zd ZU eed< eed< eed< dS )ÚRequiresEntryÚrequirementÚextraÚmarkerN)r1   r2   r3   r5   Ú__annotations__r,   r,   r,   r-   r>   e   s   
r>   c                   @   sX  e Zd Zeed dœdd„ƒZeeeed dœdd„ƒZeded dœd	d
„ƒZedœdd„Z	edœdd„Z
eee dœdd„ƒZeee dœdd„ƒZeee dœdd„ƒZeee dœdd„ƒZeedœdd„ƒZeedœdd„ƒZeedœdd„ƒZeedœdd„ƒZeedœd d!„ƒZeedœd"d#„ƒZeedœd$d%„ƒZeee dœd&d'„ƒZeedœd(d)„ƒZeedœd*d+„ƒZeedœd,d-„ƒZeedœd.d/„ƒZ eedœd0d1„ƒZ!eedœd2d3„ƒZ"e#ed4œd5d6„Z$e%e dœd7d8„Z&e#ed4œd9d:„Z'e(e) dœd;d<„Z*e+j,j-dœd=d>„Z.e/j0d?d@�e+j,j-dœdAdB„ƒZ1ee+j,j-dœdCdD„ƒZ2ee3ee4f dœdEdF„ƒZ5eee dœdGdH„ƒZ6eedœdIdJ„ƒZ7ee8dœdKdL„ƒZ9dce:e e(e; dNœdOdP„Z<e(e dœdQdR„Z=ee%e  dœdSdT„Z>ee%e  dœdUdV„Z?ee%e  dœdWdX„Z@e%eA dœdYdZ„ZBe(e dœd[d\„ZCe(e dœd]d^„ZDe+j,j-d_d`œdadb„ZEd_S )dÚBaseDistribution)Ú	directoryr&   c                 C   s
   t ƒ ‚dS )z‡Load the distribution from a metadata directory.

        :param directory: Path to a metadata directory, e.g. ``.dist-info``.
        Nr(   )ÚclsrD   r,   r,   r-   Úfrom_directoryl   s    zBaseDistribution.from_directory)Úmetadata_contentsÚfilenameÚproject_namer&   c                 C   s
   t ƒ ‚dS )aÁ  Load the distribution from the contents of a METADATA file.

        This is used to implement PEP 658 by generating a "shallow" dist object that can
        be used for resolution without downloading or building the actual dist yet.

        :param metadata_contents: The contents of a METADATA file.
        :param filename: File name for the dist with this metadata.
        :param project_name: Name of the project this dist represents.
        Nr(   )rE   rG   rH   rI   r,   r,   r-   Úfrom_metadata_file_contentst   s    z,BaseDistribution.from_metadata_file_contentsÚWheel)Úwheelr.   r&   c                 C   s
   t ƒ ‚dS )a  Load the distribution from a given wheel.

        :param wheel: A concrete wheel definition.
        :param name: File name of the wheel.

        :raises InvalidWheel: Whenever loading of the wheel causes a
            :py:exc:`zipfile.BadZipFile` exception to be thrown.
        :raises UnsupportedWheel: If the wheel is a valid zip, but malformed
            internally.
        Nr(   )rE   rL   r.   r,   r,   r-   Ú
from_wheel†   s    zBaseDistribution.from_wheelr%   c                 C   s   | j › d| j› d| j› d�S )Nú z (ú))Úraw_nameÚversionÚlocationr*   r,   r,   r-   Ú__repr__”   s    zBaseDistribution.__repr__c                 C   s   | j › d| j› �S )NrN   )rP   rQ   r*   r,   r,   r-   Ú__str__—   s    zBaseDistribution.__str__c                 C   s
   t ƒ ‚dS )aÐ  Where the distribution is loaded from.

        A string value is not necessarily a filesystem path, since distributions
        can be loaded from other sources, e.g. arbitrary zip archives. ``None``
        means the distribution is created in-memory.

        Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If
        this is a symbolic link, we want to preserve the relative path between
        it and files in the distribution.
        Nr(   r*   r,   r,   r-   rR   š   s    zBaseDistribution.locationc                 C   s6   | j }|r| ¡ r2t|jƒS nt| jƒ}|r2| jS dS )zÉThe project location for editable distributions.

        This is the directory where pyproject.toml or setup.py is located.
        None if the distribution is not installed in editable mode.
        N)Ú
direct_urlÚis_local_editabler    Úurlr   rP   rR   )r+   rU   Úegg_link_pathr,   r,   r-   Úeditable_project_location¨   s    
z*BaseDistribution.editable_project_locationc                 C   s
   t ƒ ‚dS )a’  The distribution's "installed" location.

        This should generally be a ``site-packages`` directory. This is
        usually ``dist.location``, except for legacy develop-installed packages,
        where ``dist.location`` is the source code location, and this is where
        the ``.egg-link`` file is.

        The returned location is normalized (in particular, with symlinks removed).
        Nr(   r*   r,   r,   r-   Úinstalled_location¾   s    z#BaseDistribution.installed_locationc                 C   s
   t ƒ ‚dS )a/  Location of the .[egg|dist]-info directory or file.

        Similarly to ``location``, a string value is not necessarily a
        filesystem path. ``None`` means the distribution is created in-memory.

        For a modern .dist-info installation on disk, this should be something
        like ``{location}/{raw_name}-{version}.dist-info``.

        Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If
        this is a symbolic link, we want to preserve the relative path between
        it and other files in the distribution.
        Nr(   r*   r,   r,   r-   Úinfo_locationË   s    zBaseDistribution.info_locationc                 C   s   | j }|sdS t |¡ ¡ S )a  Whether this distribution is installed with legacy distutils format.

        A distribution installed with "raw" distutils not patched by setuptools
        uses one single file at ``info_location`` to store metadata. We need to
        treat this specially on uninstallation.
        F)r[   r;   r<   Úis_file©r+   r[   r,   r,   r-   Úinstalled_by_distutilsÛ   s    z'BaseDistribution.installed_by_distutilsc                 C   s   | j }|sdS | d¡S )z¦Whether this distribution is installed as an egg.

        This usually indicates the distribution was installed by (older versions
        of) easy_install.
        Fz.egg)rR   Úendswith©r+   rR   r,   r,   r-   Úinstalled_as_eggè   s    z!BaseDistribution.installed_as_eggc                 C   s*   | j }|sdS | d¡sdS t |¡ ¡ S )aÙ  Whether this distribution is installed with the ``.egg-info`` format.

        This usually indicates the distribution was installed with setuptools
        with an old pip version or with ``single-version-externally-managed``.

        Note that this ensure the metadata store is a directory. distutils can
        also installs an ``.egg-info``, but as a file, not a directory. This
        property is *False* for that case. Also see ``installed_by_distutils``.
        Fz	.egg-info©r[   r_   r;   r<   Úis_dirr]   r,   r,   r-   Ú"installed_with_setuptools_egg_infoô   s    
z3BaseDistribution.installed_with_setuptools_egg_infoc                 C   s*   | j }|sdS | d¡sdS t |¡ ¡ S )aa  Whether this distribution is installed with the "modern format".

        This indicates a "modern" installation, e.g. storing metadata in the
        ``.dist-info`` directory. This applies to installations made by
        setuptools (but through pip, not directly), or anything using the
        standardized build backend interface (PEP 517).
        Fz
.dist-inforb   r]   r,   r,   r-   Úinstalled_with_dist_info  s    	
z)BaseDistribution.installed_with_dist_infoc                 C   s
   t ƒ ‚d S r'   r(   r*   r,   r,   r-   Úcanonical_name  s    zBaseDistribution.canonical_namec                 C   s
   t ƒ ‚d S r'   r(   r*   r,   r,   r-   rQ     s    zBaseDistribution.versionc                 C   s   | j  dd¡S )z”Convert a project name to its setuptools-compatible filename.

        This is a copy of ``pkg_resources.to_filename()`` for compatibility.
        ú-Ú_)rP   Úreplacer*   r,   r,   r-   Úsetuptools_filename  s    z$BaseDistribution.setuptools_filenamec              
   C   sz   z|   t¡}W n tk
r$   Y dS X zt |¡W S  ttjtfk
rt } zt	 
dt| j|¡ W Y ¢dS d}~X Y nX dS )z¬Obtain a DirectUrl from this distribution.

        Returns None if the distribution has no `direct_url.json` metadata,
        or if `direct_url.json` is invalid.
        NzError parsing %s for %s: %s)Ú	read_textr   ÚFileNotFoundErrorr   Ú	from_jsonÚUnicodeDecodeErrorÚjsonÚJSONDecodeErrorr   ÚloggerÚwarningrf   )r+   ÚcontentÚer,   r,   r-   rU   &  s$    ýüzBaseDistribution.direct_urlc              
   C   sR   z|   d¡}W n tttfk
r*   Y dS X | ¡ D ]}| ¡ }|r4|  S q4dS )NÚ	INSTALLERÚ )rk   ÚOSErrorÚ
ValueErrorr   Ú
splitlinesÚstrip)r+   Úinstaller_textÚlineÚcleaned_liner,   r,   r-   Ú	installer@  s    
zBaseDistribution.installerc                 C   s
   |   d¡S )NÚ	REQUESTED)r\   r*   r,   r,   r-   Ú	requestedL  s    zBaseDistribution.requestedc                 C   s
   t | jƒS r'   )ÚboolrY   r*   r,   r,   r-   ÚeditableP  s    zBaseDistribution.editablec                 C   s   | j dkrdS t| j ƒS )z|If distribution is installed in the current virtual environment.

        Always True if we're not in a virtualenv.
        NF)rZ   r   r*   r,   r,   r-   ÚlocalT  s    
zBaseDistribution.localc                 C   s&   | j d kstd krdS | j  ttƒ¡S ©NF)rZ   r   Ú
startswithr   r*   r,   r,   r-   Úin_usersite^  s    zBaseDistribution.in_usersitec                 C   s&   | j d kstd krdS | j  ttƒ¡S r„   )rZ   r   r…   r   r*   r,   r,   r-   Úin_site_packagesd  s    z!BaseDistribution.in_site_packages)Úpathr&   c                 C   s
   t ƒ ‚dS )z7Check whether an entry in the info directory is a file.Nr(   ©r+   rˆ   r,   r,   r-   r\   j  s    zBaseDistribution.is_filec                 C   s
   t ƒ ‚dS )zÕFind distutils 'scripts' entries metadata.

        If 'scripts' is supplied in ``setup.py``, distutils records those in the
        installed distribution's ``scripts`` directory, a file for each script.
        Nr(   r*   r,   r,   r-   Úiter_distutils_script_namesn  s    z,BaseDistribution.iter_distutils_script_namesc                 C   s
   t ƒ ‚dS )zçRead a file in the info directory.

        :raise FileNotFoundError: If ``path`` does not exist in the directory.
        :raise NoneMetadataError: If ``path`` exists in the info directory, but
            cannot be read.
        Nr(   r‰   r,   r,   r-   rk   v  s    zBaseDistribution.read_textc                 C   s
   t ƒ ‚d S r'   r(   r*   r,   r,   r-   Úiter_entry_points  s    z"BaseDistribution.iter_entry_pointsc                 C   s
   t ƒ ‚d S r'   r(   r*   r,   r,   r-   Ú_metadata_impl‚  s    zBaseDistribution._metadata_implr!   )Úmaxsizec                 C   s   |   ¡ }|  |¡ |S r'   )rŒ   Ú_add_egg_info_requires)r+   Úmetadatar,   r,   r-   Ú_metadata_cached…  s    
z!BaseDistribution._metadata_cachedc                 C   s   |   ¡ S )a  Metadata of distribution parsed from e.g. METADATA or PKG-INFO.

        This should return an empty message if the metadata file is unavailable.

        :raises NoneMetadataError: If the metadata file is available, but does
            not contain valid metadata.
        )r�   r*   r,   r,   r-   r�   �  s    	zBaseDistribution.metadatac                 C   s
   t | jƒS )a  PEP 566 compliant JSON-serializable representation of METADATA or PKG-INFO.

        This should return an empty dict if the metadata file is unavailable.

        :raises NoneMetadataError: If the metadata file is available, but does
            not contain valid metadata.
        )r"   r�   r*   r,   r,   r-   Úmetadata_dict˜  s    	zBaseDistribution.metadata_dictc                 C   s   | j  d¡S )zDValue of "Metadata-Version:" in distribution metadata, if available.zMetadata-Version)r�   Úgetr*   r,   r,   r-   Úmetadata_version£  s    z!BaseDistribution.metadata_versionc                 C   s   | j  d| j¡S )z*Value of "Name:" in distribution metadata.ÚName)r�   r’   rf   r*   r,   r,   r-   rP   ¨  s    zBaseDistribution.raw_namec              
   C   sp   | j  d¡}|dkrtƒ S ztt|ƒƒ}W n@ tk
rj } z"d}t || j|¡ tƒ  W Y ¢S d}~X Y nX |S )z±Value of "Requires-Python:" in distribution metadata.

        If the key does not exist or contains an invalid value, an empty
        SpecifierSet should be returned.
        zRequires-PythonNz-Package %r has an invalid Requires-Python: %s)r�   r’   r   r5   r   rq   rr   rP   )r+   r/   Úspecrt   Úmessager,   r,   r-   Úrequires_python¯  s    z BaseDistribution.requires_pythonr,   )Úextrasr&   c                 C   s
   t ƒ ‚dS )z®Dependencies of this distribution.

        For modern .dist-info distributions, this is the collection of
        "Requires-Dist:" entries in distribution metadata.
        Nr(   )r+   r˜   r,   r,   r-   Úiter_dependenciesÂ  s    z"BaseDistribution.iter_dependenciesc                 C   s
   t ƒ ‚dS )z²Extras provided by this distribution.

        For modern .dist-info distributions, this is the collection of
        "Provides-Extra:" entries in distribution metadata.
        Nr(   r*   r,   r,   r-   Úiter_provided_extrasÊ  s    z%BaseDistribution.iter_provided_extrasc                 C   s>   z|   d¡}W n tk
r$   Y d S X dd„ t | ¡ ¡D ƒS )NÚRECORDc                 s   s    | ]}t t |d  ¡ƒV  qdS )r   Nr:   )Ú.0Úrowr,   r,   r-   Ú	<genexpr>Ø  s     zFBaseDistribution._iter_declared_entries_from_record.<locals>.<genexpr>)rk   rl   ÚcsvÚreaderry   )r+   Útextr,   r,   r-   Ú"_iter_declared_entries_from_recordÒ  s
    z3BaseDistribution._iter_declared_entries_from_recordc                    s¦   z|   d¡}W n tk
r$   Y d S X dd„ |jdd�D ƒ}| j}| j}|d ksX|d kr\|S zt |¡ |¡‰ W n tk
rˆ   | Y S X ˆ j	s”|S ‡ fdd„|D ƒS )Nzinstalled-files.txtc                 s   s   | ]}|r|V  qd S r'   r,   ©rœ   Úpr,   r,   r-   rž   ß  s      zFBaseDistribution._iter_declared_entries_from_legacy.<locals>.<genexpr>F)Úkeependsc                 3   s"   | ]}t t |¡jˆ jƒV  qd S r'   )r=   r;   r<   Úpartsr£   ©Úinfo_relr,   r-   rž   ê  s   ÿ)
rk   rl   ry   rR   r[   r;   r<   Úrelative_torx   r¦   )r+   r¡   ÚpathsÚrootr7   r,   r§   r-   Ú"_iter_declared_entries_from_legacyÚ  s$    

þz3BaseDistribution._iter_declared_entries_from_legacyc                 C   s   |   ¡ p|  ¡ S )aò  Iterate through file entries declared in this distribution.

        For modern .dist-info distributions, this is the files listed in the
        ``RECORD`` metadata file. For legacy setuptools distributions, this
        comes from ``installed-files.txt``, with entries normalized to be
        compatible with the format used by ``RECORD``.

        :return: An iterator for listed entries, or None if the distribution
            contains neither ``RECORD`` nor ``installed-files.txt``.
        )r¢   r¬   r*   r,   r,   r-   Úiter_declared_entriesï  s    þz&BaseDistribution.iter_declared_entriesc                 c   s”   z|   d¡}W n tk
r$   Y dS X d }}| ¡ D ]X}| ¡ }|r6| d¡rRq6| d¡r~| d¡r~| d¡ d¡\}}}q6t|||d	�V  q6dS )
aö  Parse a ``requires.txt`` in an egg-info directory.

        This is an INI-ish format where an egg-info stores dependencies. A
        section name describes extra other environment markers, while each entry
        is an arbitrary string (not a key-value pair) representing a dependency
        as a requirement string (no markers).

        There is a construct in ``importlib.metadata`` called ``Sectioned`` that
        does mostly the same, but the format is currently considered private.
        zrequires.txtNrv   ú#ú[ú]z[]ú:)r?   r@   rA   )rk   rl   ry   rz   r…   r_   Ú	partitionr>   )r+   rs   r@   rA   r|   rh   r,   r,   r-   Ú_iter_requires_txt_entriesÿ  s    z+BaseDistribution._iter_requires_txt_entriesc                 c   s8   dh}|   ¡ D ]$}|j|krq| |j¡ |jV  qdS )z'Get extras from the egg-info directory.rv   N)r³   r@   Úadd)r+   Úknown_extrasr6   r,   r,   r-   Ú_iter_egg_info_extras  s    
z&BaseDistribution._iter_egg_info_extrasc                 c   s†   |   ¡ D ]x}|jr4|jr4d|j› dt|jƒ› d�}n,|jrNdt|jƒ› d�}n|jr\|j}nd}|rx|j› d|› �V  q|jV  qdS )a‰  Get distribution dependencies from the egg-info directory.

        To ease parsing, this converts a legacy dependency entry into a PEP 508
        requirement string. Like ``_iter_requires_txt_entries()``, there is code
        in ``importlib.metadata`` that does mostly the same, but not do exactly
        what we need.

        Namely, ``importlib.metadata`` does not normalize the extra name before
        putting it into the requirement string, which causes marker comparison
        to fail because the dist-info format do normalize. This is consistent in
        all currently available PEP 517 backends, although not standardized.
        ú(z) and extra == "ú"z
extra == "rv   z ; N)r³   r@   rA   r   r?   )r+   r6   rA   r,   r,   r-   Ú_iter_egg_info_dependencies!  s    z,BaseDistribution._iter_egg_info_dependenciesN)r�   r&   c                 C   sD   |  d¡s |  ¡ D ]}||d< q|  d¡s@|  ¡ D ]}||d< q2dS )z6Add egg-info requires.txt information to the metadata.zRequires-DistzProvides-ExtraN)Úget_allr¹   r¶   )r+   r�   Údepr@   r,   r,   r-   rŽ   <  s    


z'BaseDistribution._add_egg_info_requires)r,   )Fr1   r2   r3   Úclassmethodr5   rF   ÚbytesrJ   rM   rS   rT   r4   r   rR   rY   rZ   r[   r�   r^   ra   rd   re   r   rf   ÚDistributionVersionrQ   rj   r   rU   r~   r€   r‚   rƒ   r†   r‡   ÚInfoPathr\   r	   rŠ   rk   r   r$   r‹   Úemailr–   ÚMessagerŒ   Ú	functoolsÚ	lru_cacher�   r�   r   r   r‘   r“   rP   r   r—   r   r   r™   rš   r¢   r¬   r­   r>   r³   r¶   r¹   rŽ   r,   r,   r,   r-   rC   k   s”   û		


	rC   c                   @   s¢   e Zd ZdZed dœdd„ƒZeeee  d dœdd„ƒZ	eed d	œd
d„Z
ed dœdd„Zee dœdd„Zdedddfeee eeeee dœdd„ZdS )ÚBaseEnvironmentz6An environment containing distributions to introspect.r%   c                 C   s
   t ƒ ‚d S r'   r(   )rE   r,   r,   r-   ÚdefaultI  s    zBaseEnvironment.default)rª   r&   c                 C   s
   t ƒ ‚d S r'   r(   )rE   rª   r,   r,   r-   Ú
from_pathsM  s    zBaseEnvironment.from_pathsrC   )r.   r&   c                 C   s
   t ƒ ‚dS )z«Given a requirement name, return the installed distributions.

        The name may not be normalized. The implementation must canonicalize
        it for lookup.
        Nr(   )r+   r.   r,   r,   r-   Úget_distributionQ  s    z BaseEnvironment.get_distributionc                 C   s
   t ƒ ‚dS )a  Iterate through installed distributions.

        This function should be implemented by subclass, but never called
        directly. Use the public ``iter_distribution()`` instead, which
        implements additional logic to make sure the distributions are valid.
        Nr(   r*   r,   r,   r-   Ú_iter_distributionsY  s    z#BaseEnvironment._iter_distributionsc                 c   sD   |   ¡ D ]6}tjd|jtjd�}|s8t d|j|j¡ q|V  qdS )zBIterate through all installed distributions without any filtering.z)^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$)Úflagsz%Ignoring invalid distribution %s (%s)N)rÈ   ÚreÚmatchrf   Ú
IGNORECASErq   rr   rR   )r+   ÚdistÚproject_name_validr,   r,   r-   Úiter_all_distributionsb  s    ýýz&BaseEnvironment.iter_all_distributionsTF)Ú
local_onlyÚskipÚinclude_editablesÚeditables_onlyÚ	user_onlyr&   c                    sb   |   ¡ }|rdd„ |D ƒ}|s,dd„ |D ƒ}|r>dd„ |D ƒ}|rPdd„ |D ƒ}‡ fdd„|D ƒS )a/  Return a list of installed distributions.

        This is based on ``iter_all_distributions()`` with additional filtering
        options. Note that ``iter_installed_distributions()`` without arguments
        is *not* equal to ``iter_all_distributions()``, since some of the
        configurations exclude packages by default.

        :param local_only: If True (default), only return installations
        local to the current virtualenv, if in a virtualenv.
        :param skip: An iterable of canonicalized project names to ignore;
            defaults to ``stdlib_pkgs``.
        :param include_editables: If False, don't report editables.
        :param editables_only: If True, only report editables.
        :param user_only: If True, only report installations in the user
        site directory.
        c                 s   s   | ]}|j r|V  qd S r'   )rƒ   ©rœ   Údr,   r,   r-   rž   ‘  s      z?BaseEnvironment.iter_installed_distributions.<locals>.<genexpr>c                 s   s   | ]}|j s|V  qd S r'   ©r‚   rÕ   r,   r,   r-   rž   “  s      c                 s   s   | ]}|j r|V  qd S r'   r×   rÕ   r,   r,   r-   rž   •  s      c                 s   s   | ]}|j r|V  qd S r'   )r†   rÕ   r,   r,   r-   rž   —  s      c                 3   s   | ]}|j ˆ kr|V  qd S r'   )rf   rÕ   ©rÑ   r,   r-   rž   ˜  s     
 )rÏ   )r+   rÐ   rÑ   rÒ   rÓ   rÔ   Úitr,   rØ   r-   Úiter_installed_distributionsw  s    z,BaseEnvironment.iter_installed_distributionsN)r1   r2   r3   Ú__doc__r¼   rÅ   r   r
   r5   rÆ   rÇ   r	   rÈ   rC   rÏ   r   r�   r   rÚ   r,   r,   r,   r-   rÄ   F  s*   	úùrÄ   c                   @   s&   e Zd ZU eed< ejdœdd„ZdS )rK   rR   r%   c                 C   s
   t ƒ ‚d S r'   r(   r*   r,   r,   r-   Ú
as_zipfilež  s    zWheel.as_zipfileN)r1   r2   r3   r5   rB   ÚzipfileÚZipFilerÜ   r,   r,   r,   r-   rK   ›  s   
rK   c                   @   s,   e Zd Zeddœdd„Zejdœdd„ZdS )ÚFilesystemWheelN)rR   r&   c                 C   s
   || _ d S r'   )rR   r`   r,   r,   r-   Ú__init__£  s    zFilesystemWheel.__init__r%   c                 C   s   t j| jdd�S ©NT)Ú
allowZip64)rÝ   rÞ   rR   r*   r,   r,   r-   rÜ   ¦  s    zFilesystemWheel.as_zipfile)r1   r2   r3   r5   rà   rÝ   rÞ   rÜ   r,   r,   r,   r-   rß   ¢  s   rß   c                   @   s2   e Zd Zeee ddœdd„Zejdœdd„Z	dS )ÚMemoryWheelN)rR   Ústreamr&   c                 C   s   || _ || _d S r'   )rR   rä   )r+   rR   rä   r,   r,   r-   rà   «  s    zMemoryWheel.__init__r%   c                 C   s   t j| jdd�S rá   )rÝ   rÞ   rä   r*   r,   r,   r-   rÜ   ¯  s    zMemoryWheel.as_zipfile)
r1   r2   r3   r5   r   r½   rà   rÝ   rÞ   rÜ   r,   r,   r,   r-   rã   ª  s   rã   )HrŸ   Úemail.messagerÀ   rÂ   ro   Úloggingr;   rÊ   rÝ   Útypingr   r   r   r   r   r   r   r	   r
   r   r   r   r   Ú"pip._vendor.packaging.requirementsr   Z pip._vendor.packaging.specifiersr   r   Zpip._vendor.packaging.utilsr   Zpip._vendor.packaging.versionr   r   Úpip._internal.exceptionsr   Úpip._internal.locationsr   r   Úpip._internal.models.direct_urlr   r   r   Úpip._internal.utils.compatr   Úpip._internal.utils.egg_linkr   Úpip._internal.utils.miscr   r   Úpip._internal.utils.packagingr   Úpip._internal.utils.urlsr    Ú_jsonr"   r#   Úobjectr¾   r5   ÚPurePathr¿   Ú	getLoggerr1   rq   r$   r=   r>   rC   rÄ   rK   rß   rã   r,   r,   r,   r-   Ú<module>   sR   <


ý   ^U