HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cppython/lib/python3.8/site-packages/pip/_internal/metadata/__pycache__/base.cpython-38.pyc
U

>D�g�b�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZddlmZddlmZmZddlmZmZddlm Z ddl!m"Z"ddl#m$Z$m%Z%dd	l&m'Z'm(Z(m)Z)dd
l*m+Z+ddl,m-Z-ddl.m/Z/m0Z0dd
l1m2Z2ddl3m4Z4ee5ej6fZ7e�8e9�Z:Gdd�de�Z;ee5dfee5dfe5d�dd�Z<Gdd�de�Z=Gdd�de�Z>Gdd�d�Z?Gdd�de�Z@Gdd�de@�ZAGd d!�d!e@�ZBdS)"�N)
�IO�Any�
Collection�	Container�Dict�Iterable�Iterator�List�
NamedTuple�Optional�Protocol�Tuple�Union)�Requirement)�InvalidSpecifier�SpecifierSet)�NormalizedName�canonicalize_name)�Version)�NoneMetadataError)�
site_packages�	user_site)�DIRECT_URL_METADATA_NAME�	DirectUrl�DirectUrlValidationError)�stdlib_pkgs)�egg_link_path_from_sys_path)�is_local�normalize_path)�url_to_path�)�msg_to_jsonc@sBeZdZeed�dd��Zeed�dd��Zeed�dd��ZdS)	�BaseEntryPoint��returncCs
t��dS�N��NotImplementedError��self�r*�H/opt/cppython/lib/python3.8/site-packages/pip/_internal/metadata/base.py�name2szBaseEntryPoint.namecCs
t��dSr%r&r(r*r*r+�value6szBaseEntryPoint.valuecCs
t��dSr%r&r(r*r*r+�group:szBaseEntryPoint.groupN)�__name__�
__module__�__qualname__�property�strr,r-r.r*r*r*r+r"1sr".)�entry�infor$cCsV|rD|ddkrD|r |ddkr*|d7}n|dd�}|dd�}qttj||���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�..���)r6Nr �r3�pathlib�Path)r4r5r*r*r+�_convert_installed_files_path?s
r;c@s&eZdZUeed<eed<eed<dS)�
RequiresEntry�requirement�extra�markerN)r/r0r1r3�__annotations__r*r*r*r+r<]s
r<c@s`eZdZeedd�dd��Zeeeedd�dd��Zededd�d	d
��Zed�dd
�Z	ed�dd�Z
eeed�dd��Z
eeed�dd��Zeeed�dd��Zeeed�dd��Zeed�dd��Zeed�dd��Zeed�dd��Zeed�dd��Zeed�d d!��Zeed�d"d#��Zeed�d$d%��Zeed�d&d'��Zeeed�d(d)��Zeed�d*d+��Zeed�d,d-��Zeed�d.d/��Z eed�d0d1��Z!eed�d2d3��Z"eed�d4d5��Z#e$ed6�d7d8�Z%e&ed�d9d:�Z'e$ed6�d;d<�Z(e)e*d�d=d>�Z+e,j-j.d�d?d@�Z/e0j1e,j-j.d�dAdB��Z2ee3ee4fd�dCdD��Z5eeed�dEdF��Z6eed�dGdH��Z7ee8d�dIdJ��Z9dce:ee)e;dL�dMdN�Z<e)ed�dOdP�Z=e)ed�dQdR�Z>ee&ed�dSdT�Z?ee&ed�dUdV�Z@ee&ed�dWdX�ZAe&eBd�dYdZ�ZCe)ed�d[d\�ZDe)ed�d]d^�ZEe,j-j.d_d`�dadb�ZFd_S)d�BaseDistribution)�	directoryr$cCs
t��dS)z�Load the distribution from a metadata directory.

        :param directory: Path to a metadata directory, e.g. ``.dist-info``.
        Nr&)�clsrBr*r*r+�from_directorydszBaseDistribution.from_directory)�metadata_contents�filename�project_namer$cCs
