Your IP : 3.139.239.25


Current Path : /opt/alt/python312/lib64/python3.12/importlib/metadata/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/importlib/metadata/__pycache__/__init__.cpython-312.opt-1.pyc

�

�Q�fUp��8�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlmZmZddlmZmZddlmZmZddlmZmZddlmZmZddlmZdd	l m!Z!dd
l"m#Z#ddlm$Z$ddl%m&Z&m'Z'm(Z(m)Z)gd
�Z*Gd�de+�Z,Gd�d�Z-Gd�d�Z.Gd�de.�Z/Gd�de0�Z1Gd�dejd�Z3Gd�d�Z4Gd�d�Z5Gd�de5�Z6Gd �d!e#�Z7Gd"�d#�Z8Gd$�d%�Z9Gd&�d'�Z:Gd(�d)e7�Z;Gd*�d+e6�Z<d,�Z=d-�Z>d.ej:fd/�Z?d0�Z@ej�eej�d1��2�ZC	d.e1fd3�ZDd4�ZEd5�ZFd.e'eGe&eGffd6�ZHd7�ZId8�ZJy)9�N�)�	_adapters�_meta)�FreezableDefaultDict�Pair)�method_cache�	pass_none)�always_iterable�unique_everseen)�PackageMetadata�
SimplePath)�suppress)�
import_module)�MetaPathFinder)�starmap)�List�Mapping�Optional�cast)�Distribution�DistributionFinderr�PackageNotFoundError�distribution�
distributions�entry_points�files�metadata�packages_distributions�requires�versionc�&�eZdZdZd�Zed��Zy)rzThe package was not found.c� �d|j��S)Nz"No package metadata was found for ��name��selfs �B/opt/alt/python312/lib64/python3.12/importlib/metadata/__init__.py�__str__zPackageNotFoundError.__str__3s��3�D�I�I�;�?�?�c�"�|j\}|S�N)�args�r&r$s  r'r$zPackageNotFoundError.name6s���)�)����r)N)�__name__�
__module__�__qualname__�__doc__r(�propertyr$�r)r'rr0s��$�@����r)rc��eZdZdZej
d�j
�Zed��Z	e
dd��Ze
d��Zy)�	Sectioneda�
    A simple entry point config parser for performance

    >>> for item in Sectioned.read(Sectioned._sample):
    ...     print(item)
    Pair(name='sec1', value='# comments ignored')
    Pair(name='sec1', value='a = 1')
    Pair(name='sec1', value='b = 2')
    Pair(name='sec2', value='a = 2')

    >>> res = Sectioned.section_pairs(Sectioned._sample)
    >>> item = next(res)
    >>> item.name
    'sec1'
    >>> item.value
    Pair(name='a', value='1')
    >>> item = next(res)
    >>> item.value
    Pair(name='b', value='2')
    >>> item = next(res)
    >>> item.name
    'sec2'
    >>> item.value
    Pair(name='a', value='2')
    >>> list(res)
    []
    zm
        [sec1]
        # comments ignored
        a = 1
        b = 2

        [sec2]
        a = 2
        c�J�d�|j||j��D�S)Nc3�K�|]?}|j�1|jtj|j������Ay�w)N)�value)r$�_replacer�parser8)�.0�sections  r'�	<genexpr>z*Sectioned.section_pairs.<locals>.<genexpr>gs=����
�<���|�|�'�
���4�:�:�g�m�m�#<��=�<�s�AA)�filter_)�read�valid)�cls�texts  r'�
section_pairszSectioned.section_pairses%��
��8�8�D�#�)�)�8�<�
�	
r)Nc#�K�t|ttj|j	���}d}|D]H}|jd�xr|j
d�}|r|jd�}�;t||����Jy�w)N�[�]z[])�filter�map�str�strip�
splitlines�
startswith�endswithr)rBr>�linesr$r8�
section_matchs      r'r?zSectioned.readmsr�����w��C�I�I�t���/@� A�B�����E�!�,�,�S�1�I�e�n�n�S�6I�M���{�{�4�(����t�U�#�#��s�BBc�.�|xr|jd�S)N�#)rL)�lines r'r@zSectioned.validxs���0�D�O�O�C�0�0�0r)r+)
r.r/r0r1�textwrap�dedent�lstrip�_sample�classmethodrC�staticmethodr?r@r3r)r'r5r5<sf���8�h�o�o�	�
�
�f�h���
��
��$��$��1��1r)r5c�V�eZdZdZej
ejded��Z	d�Z
y)�DeprecatedTuplea
    Provide subscript item access for backward compatibility.

    >>> recwarn = getfixture('recwarn')
    >>> ep = EntryPoint(name='name', value='value', group='group')
    >>> ep[:]
    ('name', 'value', 'group')
    >>> ep[0]
    'name'
    >>> len(recwarn)
    1
    zAEntryPoint tuple interface is deprecated. Access members by name.���
stacklevelc�H�|j�|j�|Sr+)�_warn�_key)r&�items  r'�__getitem__zDeprecatedTuple.__getitem__�s���
�
���y�y�{�4� � r)N)r.r/r0r1�	functools�partial�warnings�warn�DeprecationWarningr_rbr3r)r'rZrZ}s0���
�I����
�
�K���	
�E�!r)rZc���eZdZUdZej
d�Z	eed<eed<eed<dZ	e
ded<d	�Zd
�Ze
d��Ze
d��Ze
d
��Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�
EntryPointa�An entry point as defined by Python packaging conventions.

    See `the packaging docs on entry points
    <https://packaging.python.org/specifications/entry-points/>`_
    for more information.

    >>> ep = EntryPoint(
    ...     name=None, group=None, value='package.module:attr [extra1, extra2]')
    >>> ep.module
    'package.module'
    >>> ep.attr
    'attr'
    >>> ep.extras
    ['extra1', 'extra2']
    zH(?P<module>[\w.]+)\s*(:\s*(?P<attr>[\w.]+)\s*)?((?P<extras>\[.*\])\s*)?$r$r8�groupNr�distc�>�t|�j|||��y)N�r$r8rj��vars�update)r&r$r8rjs    r'�__init__zEntryPoint.__init__�s���T�
���t�5���>r)c��|jj|j�}t|j	d��}td|j	d�xsdj
d��}tjt||�S)z�Load the entry point from its definition. If only a module
        is indicated by the value, return that module. Otherwise,
        return the named object.
        �moduleN�attr��.)
�pattern�matchr8rrjrG�splitrc�reduce�getattr)r&rxrs�attrss    r'�loadzEntryPoint.load�si��
���"�"�4�:�:�.���u�{�{�8�4�5���t�e�k�k�&�1�7�R�>�>�s�C�D��������7�7r)c�n�|jj|j�}|jd�S)Nrs�rwrxr8rj�r&rxs  r'rszEntryPoint.module�s)�����"�"�4�:�:�.���{�{�8�$�$r)c�n�|jj|j�}|jd�S)Nrtrr�s  r'rtzEntryPoint.attr�s)�����"�"�4�:�:�.���{�{�6�"�"r)c��|jj|j�}tjd|jd�xsd�S)Nz\w+�extrasru)rwrxr8�re�findallrjr�s  r'r�zEntryPoint.extras�s9�����"�"�4�:�:�.���z�z�&�%�+�+�h�"7�"=�2�>�>r)c�<�t|�j|��|S)N�rkrn)r&rks  r'�_forzEntryPoint._for�s���T�
���t��$��r)c�~���fd�|D�}tttj|j	�|��S)a$
        EntryPoint matches the given parameters.

        >>> ep = EntryPoint(group='foo', name='bar', value='bing:bong [extra1, extra2]')
        >>> ep.matches(group='foo')
        True
        >>> ep.matches(name='bar', value='bing:bong [extra1, extra2]')
        True
        >>> ep.matches(group='foo', name='other')
        False
        >>> ep.matches()
        True
        >>> ep.matches(extras=['extra1', 'extra2'])
        True
        >>> ep.matches(module='bing')
        True
        >>> ep.matches(attr='bong')
        True
        c3�6�K�|]}t�|����y�wr+�r{)r;�paramr&s  �r'r=z%EntryPoint.matches.<locals>.<genexpr>�s�����:�6�%���u�%�6�s�)�allrH�operator�eq�values)r&�paramsr|s`  r'�matcheszEntryPoint.matches�s-���(;�6�:���3�x�{�{�F�M�M�O�U�;�<�<r)c�H�|j|j|jfSr+rmr%s r'r`zEntryPoint._key�s���y�y�$�*�*�d�j�j�0�0r)c�D�|j�|j�kSr+�r`�r&�others  r'�__lt__zEntryPoint.__lt__�s���y�y�{�U�Z�Z�\�)�)r)c�D�|j�|j�k(Sr+r�r�s  r'�__eq__zEntryPoint.__eq__s���y�y�{�e�j�j�l�*�*r)c��td��)Nz!EntryPoint objects are immutable.)�AttributeError)r&r$r8s   r'�__setattr__zEntryPoint.__setattr__s���@�A�Ar)c�V�d|j�d|j�d|j�d�S)NzEntryPoint(name=z, value=z, group=�)rmr%s r'�__repr__zEntryPoint.__repr__s2���t�y�y�m�8�D�J�J�>�B��Z�Z�N�!�
%�	
r)c�4�t|j��Sr+)�hashr`r%s r'�__hash__zEntryPoint.__hash__
s���D�I�I�K� � r))r.r/r0r1r��compilerwrI�__annotations__rkrrqr}r2rsrtr�r�r�r`r�r�r�r�r�r3r)r'riri�s���� �b�j�j�	%��G�
� �I��J��J�%)�D�(�>�
"�)�?�8��%��%��#��#��?��?��=�.1�*�+�B�
�!r)ric�`�eZdZdZdZd�Zd�Zed��Zed��Z	e
d��Zed��Z
y	)
�EntryPointszC
    An immutable collection of selectable EntryPoint objects.
    r3c�|�	tt|j|����S#t$rt	|��wxYw)z;
        Get the EntryPoint in self matching name.
        r#)�next�iter�select�
StopIteration�KeyErrorr-s  r'rbzEntryPoints.__getitem__s;��	!���T�[�[�d�[�3�4�5�5���	!��4�.� �	!�s�#&�;c�,��t�fd�|D��S)zv
        Select entry points from self that match the
        given parameters (typically group and/or name).
        c3�H�K�|]}|jdi���s�|���y�w)Nr3)r�)r;�epr�s  �r'r=z%EntryPoints.select.<locals>.<genexpr>&s"�����E��"�
��
�
�0D�V�0D�2��s�"�")r�)r&r�s `r'r�zEntryPoints.select!s���
�E��E�E�Er)c�@�|D�chc]}|j��c}Scc}w)zB
        Return the set of all names of all entry points.
        r#�r&r�s  r'�nameszEntryPoints.names(s ��
#'�'�$�B����$�'�'��'��c�@�|D�chc]}|j��c}Scc}w)zC
        Return the set of all groups of all entry points.
        )rjr�s  r'�groupszEntryPoints.groups/s ��
$(�(�4�R����4�(�(��(r�c�D��|�fd�|j|�D��S)Nc3�@�K�|]}|j�����y�wr+)r�)r;r�rks  �r'r=z-EntryPoints._from_text_for.<locals>.<genexpr>8s�����@�+?�R�2�7�7�4�=�+?���)�
_from_text)rArBrks  `r'�_from_text_forzEntryPoints._from_text_for6s����@�3�>�>�$�+?�@�@�@r)c�B�d�tj|xsd�D�S)Nc3�K�|]D}t|jj|jj|j�����Fy�w)rmN)rir8r$)r;ras  r'r=z)EntryPoints._from_text.<locals>.<genexpr><s:����
�;��
�D�J�J�O�O�4�:�:�3C�3C�4�9�9�U�U�;�s�A
Aru)r5rC)rBs r'r�zEntryPoints._from_text:s#��
�!�/�/��
��;�
�	
r)N)r.r/r0r1�	__slots__rbr�r2r�r�rWr�rXr�r3r)r'r�r�sk����I�!�F��(��(��)��)��A��A��
��
r)r�c�$�eZdZdZdd�Zd�Zd�Zy)�PackagePathz"A reference to a path in a packagec��|j�j|��5}|j�cddd�S#1swYyxYw)N��encoding��locate�openr?)r&r��streams   r'�	read_textzPackagePath.read_textEs5��
�[�[�]�
�
��
�
2�f��;�;�=�	!�	!�
2�
2�s	�;�Ac��|j�jd�5}|j�cddd�S#1swYyxYw)N�rbr�)r&r�s  r'�read_binaryzPackagePath.read_binaryIs2��
�[�[�]�
�
��
%���;�;�=�	!�	!�
%�
%�s	�:�Ac�8�|jj|�S)z'Return a path-like object for this path)rk�locate_filer%s r'r�zPackagePath.locateMs���y�y�$�$�T�*�*r)N)�utf-8)r.r/r0r1r�r�r�r3r)r'r�r�Bs��,�!�!�+r)r�c��eZdZd�Zd�Zy)�FileHashc�B�|jd�\|_}|_y)N�=)�	partition�moder8)r&�spec�_s   r'rqzFileHash.__init__Ss��#'�>�>�#�#6� ��	�1�d�jr)c�<�d|j�d|j�d�S)Nz<FileHash mode: z value: �>)r�r8r%s r'r�zFileHash.__repr__Vs��!�$�)�)��H�T�Z�Z�L��B�Br)N)r.r/r0rqr�r3r)r'r�r�Rs
��7�Cr)r�c���eZdZ�fd�Z�xZS)�DeprecatedNonAbstractc	�.��tj|�D��chc]}t|�D]}|���}}}|D�chc]}tt||�dd�r|��}}|rt	j
d|��td��t�|�!|�Scc}}wcc}w)N�__isabstractmethod__FzUnimplemented abstract methods r[r\)	�inspect�getmroror{rerfrg�super�__new__)rAr,�kwargs�subclassr$�	all_names�abstract�	__class__s       �r'r�zDeprecatedNonAbstract.__new__[s����!(����!4�
�!4�X��h���D��D�!4�	�
�
"�
�!���w�s�D�)�+A�5�I�
�!�	�
�
��M�M�1�(��<�"��
�
�w��s�#�#��
��
s
�B� B)r.r/r0r��
__classcell__�r�s@r'r�r�Zs
���$�$r)r�c�r�eZdZdZej
deefd��Zej
d��Z	e
defd��Ze
d��Ze
d��Ze
d	��Zedej$fd
��Zed��Zed��Zed
��Zed��Zed��Zd�Zd�Zd�Zed��Zd�Zd�Ze
d��Ze
d��Z y)rzA Python distribution package.�returnc��y)z�Attempt to load metadata file given by the name.

        :param filename: The name of the file in the distribution info.
        :return: The text if found, otherwise None.
        Nr3�r&�filenames  r'r�zDistribution.read_textp��r)c��y)z[
        Given a path to a file in this distribution, return a path
        to it.
        Nr3�r&�paths  r'r�zDistribution.locate_filexr�r)r$c��|std��	t|j|���S#t$rt	|��wxYw)a�Return the Distribution for the given package name.

        :param name: The name of the distribution package to search for.
        :return: The Distribution instance (or subclass thereof) for the named
            package, if found.
        :raises PackageNotFoundError: When the named package's distribution
            metadata cannot be found.
        :raises ValueError: When an invalid value is supplied for name.
        z A distribution name is required.r#)�
ValueErrorr��discoverr�r)rAr$s  r'�	from_namezDistribution.from_namesH����?�@�@�	-�����$��/�0�0���	-�&�t�,�,�	-�s�*�?c����|jdd���r
|rtd���xstjdi|���tj
j
�fd�|j�D��S)aReturn an iterable of Distribution objects for all packages.

        Pass a ``context`` or pass keyword arguments for constructing
        a context.

        :context: A ``DistributionFinder.Context`` object.
        :return: Iterable of Distribution objects for all packages.
        �contextNz cannot accept context and kwargsc3�.�K�|]}|�����y�wr+r3)r;�resolverr�s  �r'r=z(Distribution.discover.<locals>.<genexpr>�s�����-
�.G�(�H�W��.G�s�r3)�popr�r�Context�	itertools�chain�
from_iterable�_discover_resolvers)rAr�r�s  @r'r�zDistribution.discover�sl����*�*�Y��-���v��?�@�@��A�/�7�7�A�&�A�����,�,�-
�.1�.E�.E�.G�-
�
�	
r)c�>�ttj|��S)z�Return a Distribution for the indicated metadata path

        :param path: a string or path-like object
        :return: a concrete Distribution instance for the path
        )�PathDistribution�pathlib�Path�r�s r'�atzDistribution.at�s�� ����T� 2�3�3r)c�H�d�tjD�}td|�S)z#Search the meta_path for resolvers.c3�6K�|]}t|dd����y�w)�find_distributionsNr�)r;�finders  r'r=z3Distribution._discover_resolvers.<locals>.<genexpr>�s����
�FS�F�G�F�0�$�7�m�s�N)�sys�	meta_pathrG)�declareds r'r�z Distribution._discover_resolvers�s$��
�FI�m�m�
���d�H�%�%r)c���|jd�xs$|jd�xs|jd�}tt|�}tjtj|��S)z�Return the parsed metadata for this Distribution.

        The returned object will have keys that name the various bits of
        metadata.  See PEP 566 for details.
        �METADATAzPKG-INFOru)r�rrIr�Message�email�message_from_string)r&�opt_textrBs   r'rzDistribution.metadata�sc��
�N�N�:�&�
"��~�~�j�)�
"�
�~�~�b�!�
	��C��"��� � ��!:�!:�4�!@�A�Ar)c� �|jdS)z8Return the 'Name' metadata for the distribution package.�Name�rr%s r'r$zDistribution.name�s���}�}�V�$�$r)c�@�tj|j�S)z(Return a normalized version of the name.)�Prepared�	normalizer$r%s r'�_normalized_namezDistribution._normalized_name�s���!�!�$�)�)�,�,r)c� �|jdS)z;Return the 'Version' metadata for the distribution package.�Versionrr%s r'r zDistribution.version�s���}�}�Y�'�'r)c�L�tj|jd�|�S)Nzentry_points.txt)r�r�r�r%s r'rzDistribution.entry_points�s���)�)�$�.�.�9K�*L�d�S�Sr)c�����d�fd�	�t�fd��}td��}||�j�xs"�j�xs�j���S)aZFiles in this distribution.

        :return: List of PackagePath for this distribution or None

        Result is `None` if the metadata file that enumerates files
        (i.e. RECORD for dist-info, or installed-files.txt or
        SOURCES.txt for egg-info) is missing.
        Result may be empty if the metadata exists but is empty.
        c�|��t|�}|rt|�nd|_|rt|�nd|_�|_|Sr+)r�r�r��int�sizerk)r$r��size_str�resultr&s    �r'�	make_filez%Distribution.files.<locals>.make_file�s7��� ��&�F�,0�(�4�.�d�F�K�+3�#�h�-��F�K��F�K��Mr)c�B��t�tj|��Sr+)r�csv�reader)rNr"s �r'�
make_filesz&Distribution.files.<locals>.make_files�s����9�c�j�j��&7�8�8r)c�.�ttd�|��S)Nc�>�|j�j�Sr+)r��existsrs r'�<lambda>z@Distribution.files.<locals>.skip_missing_files.<locals>.<lambda>�s��D�K�K�M�,@�,@�,Br))�listrG)�
package_pathss r'�skip_missing_filesz.Distribution.files.<locals>.skip_missing_files�s����B�M�R�S�Sr))NN)r	�_read_files_distinfo�_read_files_egginfo_installed�_read_files_egginfo_sources)r&r&r-r"s`  @r'rzDistribution.files�sw���	�
�	9�
�	9�
�	T�
�	T�"���)�)�+�6��5�5�7�6��3�3�5�
�
�	
r)c�L�|jd�}|xr|j�S)z*
        Read the lines of RECORD
        �RECORD)r�rK�r&rBs  r'r.z!Distribution._read_files_distinfo�s$���~�~�h�'���)����)�)r)c�����jd�}t�dd��|r�sy��fd�|j�D�}tdj|�S)a�
        Read installed-files.txt and return lines in a similar
        CSV-parsable format as RECORD: each file must be placed
        relative to the site-packages directory and must also be
        quoted (since file names can contain literal commas).

        This file is written when the package is installed by pip,
        but it might not be written for other installation methods.
        Assume the file is accurate if it exists.
        zinstalled-files.txt�_pathNc3��K�|]S}�|zj�j�jd�j�d��j����Uy�w)ruT)�walk_upN)�resolve�relative_tor��as_posix)r;r$r&�subdirs  ��r'r=z=Distribution._read_files_egginfo_installed.<locals>.<genexpr>sV�����
�
*��	�d�]�
�W�Y�
�[��)�)�"�-�5�5�7��[�
F�
�X�Z�
�*�s�AA�"{}")r�r{rKrH�format)r&rB�pathsr;s`  @r'r/z*Distribution._read_files_egginfo_installedsW����~�~�3�4����w��-���6��
�
���)�
���6�=�=�%�(�(r)c�t�|jd�}|xr$tdj|j��S)a�
        Read SOURCES.txt and return lines in a similar CSV-parsable
        format as RECORD: each file name must be quoted (since it
        might contain literal commas).

        Note that SOURCES.txt is not a reliable source for what
        files are installed by a package. This file is generated
        for a source archive, and the files that are present
        there (e.g. setup.py) may not correctly reflect the files
        that are present after the package has been installed.
        zSOURCES.txtr<)r�rHr=rKr3s  r'r0z(Distribution._read_files_egginfo_sourcess/���~�~�m�,���=��F�M�M�4�?�?�+<�=�=r)c�d�|j�xs|j�}|xrt|�S)z6Generated requirements specified for this Distribution)�_read_dist_info_reqs�_read_egg_info_reqsr+)r&�reqss  r'rzDistribution.requires.s/���(�(�*�H�d�.F�.F�.H���"��T�
�"r)c�8�|jjd�S)Nz
Requires-Dist)r�get_allr%s r'rAz!Distribution._read_dist_info_reqs4s���}�}�$�$�_�5�5r)c�Z�|jd�}t|j�|�S)Nzrequires.txt)r�r	�_deps_from_requires_text)r&�sources  r'rBz Distribution._read_egg_info_reqs7s(������/��7�y��6�6�7��?�?r)c�J�|jtj|��Sr+)�%_convert_egg_info_reqs_to_simple_reqsr5r?)rArHs  r'rGz%Distribution._deps_from_requires_text;s���8�8�����9O�P�Pr)c#��K�d���fd�}d�}|D]8}||j�}|j|z||j�z���:y�w)a�
        Historically, setuptools would solicit and store 'extra'
        requirements, including those with environment markers,
        in separate sections. More modern tools expect each
        dependency to be defined separately, with any relevant
        extras and environment markers attached directly to that
        requirement. This method converts the former to the
        latter. See _test_deps_from_requires_text for an example.
        c��|xrd|�d�S)Nz
extra == "�"r3r#s r'�make_conditionzJDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.make_conditionKs���0�j���a�0�0r)c	���|xsd}|jd�\}}}|r|rd|�d�}ttd|�|�g��}|rddj|�zSdS)Nru�:�(r�z; z and )r�r+rG�join)r<�extra�sep�markers�
conditionsrNs     �r'�
quoted_markerzIDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.quoted_markerNsk����m��G�")�"3�"3�C�"8��E�3�����g�Y�a�.���f�T�G�^�E�5J�+K�L�M�J�6@�4�'�,�,�z�2�2�H�b�Hr)c��dd|vzS)z�
            PEP 508 requires a space between the url_spec and the quoted_marker.
            Ref python/importlib_metadata#357.
            � �@r3)�reqs r'�
url_req_spacezIDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.url_req_spaceVs���#��*�%�%r)N)r8r$)�sectionsrWr\r<�spacerNs     @r'rJz2Distribution._convert_egg_info_reqs_to_simple_reqs?sN�����	1�	I�	&� �G�!�'�-�-�0�E��-�-�%�'�-����*E�E�E� �s�A
A
N)!r.r/r0r1�abc�abstractmethodrrIr�r�rWr�r�rXrr�r2rrrr$rr rrr.r/r0rrArBrGrJr3r)r'rrms~��(�����X�c�]����	�������-�S�-��-�"�
��
�"�4��4��&��&��B�%�/�/�B��B�"�%��%��-��-��(��(��T��T�� 
�� 
�D*�)�8
>��#��#�
6�@��Q��Q�� F�� Fr)rc�V�eZdZdZGd�d�Zeje�fd��Zy)rzJ
    A MetaPathFinder capable of discovering installed distributions.
    c�,�eZdZdZdZ	d�Zed��Zy)�DistributionFinder.Contextaw
        Keyword arguments presented by the caller to
        ``distributions()`` or ``Distribution.discover()``
        to narrow the scope of a search for distributions
        in all DistributionFinders.

        Each DistributionFinder may expect any parameters
        and should attempt to honor the canonical
        parameters defined below when appropriate.
        Nc�8�t|�j|�yr+rn)r&r�s  r'rqz#DistributionFinder.Context.__init__zs����J���f�%r)c�T�t|�jdtj�S)z�
            The sequence of directory path that a distribution finder
            should search.

            Typically refers to Python installed package paths such as
            "site-packages" directories and defaults to ``sys.path``.
            r�)ro�getr	r�r%s r'r�zDistributionFinder.Context.path}s����:�>�>�&�#�(�(�3�3r))r.r/r0r1r$rqr2r�r3r)r'r�rchs,��		���	�
	&�
�	4�
�	4r)r�c��y)z�
        Find distributions.

        Return an iterable of all Distribution instances capable of
        loading the metadata for packages matching the ``context``,
        a DistributionFinder.Context instance.
        Nr3)r&r�s  r'rz%DistributionFinder.find_distributions�r�r)N)r.r/r0r1r�r_r`rr3r)r'rrcs1���4�4�@	���)0����r)rc���eZdZdZej
