HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/site-packages/pip/_internal/metadata/__pycache__/base.cpython-310.pyc
o

��i�b�@sddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZddlmZddlmZmZddlmZddlmZm 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
l1m2Z2ddl3m4Z4ddl5m6Z6er�ddl	m7Z7ne8Z7eee fZ9ee:ej;fZ<e�=e>�Z?Gdd�de7�Z@dee:dfdee:dfde:fdd�ZAGdd�de�ZBGdd�de7�ZCGdd�d�ZDGd d!�d!e7�ZEGd"d#�d#eE�ZFGd$d%�d%eE�ZGdS)&�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@sBeZdZedefdd��Zedefdd��Zedefdd��ZdS)	�BaseEntryPoint�returncC�t���N��NotImplementedError��self�r,�F/usr/local/lib/python3.10/site-packages/pip/_internal/metadata/base.py�name:�zBaseEntryPoint.namecCr&r'r(r*r,r,r-�value>r/zBaseEntryPoint.valuecCr&r'r(r*r,r,r-�groupBr/zBaseEntryPoint.groupN)�__name__�
__module__�__qualname__�property�strr.r0r1r,r,r,r-r$9sr$�entry.�infor%cCsj|r)|ddkr)|r|ddkr|d7}n|dd�}|dd�}|r)|ddksttjg|�|�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�..���)r9Nr!�r6�pathlib�Path)r7r8r,r,r-�_convert_installed_files_pathGs
�r>c@s&eZdZUeed<eed<eed<dS)�
RequiresEntry�requirement�extra�markerN)r2r3r4r6�__annotations__r,r,r,r-r?es
r?c	@sleZdZededdfdd��Zededededdfdd	��Zed
ddeddfd
d��Zdefdd�Z	defdd�Z
edeefdd��Z
edeefdd��Zedeefdd��Zedeefdd��Zedefdd��Zedefdd��Zedefdd ��Zedefd!d"��Zedefd#d$��Zedefd%d&��Zedefd'd(��Zedeefd)d*��Zedefd+d,��Zedefd-d.��Zedefd/d0��Zedefd1d2��Z edefd3d4��Z!edefd5d6��Z"d7e#defd8d9�Z$de%efd:d;�Z&d7e#defd<d=�Z'de(e)fd>d?�Z*de+j,j-fd@dA�Z.e/j0dBdC�de+j,j-fdDdE��Z1ede+j,j-fdFdG��Z2ede3ee4ffdHdI��Z5edeefdJdK��Z6edefdLdM��Z7ede8fdNdO��Z9dfdQe:ede(e;fdRdS�Z<de(efdTdU�Z=dee%efdVdW�Z>dee%efdXdY�Z?dee%efdZd[�Z@de%eAfd\d]�ZBde(efd^d_�ZCde(efd`da�ZDdbe+j,j-ddcfddde�ZEdcS)g�BaseDistribution�	directoryr%cCr&)z�Load the distribution from a metadata directory.

        :param directory: Path to a metadata directory, e.g. ``.dist-info``.
        r()�clsrEr,r,r-�from_directoryl�zBaseDistribution.from_directory�metadata_contents�filename�project_namecCr&)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()rFrIrJrKr,r,r-�from_metadata_file_contentstsz,BaseDistribution.from_metadata_file_contents�wheel�Wheelr.cCr&)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.
        r()rFrMr.r,r,r-�
from_wheel��zBaseDistribution.from_wheelcCs|j�d|j�d|j�d�S)N� z (�))�raw_name�version�locationr*r,r,r-�__repr__�szBaseDistribution.__repr__cCs|j�d|j��S)NrQ)rSrTr*r,r,r-�__str__�szBaseDistribution.__str__cCr&)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-rU�rPzBaseDistribution.locationcCs8|j}|r|��rt|j�SdSt|j�}|r|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 �urlrrSrU)r+rX�
egg_link_pathr,r,r-�editable_project_location�s
	
�z*BaseDistribution.editable_project_locationcCr&)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�sz#BaseDistribution.installed_locationcCr&)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�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)r^r<r=�is_file�r+r^r,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)rU�endswith�r+rUr,r,r-�installed_as_egg�s
z!BaseDistribution.installed_as_eggcC�*|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�r^rbr<r=�is_dirr`r,r,r-�"installed_with_setuptools_egg_info�s
z3BaseDistribution.installed_with_setuptools_egg_infocCre)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-inforfr`r,r,r-�installed_with_dist_infos	
z)BaseDistribution.installed_with_dist_infocCr&r'r(r*r,r,r-�canonical_namer/zBaseDistribution.canonical_namecCr&r'r(r*r,r,r-rTr/zBaseDistribution.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.
        �-�_)rS�replacer*r,r,r-�setuptools_filenamesz$BaseDistribution.setuptools_filenamec