t��dS)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&)rCrErFrGr*r*r+�from_metadata_file_contentslsz,BaseDistribution.from_metadata_file_contents�Wheel)�wheelr,r$cCs
t��dS)aLoad 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&)rCrJr,r*r*r+�
from_wheel~szBaseDistribution.from_wheelr#cCs|j�d|j�d|j�d�S)N� z (�))�raw_name�raw_version�locationr(r*r*r+�__repr__�szBaseDistribution.__repr__cCs|j�d|j��S)NrL)rNrOr(r*r*r+�__str__�szBaseDistribution.__str__cCs
t��dS)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+rP�szBaseDistribution.locationcCs6|j}|r|��r2t|j�Snt|j�}|r2|jSdS)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�urlrrNrP)r)rS�
egg_link_pathr*r*r+�editable_project_location�s
z*BaseDistribution.editable_project_locationcCs
t��dS)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�sz#BaseDistribution.installed_locationcCs
t��dS)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�szBaseDistribution.info_locationcCs|j}|sdSt�|���S)aWhether 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)rYr9r:�is_file�r)rYr*r*r+�installed_by_distutils�sz'BaseDistribution.installed_by_distutilscCs|j}|sdS|�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)rP�endswith�r)rPr*r*r+�installed_as_egg�sz!BaseDistribution.installed_as_eggcCs*|j}|sdS|�d�sdSt�|���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�rYr]r9r:�is_dirr[r*r*r+�"installed_with_setuptools_egg_info�s
z3BaseDistribution.installed_with_setuptools_egg_infocCs*|j}|sdS|�d�sdSt�|���S)aaWhether 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-infor`r[r*r*r+�installed_with_dist_info�s	
z)BaseDistribution.installed_with_dist_infocCs
t��dSr%r&r(r*r*r+�canonical_nameszBaseDistribution.canonical_namecCs
t��dSr%r&r(r*r*r+�versionszBaseDistribution.versioncCs
t��dSr%r&r(r*r*r+rOszBaseDistribution.raw_versioncCs|j�dd�S)z�Convert a project name to its setuptools-compatible filename.

        This is a copy of ``pkg_resources.to_filename()`` for compatibility.
        �-�_)rN�replacer(r*r*r+�setuptools_filenamesz$BaseDistribution.setuptools_filenamec
Cszz|�t�}Wntk
r$YdSXzt�|�WSttjtfk
rt}zt	�
dt|j|�WY�dSd}~XYnXdS)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.
        NzError parsing %s for %s: %s)�	read_textr�FileNotFoundErrorr�	from_json�UnicodeDecodeError�json�JSONDecodeErrorr�logger�warningrd)r)�content�er*r*r+rS"s$��zBaseDistribution.direct_urlc
CsRz|�d�}Wntttfk
r*YdSX|��D]}|��}|r4|Sq4dS)N�	INSTALLER�)rj�OSError�
ValueErrorr�
splitlines�strip)r)�installer_text�line�cleaned_liner*r*r+�	installer<s
zBaseDistribution.installercCs
|�d�S)N�	REQUESTED)rZr(r*r*r+�	requestedHszBaseDistribution.requestedcCs
t|j�Sr%)�boolrWr(r*r*r+�editableLszBaseDistribution.editablecCs|jdkrdSt|j�S)z|If distribution is installed in the current virtual environment.

        Always True if we're not in a virtualenv.
        NF)rXrr(r*r*r+�localPs
zBaseDistribution.localcCs&|jdkstdkrdS|j�tt��S�NF)rXr�
startswithrr(r*r*r+�in_usersiteZszBaseDistribution.in_usersitecCs&|jdkstdkrdS|j�tt��Sr�)rXrr�rr(r*r*r+�in_site_packages`sz!BaseDistribution.in_site_packages)�pathr$cCs
t��dS)z7Check whether an entry in the info directory is a file.Nr&�r)r�r*r*r+rZfszBaseDistribution.is_filecCs
t��dS)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_namesjsz,BaseDistribution.iter_distutils_script_namescCs
t��dS)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+rjrszBaseDistribution.read_textcCs
t��dSr%r&r(r*r*r+�iter_entry_points{sz"BaseDistribution.iter_entry_pointscCs
t��dSr%r&r(r*r*r+�_metadata_impl~szBaseDistribution._metadata_implcCs|��}|�|�|S)aMetadata 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	
zBaseDistribution.metadatacCs
t|j�S)aPEP 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	zBaseDistribution.metadata_dictcCs|j�d�S)zDValue of "Metadata-Version:" in distribution metadata, if available.zMetadata-Version)r��getr(r*r*r+�metadata_version�sz!BaseDistribution.metadata_versioncCs|j�d|j�S)z*Value of "Name:" in distribution metadata.�Name)r�r�rdr(r*r*r+rN�szBaseDistribution.raw_namec
Csp|j�d�}|dkrt�Sztt|��}Wn@tk
rj}z"d}t�||j|�t�WY�Sd}~XYnX|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.
        zRequires-PythonNz-Package %r has an invalid Requires-Python: %s)r�r�rr3rrprqrN)r)r-�specrs�messager*r*r+�requires_python�sz BaseDistribution.requires_pythonr*)�extrasr$cCs
