o
    ©„j*d  ã                   @  s°  d dl m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
Z
d dlmZmZmZmZ d dl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mZ d dl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+m,Z, d dl-m.Z. ddl/m0Z0 h d£Z1e2ej3B Z4e 5e6¡Z7G dd„ deƒZ8d'dd„Z9G dd„ deƒZ:G dd„ deƒZ;G dd „ d ƒZ<G d!d"„ d"eƒZ=G d#d$„ d$e=ƒZ>G d%d&„ d&e=ƒZ?dS )(é    )ÚannotationsN)Ú
CollectionÚ	ContainerÚIterableÚIterator)ÚIOÚAnyÚ
NamedTupleÚProtocol)ÚRequirement)ÚInvalidSpecifierÚSpecifierSet)ÚNormalizedNameÚcanonicalize_name)ÚVersion)ÚNoneMetadataError)Úsite_packagesÚ	user_site)ÚDIRECT_URL_METADATA_NAMEÚ	DirectUrlÚDirectUrlValidationError)Úegg_link_path_from_sys_path)Úis_localÚnormalize_path)Úurl_to_pathé   )Úmsg_to_json>   ÚpythonÚwsgirefÚargparsec                   @  s6   e Zd Zed
dd„ƒZed
dd„ƒZed
dd„ƒZd	S )ÚBaseEntryPointÚreturnÚstrc                 C  ó   t ƒ ‚©N©ÚNotImplementedError©Úself© r)   úY/var/www/html/django_cbt/venv/lib/python3.10/site-packages/pip/_internal/metadata/base.pyÚname3   ó   zBaseEntryPoint.namec                 C  r#   r$   r%   r'   r)   r)   r*   Úvalue7   r,   zBaseEntryPoint.valuec                 C  r#   r$   r%   r'   r)   r)   r*   Úgroup;   r,   zBaseEntryPoint.groupN©r!   r"   )Ú__name__Ú
__module__Ú__qualname__Úpropertyr+   r-   r.   r)   r)   r)   r*   r    2   s    r    Úentryútuple[str, ...]Úinfor!   r"   c                 C  sj   | r)| d dkr)|r|d dkr|d7 }n|dd… }| dd… } | r)| d dkst tjg |¢| ¢R Ž ƒ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   ú..éÿÿÿÿ)r7   Nr   ©r"   ÚpathlibÚPath)r4   r6   r)   r)   r*   Ú_convert_installed_files_path@   s   
ûr<   c                   @  s&   e Zd ZU ded< ded< ded< dS )ÚRequiresEntryr"   ÚrequirementÚextraÚmarkerN)r0   r1   r2   Ú__annotations__r)   r)   r)   r*   r=   ^   s   
 r=   c                   @  s6  e Zd Zedzdd„ƒZed{d
d„ƒZed|dd„ƒZd}dd„Zd}dd„Ze	d~dd„ƒZ
ejd~dd„ƒZe	d~dd„ƒZe	d~dd„ƒZe	ddd „ƒZe	dd!d"„ƒZe	dd#d$„ƒZe	dd%d&„ƒZe	d€d(d)„ƒZe	d�d+d,„ƒZe	d}d-d.„ƒZe	d}d/d0„ƒZe	d‚d2d3„ƒZe	d}d4d5„ƒZe	dd6d7„ƒZe	dd8d9„ƒZe	dd:d;„ƒZe	dd<d=„ƒZe	dd>d?„ƒZdƒdBdC„Zd„dEdF„Z d…dGdH„Z!d†dJdK„Z"d‡dMdN„Z#ejd‡dOdP„ƒZ$e	dˆdRdS„ƒZ%e	d~dTdU„ƒZ&e	d}dVdW„ƒZ'e	d‰dYdZ„ƒZ(dŠd‹d_d`„Z)dŒdbdc„Z*d�dedf„Z+dŽdhdi„Z,dŽdjdk„Z-dŽdldm„Z.d�dodp„Z/dŒdqdr„Z0dŒdsdt„Z1d�dwdx„Z2dyS )‘ÚBaseDistributionÚ	directoryr"   r!   c                 C  r#   )z‡Load the distribution from a metadata directory.

        :param directory: Path to a metadata directory, e.g. ``.dist-info``.
        r%   )ÚclsrC   r)   r)   r*   Úfrom_directorye   ó   zBaseDistribution.from_directoryÚmetadata_contentsÚbytesÚfilenameÚproject_namec                 C  r#   )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.
        r%   )rD   rG   rI   rJ   r)   r)   r*   Úfrom_metadata_file_contentsm   s   z,BaseDistribution.from_metadata_file_contentsÚwheelÚWheelr+   c                 C  r#   )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.
        r%   )rD   rL   r+   r)   r)   r*   Ú