��fd��Zd�Zd�Zd�Z	d�Z
d�Zed��Z
ed	��Z�xZS)
�FastPathzs
    Micro-optimized class for searching a path for
    children.

    >>> FastPath('').children()
    ['...']
    c�"��t�|�|�Sr+)r�r�)rA�rootr�s  �r'r�zFastPath.__new__�s����w��s�#�#r)c��||_yr+)rk)r&rks  r'rqzFastPath.__init__�s	����	r)c�B�tj|j|�Sr+)rrrk)r&�childs  r'�joinpathzFastPath.joinpath�s���|�|�D�I�I�u�-�-r)c��tt�5tj|jxsd�cddd�S#1swYnxYwtt�5|j�cddd�S#1swYgSxYw�Nrv)r�	Exception�os�listdirrk�zip_childrenr%s r'�childrenzFastPath.children�sW��
�i�
 ��:�:�d�i�i�.�3�/�	0�	0�
 �
 ��
�i�
 ��$�$�&�	'�	'�
 ��	�s�#=�A�A2�2A<c���tj|j�}|jj�}|j|_t
j
d�|D��S)Nc3�bK�|]'}|jtjd�d���)y�w)rrN)ry�	posixpathrT)r;rns  r'r=z(FastPath.zip_children.<locals>.<genexpr>�s%����Q�5�%�U�[�[�����:�1�=�5�s�-/)�zipfilerrk�namelistro�dict�fromkeys)r&�zip_pathr�s   r'ruzFastPath.zip_children�sH���<�<��	�	�*���
�
�&�&�(�� �)�)��
��}�}�Q�5�Q�Q�Qr)c�V�|j|j�j|�Sr+)�lookup�mtime�searchr-s  r'r�zFastPath.search�s ���{�{�4�:�:�&�-�-�d�3�3r)c���tt�5tj|j�j
cddd�S#1swYnxYw|jj�yr+)r�OSErrorrs�statrk�st_mtimer��cache_clearr%s r'r�zFastPath.mtime�sA��
�g�
��7�7�4�9�9�%�.�.�	/�	/�
�
�������!s�)A�Ac��t|�Sr+)�Lookup)r&r�s  r'r�zFastPath.lookup�s���d�|�r))r.r/r0r1rc�	lru_cacher�rqrorvrur�r2r�rr�r�r�s@r'riri�si�����Y����$��$��.��R�4��"��"�
���r)ric��eZdZdefd�Zd�Zy)r�r�c�l�tjj|j�j	�}|jd�}t
t�|_t
t�|_	|j�D]�}|j	�}|jd�ri|jd�djd�d}tj|�}|j|j|j!|����|s��|dk(s��|jd�djd�d}tj#|�}|j|j|j!|����|jj%�|jj%�y)Nz.egg�z
.dist-infoz	.egg-inforvr�-zegg-info)rsr��basenamerk�lowerrMrr+�infos�eggsrv�
rpartitionr�rr�appendro�legacy_normalize�freeze)	r&r��base�base_is_eggrn�lowr$�
normalized�legacy_normalizeds	         r'rqzLookup.__init__�sE���w�w����	�	�*�0�0�2���m�m�F�+��)�$�/��
�(��.��	��]�]�_�E��+�+�-�C��|�|�7�8��~�~�c�*�1�-�7�7��<�Q�?��%�/�/��5�
��
�
�:�&�-�-�d�m�m�E�.B�C���
�!2����s�+�A�.�8�8��=�a�@��$,�$=�$=�d�$C�!��	�	�+�,�3�3�D�M�M�%�4H�I�%�	
�
�
�����	�	���r)c�v�|r|j|jn6tjj	|jj��}|r|j|jn6tjj	|jj��}tj||�Sr+)r�r�r�r�r�r�r�r�)r&�preparedr�r�s    r'r�z
Lookup.search�s����
�J�J�x�*�*�+����.�.�t�z�z�/@�/@�/B�C�	��
�I�I�h�0�0�1����.�.�t�y�y�/?�/?�/A�B�	
�
���u�d�+�+r)N)r.r/r0rirqr�r3r)r'r�r��s���X��*,r)r�c�D�eZdZdZdZdZd�Zed��Zed��Z	d�Z
y)rzE
    A prepared search for metadata on a possibly-named package.
    Nc�p�||_|�y|j|�|_|j|�|_yr+)r$rr�r�r�r-s  r'rqzPrepared.__init__�s4����	��<���.�.��.���!%�!6�!6�t�!<��r)c�l�tjdd|�j�jdd�S)zC
        PEP 503 normalization plus dashes as underscores.
        z[-_.]+r�r�)r��subr��replacer#s r'rzPrepared.normalize�s-��
�v�v�i��d�+�1�1�3�;�;�C��E�Er)c�B�|j�jdd�S)z|
        Normalize the package name as found in the convention in
        older packaging tools versions and specs.
        r�r�)r�r�r#s r'r�zPrepared.legacy_normalize�s���z�z�|�#�#�C��-�-r)c�,�t|j�Sr+)�boolr$r%s r'�__bool__zPrepared.__bool__s���D�I�I��r))r.r/r0r1r�r�rqrXrr�r�r3r)r'rr�sH����J���=��F��F��.��.�r)rc�\�eZdZeej�fd��Zed��Zed��Zy)�MetadataPathFinderc�n�|j|j|j�}tt|�S)a 
        Find distributions.

        Return an iterable of all Distribution instances capable of
        loading the metadata for packages matching ``context.name``
        (or all names if ``None`` indicated) along the paths in the list
        of directories ``context.path``.
        )�
_search_pathsr$r�rHr)rAr��founds   r'rz%MetadataPathFinder.find_distributions	s,���!�!�'�,�,����=���#�U�+�+r)c���t|��tjj�fd�t	t
|�D��S)z1Find metadata directories in paths heuristically.c3�@�K�|]}|j�����y�wr+)r�)r;r�r�s  �r'r=z3MetadataPathFinder._search_paths.<locals>.<genexpr>s�����-
�.B�d�D�K�K��!�.B�r�)rr�r�r�rHri)rAr$r>r�s   @r'r�z MetadataPathFinder._search_pathss9����D�>�����,�,�-
�.1�(�E�.B�-
�
�	
r)c�@�tjj�yr+)rir�r�)rAs r'�invalidate_cachesz$MetadataPathFinder.invalidate_cachess�����$�$�&r)N)	r.r/r0rWrr�rr�r�r3r)r'r�r�sH���(:�(B�(B�(D�
,��
,��
��
��'��'r)r�c���eZdZdefd�Zd�Zej
je_d�Ze	�fd��Z
ed��Z�xZ
S)rr�c��||_y)zfConstruct a distribution.

        :param path: SimplePath indicating the metadata directory.
        N)r5r�s  r'rqzPathDistribution.__init__$s��
��
r)c���tttttt
�5|jj|�jd��cddd�S#1swYyxYw)Nr�r�)	r�FileNotFoundError�IsADirectoryErrorr��NotADirectoryError�PermissionErrorr5ror�r�s  r'r�zPathDistribution.read_text+sR��
������
��:�:�&�&�x�0�:�:�G�:�L�	M�	M�
�
�s�+A�A"c�4�|jj|zSr+)r5�parentr�s  r'r�zPathDistribution.locate_file7s���z�z� � �4�'�'r)c����tjjt|j��}ttj�|j|��xs
t�|�(S)zz
        Performance optimization: where possible, resolve the
        normalized name from the file system path.
        )rsr�r�rIr5r	rr�_name_from_stemr�r)r&�stemr�s  �r'rz!PathDistribution._normalized_name:sS����w�w����D�J�J��0��)�I�h�(�(�)�$�*>�*>�t�*D�E�
(��w�'�	
r)c�~�tjj|�\}}|dvry|jd�\}}}|S)a7
        >>> PathDistribution._name_from_stem('foo-3.0.egg-info')
        'foo'
        >>> PathDistribution._name_from_stem('CherryPy-3.0.dist-info')
        'CherryPy'
        >>> PathDistribution._name_from_stem('face.egg-info')
        'face'
        >>> PathDistribution._name_from_stem('foo.bar')
        r�Nr�)rsr��splitextr�)r�r��extr$rT�rests      r'r�z PathDistribution._name_from_stemFsC�����(�(��.�
��#��1�1��"�,�,�S�1���c�4��r))r.r/r0r
rqr�rr1r�r2rrXr�r�r�s@r'rr#sX����Z��M�%�.�.�6�6�I��(��	
��	
����r)rc�,�tj|�S)z�Get the ``Distribution`` instance for the named package.

    :param distribution_name: The name of the distribution package as a string.
    :return: A ``Distribution`` instance (or subclass thereof).
    )rr���distribution_names r'rrXs���!�!�"3�4�4r)c�,�tjdi|��S)z|Get all ``Distribution`` instances in the current environment.

    :return: An iterable of ``Distribution`` instances.
    r3)rr�)r�s r'rras��
� � �*�6�*�*r)r�c�@�tj|�jS)z�Get the metadata for the named package.

    :param distribution_name: The name of the distribution package to query.
    :return: A PackageMetadata containing the parsed metadata.
    )rr�rr�s r'rris���!�!�"3�4�=�=�=r)c�,�t|�jS)z�Get the version string for the named package.

    :param distribution_name: The name of the distribution package to query.
    :return: The version string for the package as defined in the package's
        "Version" metadata key.
    )rr r�s r'r r rs���)�*�2�2�2r)r)�keyc��tjjd�tt	��D��}t|�jdi|��S)aReturn EntryPoint objects for all installed packages.

    Pass selection parameters (group or name) to filter the
    result to entry points matching those properties (see
    EntryPoints.select()).

    :return: EntryPoints for all installed packages.
    c3�4K�|]}|j���y�wr+)r)r;rks  r'r=zentry_points.<locals>.<genexpr>�s����(�&>�d����&>�s�r3)r�r�r��_uniquerr�r�)r��epss  r'rr�sI���/�/�
'�
'�(�&-�m�o�&>�(��C�#�;�s��"�"�,�V�,�,r)c�,�t|�jS)z�Return a list of files for the named package.

    :param distribution_name: The name of the distribution package to query.
    :return: List of files composing the distribution.
    )rrr�s r'rr�s���)�*�0�0�0r)c�,�t|�jS)z�
    Return a list of requirements for the named package.

    :return: An iterator of requirements, suitable for
        packaging.requirement.Requirement.
    )rrr�s r'rr�s���)�*�3�3�3r)c���tjt�}t�D]@}t	|�xst|�D]#}||j
|jd��%�Bt|�S)z�
    Return a mapping of top-level packages to their
    distributions.

    >>> import collections.abc
    >>> pkgs = packages_distributions()
    >>> all(isinstance(dist, collections.abc.Sequence) for dist in pkgs.values())
    True
    r)	�collections�defaultdictr+r�_top_level_declared�_top_level_inferredr�rr|)�pkg_to_distrk�pkgs   r'rr�sg���)�)�$�/�K����&�t�,�I�0C�D�0I�I�C����#�#�D�M�M�&�$9�:�J� ����r)c�H�|jd�xsdj�S)Nz
top_level.txtru)r�ryr�s r'r�r��s���N�N�?�+�1�r�8�8�:�:r)c���t|j�D�chc]>}t|j�dkDr|jdnt	j
|���@}}td��}t||�Scc}w)Nrrc�
�d|vSrqr3r#s r'�importable_namez,_top_level_inferred.<locals>.importable_name�s���$��r))r
r�len�partsr��
getmodulenamer	rG)rk�f�	opt_namesr�s    r'r�r��s|��!����,��,�A��!�'�'�l�Q�&�����
�G�,A�,A�!�,D�D�,���
�����/�9�-�-��s�AA5)Krsr�r_r$r	rrrzr�rSrercr�ry�
contextlibr�r�rurr�_collectionsrr�
_functoolsrr	�
_itertoolsr
rrr
r�	importlibr�
importlib.abcrr�typingrrrr�__all__�ModuleNotFoundErrorrr5rZri�tupler��
PurePosixPathr�r�r�rrrir�rr�rrrrr rd�
attrgetterr�rrrrIrr�r�r3r)r'�<module>r�s���	�	�
�
�
��������������4�/�8�.��#�(��0�0�
�� 	�.�	�>1�>1�B!�!�6v!��v!�r.
�%�.
�b
+�'�'�'�
+� C�C�$�$�&sF�(�sF�l-��-�`,�,�^!,�!,�H��D'�+�'�62�|�2�j5�+�>�5�#8�#8�>�3��)�
�
������.�/����
-�k�-�1�4����T�#�Y�� 7��";�
.r)

?>