Csrz|�t�}Wn
tyYdSwzt�|�WSttjtfy8}zt	�
dt|j|�WYd}~dSd}~ww)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�warningrj)r+�content�er,r,r-rX&s*�����zBaseDistribution.direct_urlc
CsPz|�d�}Wn
tttfyYdSw|��D]}|��}|r%|SqdS)N�	INSTALLER�)ro�OSError�
ValueErrorr�
splitlines�strip)r+�installer_text�line�cleaned_liner,r,r-�	installer@s��zBaseDistribution.installercCs
|�d�S)N�	REQUESTED)r_r*r,r,r-�	requestedL�
zBaseDistribution.requestedcC�
t|j�Sr')�boolr\r*r,r,r-�editablePr�zBaseDistribution.editablecCs|jdurdSt|j�S)z|If distribution is installed in the current virtual environment.

        Always True if we're not in a virtualenv.
        NF)r]rr*r,r,r-�localTs

zBaseDistribution.localcC�&|jdus	tdurdS|j�tt��S�NF)r]r�
startswithrr*r,r,r-�in_usersite^�zBaseDistribution.in_usersitecCr�r�)r]rr�rr*r,r,r-�in_site_packagesdr�z!BaseDistribution.in_site_packages�pathcCr&)z7Check whether an entry in the info directory is a file.r(�r+r�r,r,r-r_jr/zBaseDistribution.is_filecCr&)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_namesnrHz,BaseDistribution.iter_distutils_script_namescCr&)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-rov�zBaseDistribution.read_textcCr&r'r(r*r,r,r-�iter_entry_points�z"BaseDistribution.iter_entry_pointscCr&r'r(r*r,r,r-�_metadata_impl�r�zBaseDistribution._metadata_implr!)�maxsizecCs|��}|�|�|Sr')r��_add_egg_info_requires)r+�metadatar,r,r-�_metadata_cached�s
z!BaseDistribution._metadata_cachedcCs|��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�r*r,r,r-r��s	zBaseDistribution.metadatacCr�)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�sz!BaseDistribution.metadata_versioncCs|j�d|j�S)z*Value of "Name:" in distribution metadata.�Name)r�r�rjr*r,r,r-rS�szBaseDistribution.raw_namec
Csl|j�d�}|dur
t�Sz	tt|��}W|Sty5}zd}t�||j|�t�WYd}~Sd}~ww)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�rr6rrurvrS)r+r0�specrx�messager,r,r-�requires_python�s���z BaseDistribution.requires_pythonr,�extrascCr&)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�rHz"BaseDistribution.iter_dependenciescCr&)z�Extras provided by this distribution.

        For modern .dist-info distributions, this is the collection of
        "Provides-Extra:" entries in distribution metadata.
        r(r*r,r,r-�iter_provided_extras�rHz%BaseDistribution.iter_provided_extrascCs<z|�d�}Wn
tyYdSwdd�t�|���D�S)N�RECORDcss"�|]}tt�|d��VqdS)rNr;)�.0�rowr,r,r-�	<genexpr>�s� zFBaseDistribution._iter_declared_entries_from_record.<locals>.<genexpr>)rorp�csv�readerr})r+�textr,r,r-�"_iter_declared_entries_from_record�s�z3BaseDistribution._iter_declared_entries_from_recordcs�z|�d�}Wn
tyYdSwdd�|jdd�D�}|j}|j}|dus+|dur-|Sz
t�|��|��WntyB|YSw�j	sH|S�fdd�|D�S)Nzinstalled-files.txtcss�|]}|r|VqdSr'r,�r��pr,r,r-r��s�zFBaseDistribution._iter_declared_entries_from_legacy.<locals>.<genexpr>F)�keependsc3s$�|]
}tt�|�j�j�VqdSr')r>r<r=�partsr���info_relr,r-r��s
��
�)
rorpr}rUr^r<r=�relative_tor|r�)r+r��paths�rootr8r,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�}Wn
tyYdSwd}}|��D],}|��}|r(|�d�r)q|�d�r?|�d�r?|�d��d�\}}}qt|||d	�VqdS)
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.txtNrz�#�[�]z[]�:)r@rArB)rorpr}r~r�rb�	partitionr?)r+rwrArBr�rlr,r,r-�_iter_requires_txt_entries�s ���z+BaseDistribution._iter_requires_txt_entriesccs:�dh}|��D]}|j|vrq|�|j�|jVqdS)z'Get extras from the egg-info directory.rzN)r�rA�add)r+�known_extrasr7r,r,r-�_iter_egg_info_extrass�

�z&BaseDistribution._iter_egg_info_extrasccs��|��D]<}|jr|jrd|j�dt|j��d�}n|jr(dt|j��d�}n	|jr/|j}nd}|r=|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 == "rzz ; N)r�rArBrr@)r+r7rBr,r,r-�_iter_egg_info_dependencies!s�

�z,BaseDistribution._iter_egg_info_dependenciesr�NcCsH|�d�s|��D]}||d<q	|�d�s |��D]}||d<qdSdS)z6Add egg-info requires.txt information to the metadata.z
Requires-DistzProvides-ExtraN)�get_allr�r�)r+r��deprAr,r,r-r�<s



�z'BaseDistribution._add_egg_info_requires)r,)Fr2r3r4�classmethodr6rG�bytesrLrOrVrWr5rrUr\r]r^r�rardrhrirrj�DistributionVersionrTrnrrXr�r�r�r�r�r��InfoPathr_r	r�rorr$r��emailr��Messager��	functools�	lru_cacher�r�rrr�r�rSrr�rrr�r�r�r�r�r?r�r�r�r�r,r,r,r-rDks�����

		


	rDc@s�eZdZdZeddd��Zedeeeddfdd��Z	deded	fd
d�Z
ded	fdd
�Zdee
fdd�Zdedddfdedeededededee
fdd�ZdS)�BaseEnvironmentz6An environment containing distributions to introspect.r%cCr&r'r()rFr,r,r-�defaultIr/zBaseEnvironment.defaultr�cCr&r'r()rFr�r,r,r-�
from_pathsMr/zBaseEnvironment.from_pathsr.rDcCr&)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_distributionQrHz BaseEnvironment.get_distributioncCr&)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.
        r(r*r,r,r-�_iter_distributionsYr�z#BaseEnvironment._iter_distributionsccsF�|��D]}tjd|jtjd�}|st�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�matchrj�
IGNORECASErurvrU)r+�dist�project_name_validr,r,r-�iter_all_distributionsbs ����z&BaseEnvironment.iter_all_distributionsTF�
local_only�skip�include_editables�editables_only�	user_onlycsb|��}|r
dd�|D�}|sdd�|D�}|rdd�|D�}|r(dd�|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.
        cs��|]}|jr|VqdSr')r��r��dr,r,r-r����z?BaseEnvironment.iter_installed_distributions.<locals>.<genexpr>css�|]}|js|VqdSr'�r�r�r,r,r-r��r�csr�r'r�r�r,r,r-r��r�csr�r')r�r�r,r,r-r��r�c3s�|]
}|j�vr|VqdSr')rjr��r�r,r-r��s�)r�)r+r�r�r�r�r��itr,r�r-�iter_installed_distributionswsz,BaseEnvironment.iter_installed_distributionsN)r%r�)r2r3r4�__doc__r�r�rr
r6r�r�r	r�rDr�rr�rr�r,r,r,r-r�Fs6	�������r�c@s&eZdZUeed<dejfdd�ZdS)rNrUr%cCr&r'r(r*r,r,r-�
as_zipfile�r�zWheel.as_zipfileN)r2r3r4r6rC�zipfile�ZipFiler�r,r,r,r-rN�s
rNc@s.eZdZdeddfdd�Zdejfdd�ZdS)�FilesystemWheelrUr%NcCs
||_dSr')rUrcr,r,r-�__init__�s
zFilesystemWheel.__init__cC�tj|jdd�S�NT)�
allowZip64)r�r�rUr*r,r,r-r���zFilesystemWheel.as_zipfile)r2r3r4r6r�r�r�r�r,r,r,r-r��sr�c@s6eZdZdedeeddfdd�Zdejfdd�Z	dS)	�MemoryWheelrU�streamr%NcCs||_||_dSr')rUr�)r+rUr�r,r,r-r��s
zMemoryWheel.__init__cCr�r�)r�r�r�r*r,r,r-r��r�zMemoryWheel.as_zipfile)
r2r3r4r6rr�r�r�r�r�r,r,r,r-r��sr�)Hr��
email.messager�r�rs�loggingr<r�r��typingrrrrrrrr	r
rrr
r�"pip._vendor.packaging.requirementsrZ pip._vendor.packaging.specifiersrrZpip._vendor.packaging.utilsrZpip._vendor.packaging.versionrr�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.packagingr�pip._internal.utils.urlsr �_jsonr"r#�objectr�r6�PurePathr��	getLoggerr2rur$r>r?rDr�rNr�r�r,r,r,r-�<module>sZ<

�
�
�^U