from_wheel   ó   zBaseDistribution.from_wheelc                 C  s   | j › d| j› d| j› d�S )Nú z (ú))Úraw_nameÚraw_versionÚlocationr'   r)   r)   r*   Ú__repr__�   s   zBaseDistribution.__repr__c                 C  s   | j › d| j› �S )NrP   )rR   rS   r'   r)   r)   r*   Ú__str__�   s   zBaseDistribution.__str__ú
str | Nonec                 C  r#   )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.
        r%   r'   r)   r)   r*   rT   “   rO   zBaseDistribution.locationc                 C  s8   | j }|r| ¡ rt|jƒS dS t| jƒ}|r| 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   rR   rT   )r(   rX   Úegg_link_pathr)   r)   r*   Úeditable_project_location¡   s   
	
ûz*BaseDistribution.editable_project_locationc                 C  r#   )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).
        r%   r'   r)   r)   r*   Úinstalled_location¶   s   z#BaseDistribution.installed_locationc                 C  r#   )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.
        r%   r'   r)   r)   r*   Úinfo_locationÃ   s   zBaseDistribution.info_locationÚboolc                 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 t |¡jdk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)rT   r:   r;   Úsuffix©r(   rT   r)   r)   r*   Úinstalled_as_eggà   s   z!BaseDistribution.installed_as_eggc                 C  ó*   | 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^   Úendswithr:   r;   Úis_dirra   r)   r)   r*   Ú"installed_with_setuptools_egg_infoî   s   
z3BaseDistribution.installed_with_setuptools_egg_infoc                 C  rf   )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-inforg   ra   r)   r)   r*   Úinstalled_with_dist_info   s   	
z)BaseDistribution.installed_with_dist_infor   c                 C  r#   r$   r%   r'   r)   r)   r*   Úcanonical_name  r,   zBaseDistribution.canonical_namer   c                 C  r#   r$   r%   r'   r)   r)   r*   Úversion  r,   zBaseDistribution.versionc                 C  r#   r$   r%   r'   r)   r)   r*   rS     r,   zBaseDistribution.raw_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.
        ú-Ú_)rR   Úreplacer'   r)   r)   r*   Úsetuptools_filename  s   z$BaseDistribution.setuptools_filenameúDirectUrl | Nonec              
   C  sr   z|   t¡}W n
 ty   Y dS w zt |¡W S  ttjtfy8 } zt	 
dt| j|¡ W Y d}~dS d}~ww )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Úwarningrl   )r(   ÚcontentÚer)   r)   r*   rX   $  s*   ÿýü€õzBaseDistribution.direct_urlc              
   C  sP   z|   d¡}W n tttfy   Y dS w | ¡ D ]}| ¡ }|r%|  S qdS )NÚ	INSTALLERÚ )rs   Ú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*   Ú	requestedJ  ó   
zBaseDistribution.requestedc                 C  ó
   t | jƒS r$   )r_   r\   r'   r)   r)   r*   ÚeditableN  r‰   zBaseDistribution.editablec                 C  s   | j du 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)r]   r   r'   r)   r)   r*   ÚlocalR  s   