t��dS)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�sz"BaseDistribution.iter_dependenciescCs|j�dg�S)zRaw Requires-Dist metadata.�
Requires-Dist)r��get_allr(r*r*r+�iter_raw_dependencies�sz&BaseDistribution.iter_raw_dependenciescCs
t��dS)ajExtras 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`.
        Nr&r(r*r*r+�iter_provided_extras�s
z%BaseDistribution.iter_provided_extrascCs>z|�d�}Wntk
r$YdSXdd�t�|���D�S)N�RECORDcss |]}tt�|d��VqdS)rNr8)�.0�rowr*r*r+�	<genexpr>�szFBaseDistribution._iter_declared_entries_from_record.<locals>.<genexpr>)rjrk�csv�readerrx)r)�textr*r*r+�"_iter_declared_entries_from_record�s
z3BaseDistribution._iter_declared_entries_from_recordcs�z|�d�}Wntk
r$YdSXdd�|jdd�D�}|j}|j}|dksX|dkr\|Szt�|��|��Wntk
r�|YSX�j	s�|S�fdd�|D�S)Nzinstalled-files.txtcss|]}|r|VqdSr%r*�r��pr*r*r+r��szFBaseDistribution._iter_declared_entries_from_legacy.<locals>.<genexpr>F)�keependsc3s"|]}tt�|�j�j�VqdSr%)r;r9r:�partsr���info_relr*r+r��s�)
rjrkrxrPrYr9r:�relative_torwr�)r)r��paths�rootr5r*r�r+�"_iter_declared_entries_from_legacy�s$

�z3BaseDistribution._iter_declared_entries_from_legacycCs|��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_entriesccs�z|�d�}Wntk
r$YdSXd}}|��D]X}|��}|r6|�d�rRq6|�d�r~|�d�r~|�d��d�\}}}q6t|||d	�Vq6dS)
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.txtNru�#�[�]z[]�:)r=r>r?)rjrkrxryr�r]�	partitionr<)r)rrr>r?r{rgr*r*r+�_iter_requires_txt_entries�sz+BaseDistribution._iter_requires_txt_entriesccs<dh}|��D](}t|j�}||kr&q|�|�|VqdS)z'Get extras from the egg-info directory.ruN)r�rr>�add)r)�known_extrasr4r>r*r*r+�_iter_egg_info_extrass

z&BaseDistribution._iter_egg_info_extrasccs�|��D]r}t|j�}|r6|jr6d|j�d|�d�}n$|rHd|�d�}n|jrV|j}nd}|rr|j�d|��Vq|jVqdS)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 == "ruz ; N)r�rr>r?r=)r)r4r>r?r*r*r+�_iter_egg_info_dependencies s


z,BaseDistribution._iter_egg_info_dependenciesN)r�r$cCsD|�d�s |��D]}||d<q|�d�s@|��D]}||d<q2dS)z6Add egg-info requires.txt information to the metadata.r�zProvides-ExtraN)r�r�r�)r)r��depr>r*r*r+r�<s


z'BaseDistribution._add_egg_info_requires)r*)Gr/r0r1�classmethodr3rD�bytesrHrKrQrRr2rrPrWrXrYr�r\r_rbrcrrdrrerOrirrSr}rr�r�r�r��InfoPathrZrr�rjrr"r��emailr��Messager��	functools�cached_propertyr�rrr�r�rNrr�rrr�r�r�r�r�r�r<r�r�r�r�r*r*r*r+rAcs��

		

rAc@s�eZdZdZedd�dd��Zeeeedd�dd��Z	eedd	�d
d�Z
edd�dd
�Zee
d�dd�Zdedddfeeeeeeee
d�dd�ZdS)�BaseEnvironmentz6An environment containing distributions to introspect.r#cCs
t��dSr%r&)rCr*r*r+�defaultIszBaseEnvironment.default)r�r$cCs
t��dSr%r&)rCr�r*r*r+�
from_pathsMszBaseEnvironment.from_pathsrA)r,r$cCs
t��dS)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_distributionQsz BaseEnvironment.get_distributioncCs
t��dS)aIterate 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_distributionsYsz#BaseEnvironment._iter_distributionsccsD|��D]6}tjd|jtjd�}|s8t�d|j|j�q|VqdS)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�matchrd�
IGNORECASErprqrP)r)�dist�project_name_validr*r*r+�iter_all_distributionsbs��z&BaseEnvironment.iter_all_distributionsTF)�
local_only�skip�include_editables�editables_only�	user_onlyr$csb|��}|rdd�|D�}|s,dd�|D�}|r>dd�|D�}|rPdd�|D�}�fdd�|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.
        css|]}|jr|VqdSr%)r��r��dr*r*r+r��sz?BaseEnvironment.iter_installed_distributions.<locals>.<genexpr>css|]}|js|VqdSr%�r�r�r*r*r+r��scss|]}|jr|VqdSr%r�r�r*r*r+r��scss|]}|jr|VqdSr%)r�r�r*r*r+r��sc3s|]}|j�kr|VqdSr%)rdr��r�r*r+r��s
)r�)r)r�r�r�r�r��itr*r�r+�iter_installed_distributionswsz,BaseEnvironment.iter_installed_distributionsN)r/r0r1�__doc__r�r�rr	r3r�r�rr�rAr�rr�rr�r*r*r*r+r�Fs*	��r�c@s&eZdZUeed<ejd�dd�ZdS)rIrPr#cCs
t��dSr%r&r(r*r*r+�
as_zipfile�szWheel.as_zipfileN)r/r0r1r3r@�zipfile�ZipFiler�r*r*r*r+rI�s
rIc@s,eZdZedd�dd�Zejd�dd�ZdS)�FilesystemWheelN)rPr$cCs
||_dSr%)rPr^r*r*r+�__init__�szFilesystemWheel.__init__r#cCstj|jdd�S�NT)�
allowZip64)r�r�rPr(r*r*r+r��szFilesystemWheel.as_zipfile)r/r0r1r3r�r�r�r�r*r*r*r+r��sr�c@s2eZdZeeedd�dd�Zejd�dd�Z	dS)�MemoryWheelN)rP�streamr$cCs||_||_dSr%)rPr�)r)rPr�r*r*r+r��szMemoryWheel.__init__r#cCstj|jdd�Sr�)r�r�r�r(r*r*r+r��szMemoryWheel.as_zipfile)
r/r0r1r3rr�r�r�r�r�r*r*r*r+r��sr�)Cr��
email.messager�r�rn�loggingr9r�r��typingrrrrrrrr	r
rrr
r�"pip._vendor.packaging.requirementsrZ pip._vendor.packaging.specifiersrrZpip._vendor.packaging.utilsrrZpip._vendor.packaging.versionr�pip._internal.exceptionsr�pip._internal.locationsrr�pip._internal.models.direct_urlrrr�pip._internal.utils.compatr�pip._internal.utils.egg_linkr�pip._internal.utils.miscrr�pip._internal.utils.urlsr�_jsonr!r3�PurePathr��	getLoggerr/rpr"r;r<rAr�rIr�r�r*r*r*r+�<module>sH<


�fU