zBaseDistribution.localc                 C  ó&   | j d u s	td u rdS | j  ttƒ¡S ©NF)r]   r   Ú
startswithr   r'   r)   r)   r*   Úin_usersite\  ó   zBaseDistribution.in_usersitec                 C  r�   rŽ   )r]   r   r�   r   r'   r)   r)   r*   Úin_site_packagesb  r‘   z!BaseDistribution.in_site_packagesÚpathÚInfoPathc                 C  r#   )z7Check whether an entry in the info directory is a file.r%   ©r(   r“   r)   r)   r*   r`   h  r,   zBaseDistribution.is_fileúIterator[str]c                 C  r#   )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.
        r%   r'   r)   r)   r*   Úiter_distutils_script_namesl  rF   z,BaseDistribution.iter_distutils_script_namesc                 C  r#   )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.
        r%   r•   r)   r)   r*   rs   t  ó   zBaseDistribution.read_textúIterable[BaseEntryPoint]c                 C  r#   r$   r%   r'   r)   r)   r*   Úiter_entry_points}  ó   z"BaseDistribution.iter_entry_pointsúemail.message.Messagec                 C  r#   r$   r%   r'   r)   r)   r*   Ú_metadata_impl€  r›   zBaseDistribution._metadata_implc                 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�   Ú_add_egg_info_requires)r(   Úmetadatar)   r)   r*   rŸ   ƒ  s   	
zBaseDistribution.metadataúdict[str, Any]c                 C  rŠ   )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¢   rl   r'   r)   r)   r*   rR      s   zBaseDistribution.raw_namer   c              
   C  sl   | j  d¡}|du rtƒ S z	tt|ƒƒ}W |S  ty5 } zd}t || j|¡ tƒ W  Y d}~S d}~ww )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   r"   r   ry   rz   rR   )r(   r-   Úspecr|   Úmessager)   r)   r*   Úrequires_python§  s   ü€ýz BaseDistribution.requires_pythonr)   ÚextrasúCollection[str]úIterable[Requirement]c                 C  r#   )z®Dependencies of this distribution.

        For modern .dist-info distributions, this is the collection of
        "Requires-Dist:" entries in distribution metadata.
        r%   )r(   r¨   r)   r)   r*   Úiter_dependenciesº  rF   z"BaseDistribution.iter_dependenciesúIterable[str]c                 C  s   | j  dg ¡S )zRaw Requires-Dist metadata.úRequires-Dist)rŸ   Úget_allr'   r)   r)   r*   Úiter_raw_dependenciesÂ  s   z&BaseDistribution.iter_raw_dependenciesúIterable[NormalizedName]c                 C  r#   )aj  Extras provided by this distribution.

        For modern .dist-info distributions, this is the collection of
        "Provides-Extra:" entries in distribution metadata.

        The return value of this function is expected to be normalised names,
        per PEP 685, with the returned value being handled appropriately by
        `iter_dependencies`.
        r%   r'   r)   r)   r*   Úiter_provided_extrasÆ  s   
z%BaseDistribution.iter_provided_extrasúIterator[str] | Nonec                 C  s<   z|   d¡}W n
 ty   Y d S w dd„ t | ¡ ¡D ƒS )NÚRECORDc                 s  s"   � | ]}t t |d  ¡ƒV  qdS )r   Nr9   )Ú.0Úrowr)   r)   r*   Ú	<genexpr>Ø  s   €  zFBaseDistribution._iter_declared_entries_from_record.<locals>.<genexpr>)rs   rt   ÚcsvÚreaderr�   )r(   Útextr)   r)   r*   Ú"_iter_declared_entries_from_recordÒ  s   ÿz3BaseDistribution._iter_declared_entries_from_recordc                   s¢   z|   d¡}W n
 ty   Y d S w dd„ |jdd�D ƒ}| j}| j}|d u s+|d u r-|S z
t |¡ |¡‰ W n tyB   | Y S w ˆ j	sH|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
   € ÿ
ÿ)
rs   rt   r�   rT   r^   r:   r;   Úrelative_tor€   r¾   )r(   r¹   ÚpathsÚrootr6   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_entriesúIterator[RequiresEntry]c                 c  s”   � z|   d¡}W n
 ty   Y dS w d }}| ¡ D ],}| ¡ }|r(| d¡r)q| d¡r?| d¡r?| d¡ d¡\}}}qt|||d	�V  qd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.txtNr~   ú#ú[ú]z[]ú:)r>   r?   r@   )rs   rt   r�   r‚   r�   rh   Ú	partitionr=   )r(   r{   r?   r@   r„   ro   r)   r)   r*   Ú_iter_requires_txt_entriesÿ  s    €ÿùz+BaseDistribution._iter_requires_txt_entriesc                 c  s>   � dh}|   ¡ D ]}t|jƒ}||v rq| |¡ |V  qdS )z'Get extras from the egg-info directory.r~   N)rÌ   r   r?   Úadd)r(   Úknown_extrasr4   r?   r)   r)   r*   Ú_iter_egg_info_extras  s   €

ûz&BaseDistribution._iter_egg_info_extrasc                 c  s‚   � |   ¡ D ]9}t|jƒ}|r|jrd|j› d|› d�}n|r%d|› d�}n	|jr,|j}nd}|r:|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 == "r~   z ; N)rÌ   r   r?   r@   r>   )r(   r4   r?   r@   r)   r)   r*   Ú_iter_egg_info_dependencies"  s   €


óz,BaseDistribution._iter_egg_info_dependenciesrŸ   ÚNonec                 C  sH   |  d¡s|  ¡ D ]}||d< q	|  d¡s |  ¡ D ]}||d< qdS dS )z6Add egg-info requires.txt information to the metadata.r­   zProvides-ExtraN)r®   rÒ   rÏ   )r(   rŸ   Údepr?   r)   r)   r*   rž   >  s   



þz'BaseDistribution._add_egg_info_requiresN)rC   r"   r!   rB   )rG   rH   rI   r"   rJ   r"   r!   rB   )rL   rM   r+   r"   r!   rB   r/   )r!   rW   )r!   r_   )r!   r   )r!   r   )r!   rr   )r“   r”   r!   r_   )r!   r–   )r“   r”   r!   r"   )r!   r™   )r!   rœ   )r!   r    )r!   r   )r)   )r¨   r©   r!   rª   )r!   r¬   )r!   r°   )r!   r²   )r!   rÆ   )rŸ   rœ   r!   rÓ   )3r0   r1   r2   ÚclassmethodrE   rK   rN   rU   rV   r3   rT   Ú	functoolsÚcached_propertyr\   r]   r^   rb   re   rj   rk   rl   rm   rS   rq   rX   r†   rˆ   r‹   rŒ   r�   r’   r`   r—   rs   rš   r�   rŸ   r¡   r£   rR   r§   r«   r¯   r±   rº   rÄ   rÅ   rÌ   rÏ   rÒ   rž   r)   r)   r)   r*   rB   d   s�    

	



	










rB   c                   @  s`   e Zd ZdZeddd„ƒZed dd„ƒZd!dd„Zd"dd„Zd"dd„Z	de
dddfd#dd„ZdS )$ÚBaseEnvironmentz6An environment containing distributions to introspect.r!   c                 C  r#   r$   r%   )rD   r)   r)   r*   ÚdefaultK  r,   zBaseEnvironment.defaultrÂ   úlist[str] | Nonec                 C  r#   r$   r%   )rD   rÂ   r)   r)   r*   Ú
from_pathsO  r,   zBaseEnvironment.from_pathsr+   r"   úBaseDistribution | Nonec                 C  r#   )z«Given a requirement name, return the installed distributions.

        The name may not be normalized. The implementation must canonicalize
        it for lookup.
        r%   )r(   r+   r)   r)   r*   Úget_distributionS  rF   z BaseEnvironment.get_distributionúIterator[BaseDistribution]c                 C  r#   )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.
        r%   r'   r)   r)   r*   Ú_iter_distributions[  r˜   z#BaseEnvironment._iter_distributionsc                 c  sF   � |   ¡ D ]}tjd|jtjd�}|st 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Úmatchrl   Ú
IGNORECASEry   rz   rT   )r(   ÚdistÚproject_name_validr)   r)   r*   Úiter_all_distributionsd  s    €ýýïz&BaseEnvironment.iter_all_distributionsTFÚ
local_onlyr_   ÚskipúContainer[str]Úinclude_editablesÚeditables_onlyÚ	user_onlyc                   sb   |   ¡ }|rdd„ |D ƒ}|sdd„ |D ƒ}|rdd„ |D ƒ}|r(d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  ó   � | ]}|j r|V  qd S r$   )rŒ   ©r´   Údr)   r)   r*   r¶   “  ó   € z?BaseEnvironment.iter_installed_distributions.<locals>.<genexpr>c                 s  s   � | ]}|j s|V  qd S r$   ©r‹   rî   r)   r)   r*   r¶   •  rð   c                 s  rí   r$   rñ   rî   r)   r)   r*   r¶   —  rð   c                 s  rí   r$   )r�   rî   r)   r)   r*   r¶   ™  rð   c                 3  s   � | ]
}|j ˆ vr|V  qd S r$   )rl   rî   ©rè   r)   r*   r¶   š  s   € )ræ   )r(   rç   rè   rê   rë   rì   Úitr)   rò   r*   Úiter_installed_distributionsy  s   z,BaseEnvironment.iter_installed_distributionsN)r!   rØ   )rÂ   rÚ   r!   rØ   )r+   r"   r!   rÜ   )r!   rÞ   )rç   r_   rè   ré   rê   r_   rë   r_   rì   r_   r!   rÞ   )r0   r1   r2   Ú__doc__rÕ   rÙ   rÛ   rÝ   rß   ræ   Ústdlib_pkgsrô   r)   r)   r)   r*   rØ   H  s    


	úrØ   c                   @  s    e Zd ZU ded< ddd„ZdS )	rM   r"   rT   r!   úzipfile.ZipFilec                 C  r#   r$   r%   r'   r)   r)   r*   Ú
as_zipfile   r›   zWheel.as_zipfileN©r!   r÷   )r0   r1   r2   rA   rø   r)   r)   r)   r*   rM   �  s   
 rM   c                   @  s    e Zd Zddd„Zddd	„Zd
S )ÚFilesystemWheelrT   r"   r!   rÓ   c                 C  s
   || _ d S r$   )rT   rd   r)   r)   r*   Ú__init__¥  s   
zFilesystemWheel.__init__r÷   c                 C  ó   t j| jdd�S ©NT)Ú
allowZip64)ÚzipfileÚZipFilerT   r'   r)   r)   r*   rø   ¨  ó   zFilesystemWheel.as_zipfileN)rT   r"   r!   rÓ   rù   ©r0   r1   r2   rû   rø   r)   r)   r)   r*   rú   ¤  s    
rú   c                   @  s    e Zd Zddd„Zdd
d„ZdS )ÚMemoryWheelrT   r"   Ústreamú	IO[bytes]r!   rÓ   c                 C  s   || _ || _d S r$   )rT   r  )r(   rT   r  r)   r)   r*   rû   ­  s   
zMemoryWheel.__init__r÷   c                 C  rü   rý   )rÿ   r   r  r'   r)   r)   r*   rø   ±  r  zMemoryWheel.as_zipfileN)rT   r"   r  r  r!   rÓ   rù   r  r)   r)   r)   r*   r  ¬  s    
r  )r4   r5   r6   r5   r!   r"   )@Ú
__future__r   r·   Úemail.messageÚemailrÖ   rw   Úloggingr:   rá   rÿ   Úcollections.abcr   r   r   r   Útypingr   r   r	   r
   Ú"pip._vendor.packaging.requirementsr   Ú pip._vendor.packaging.specifiersr   r   Úpip._vendor.packaging.utilsr   r   Úpip._vendor.packaging.versionr   Úpip._internal.exceptionsr   Úpip._internal.locationsr   r   Úpip._internal.models.direct_urlr   r   r   Úpip._internal.utils.egg_linkr   Úpip._internal.utils.miscr   r   Úpip._internal.utils.urlsr   Ú_jsonr   rö   r"   ÚPurePathr”   Ú	getLoggerr0   ry   r    r<   r=   rB   rØ   rM   rú   r  r)   r)   r)   r*   Ú<module>   sH    


   gU