Your IP : 18.218.123.194


Current Path : /opt/alt/python310/lib64/python3.10/importlib/metadata/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/importlib/metadata/__pycache__/__init__.cpython-310.pyc

o

6��f�w�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZmZddlmZddlmZmZddlmZmZddlmZddlmZmZdd	lmZdd
lmZddl m!Z!ddlm"Z"dd
l#m$Z$m%Z%m&Z&m'Z'gd�Z(Gdd�de)�Z*Gdd�d�Z+Gdd�de�,dd��Z-Gdd�de.�Z/Gdd�de/�Z0Gdd�d�Z1Gdd�de1e2�Z3Gdd �d ej4�Z5Gd!d"�d"�Z6Gd#d$�d$�Z7Gd%d&�d&e!�Z8Gd'd(�d(�Z9Gd)d*�d*�Z:Gd+d,�d,�Z;Gd-d.�d.e8�Z<Gd/d0�d0e7�Z=d1d2�Z>d3d4�Z?d5ejfd6d7�Z@d8d9�ZAd5e'e0e3ffd:d;�ZBd<d=�ZCd>d?�ZDd5e%eEe$eEffd@dA�ZFdS)B�N�)�	_adapters�_meta)�PackageMetadata)�FreezableDefaultDict�Pair)�method_cache�	pass_none)�unique_everseen)r�
SimplePath)�suppress)�
import_module)�MetaPathFinder)�starmap)�List�Mapping�Optional�Union)�Distribution�DistributionFinderr�PackageNotFoundError�distribution�
distributions�entry_points�files�metadata�packages_distributions�requires�versionc@s$eZdZdZdd�Zedd��ZdS)rzThe package was not found.cCsd|j��S)Nz"No package metadata was found for ��name��self�r#�B/opt/alt/python310/lib64/python3.10/importlib/metadata/__init__.py�__str__2�zPackageNotFoundError.__str__cCs|j\}|S�N)�args�r"r r#r#r$r 5szPackageNotFoundError.nameN)�__name__�
__module__�__qualname__�__doc__r%�propertyr r#r#r#r$r/s
rc@sDeZdZdZe�d���Zedd��Z	e
d
dd��Ze
dd	��ZdS)�	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
        cCsdd�|j||jd�D�S)Ncss.�|]}|jdur|jt�|j�d�VqdS)N)�value)r �_replacer�parser0)�.0�sectionr#r#r$�	<genexpr>fs�
��z*Sectioned.section_pairs.<locals>.<genexpr>)�filter_)�read�valid��cls�textr#r#r$�
section_pairsds�zSectioned.section_pairsNccsZ�t|ttj|����}d}|D]}|�d�o|�d�}|r$|�d�}qt||�VqdS)N�[�]z[])�filter�map�str�strip�
splitlines�
startswith�endswithr)r;r6�linesr r0Z
section_matchr#r#r$r7ls�
�zSectioned.readcCs|o|�d�S)N�#)rD)�liner#r#r$r8w�zSectioned.validr')
r*r+r,r-�textwrap�dedent�lstripZ_sample�classmethodr<�staticmethodr7r8r#r#r#r$r/;s�
�

r/c@szeZdZUdZe�d�Z	dZede	d<dd�Z
edd	��Zed
d��Z
edd
��Zdd�Zdd�Zdd�Zdd�ZdS)�
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*)?$Nr�distcCsD|j�|j�}t|�d��}td|�d�pd�d��}t�t	||�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�matchr0r
�groupr?�split�	functools�reduce�getattr)r"rVrQ�attrsr#r#r$�load�szEntryPoint.loadcC�|j�|j�}|�d�S)NrQ�rUrVr0rW�r"rVr#r#r$rQ��
zEntryPoint.modulecCr^)NrRr_r`r#r#r$rR�razEntryPoint.attrcCs$|j�|j�}t�d|�d�pd�S)Nz\w+�extrasrS)rUrVr0�re�findallrWr`r#r#r$rb�szEntryPoint.extrascCs
||_|Sr'�rP)r"rPr#r#r$�_for�szEntryPoint._forcCsd}t�|t�t|j|f�S)zP
        Supply iter so one may construct dicts of EntryPoints by name.
        zJConstruction of dict of EntryPoints is deprecated in favor of EntryPoints.)�warnings�warn�DeprecationWarning�iterr )r"�msgr#r#r$�__iter__�s�zEntryPoint.__iter__cCs|j|j|j|jffSr')�	__class__r r0rWr!r#r#r$�
__reduce__�s�zEntryPoint.__reduce__cs(�fdd�|D�}tttj|��|��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
        c3s�|]}t�|�VqdSr'�r[)r3Zparamr!r#r$r5���z%EntryPoint.matches.<locals>.<genexpr>)�allr@�operator�eq�values)r"�paramsr\r#r!r$�matches�szEntryPoint.matches)r*r+r,r-rc�compilerUrPr�__annotations__r]r.rQrRrbrfrlrnrvr#r#r#r$rO|s$
�



rOZEntryPointBasezname value groupcs�eZdZdZdZejejde	dd�Z
�fdd�Z�fdd	�Z�fd
d�Z
�fdd
�Z�fdd�Z�fdd�Z�fdd�Z�fdd�Zdd�Z�fdd�Z�fdd�Zdd�Z�ZS)�DeprecatedLista>
    Allow an otherwise immutable object to implement mutability
    for compatibility.

    >>> recwarn = getfixture('recwarn')
    >>> dl = DeprecatedList(range(3))
    >>> dl[0] = 1
    >>> dl.append(3)
    >>> del dl[3]
    >>> dl.reverse()
    >>> dl.sort()
    >>> dl.extend([4])
    >>> dl.pop(-1)
    4
    >>> dl.remove(1)
    >>> dl += [5]
    >>> dl + [6]
    [1, 2, 5, 6]
    >>> dl + (6,)
    [1, 2, 5, 6]
    >>> dl.insert(0, 0)
    >>> dl
    [0, 1, 2, 5]
    >>> dl == [0, 1, 2, 5]
    True
    >>> dl == (0, 1, 2, 5)
    True
    >>> len(recwarn)
    1
    r#zAEntryPoints list interface is deprecated. Cast to list if needed.���
stacklevelc�|��t�j|i|��Sr')�_warn�super�__setitem__�r"r(�kwargs�rmr#r$r��zDeprecatedList.__setitem__cr}r')r~r�__delitem__r�r�r#r$r�r�zDeprecatedList.__delitem__cr}r')r~r�appendr�r�r#r$r�r�zDeprecatedList.appendcr}r')r~r�reverser�r�r#r$r� r�zDeprecatedList.reversecr}r')r~r�extendr�r�r#r$r�$r�zDeprecatedList.extendcr}r')r~r�popr�r�r#r$r�(r�zDeprecatedList.popcr}r')r~r�remover�r�r#r$r�,r�zDeprecatedList.removecr}r')r~r�__iadd__r�r�r#r$r�0r�zDeprecatedList.__iadd__cCs,t|t�s
|��t|�}|�t|�|�Sr')�
isinstance�tupler~rm�r"�otherr#r#r$�__add__4s
zDeprecatedList.__add__cr}r')r~r�insertr�r�r#r$r�:r�zDeprecatedList.insertcr}r')r~r�sortr�r�r#r$r�>r�zDeprecatedList.sortcCs(t|t�s
|��t|�}t|��|�Sr')r�r�r~�__eq__r�r#r#r$r�Bs
zDeprecatedList.__eq__)r*r+r,r-�	__slots__rY�partialrgrhrir~r�r�r�r�r�r�r�r�r�r�r�r��
__classcell__r#r#r�r$ry�s*�rycsheZdZdZdZ�fdd�Zdd�Zedd��Zed	d
��Z	e
dd��Ze
d
d��Ze
dd��Z�ZS)�EntryPointszC
    An immutable collection of selectable EntryPoint objects.
    r#csTt|t�rtjdtdd�t��|�Sztt|j	|d���WSt
y)t|��w)z;
        Get the EntryPoint in self matching name.
        zGAccessing entry points by index is deprecated. Cast to tuple if needed.rzr{r)r��intrgrhrir�__getitem__�nextrj�select�
StopIteration�KeyErrorr)r�r#r$r�Qs
��zEntryPoints.__getitem__cst�fdd�|D��S)zv
        Select entry points from self that match the
        given parameters (typically group and/or name).
        c3s$�|]
}|jdi���r|VqdS�Nr#)rv�r3Zep�rur#r$r5gs�"z%EntryPoints.select.<locals>.<genexpr>�r��r"rur#r�r$r�bszEntryPoints.selectcC�tdd�|D��S)zB
        Return the set of all names of all entry points.
        cs��|]}|jVqdSr'rr�r#r#r$r5n��z$EntryPoints.names.<locals>.<genexpr>��setr!r#r#r$�namesiszEntryPoints.namescCr�)z�
        Return the set of all groups of all entry points.

        For coverage while SelectableGroups is present.
        >>> EntryPoints().groups
        set()
        csr�r')rWr�r#r#r$r5yr�z%EntryPoints.groups.<locals>.<genexpr>r�r!r#r#r$�groupsp�	zEntryPoints.groupscs|�fdd�|�|�D��S)Nc3��|]}|���VqdSr')rfr�rer#r$r5}rpz-EntryPoints._from_text_for.<locals>.<genexpr>)�
_from_text)r:r;rPr#rer$�_from_text_for{szEntryPoints._from_text_forcCst�t|�|pd��S)NrS)�	itertoolsrrO�
_parse_groupsr9r#r#r$r�szEntryPoints._from_textcCsdd�t�|�D�S)Ncss$�|]
}|jj|jj|jfVqdSr'�r0r )r3�itemr#r#r$r5�s
��
�z,EntryPoints._parse_groups.<locals>.<genexpr>)r/r<)r;r#r#r$r��s�zEntryPoints._parse_groups)r*r+r,r-r�r�r�r.r�r�rMr�r�rNr�r�r#r#r�r$r�Js




r�csreZdZdZejejdedd�Z	�fdd�Z
d�fdd	�	Z�fd
d�Z�fdd
�Z
�fdd�Z�fdd�Z�ZS)�
Deprecateda�
    Compatibility add-in for mapping to indicate that
    mapping behavior is deprecated.

    >>> recwarn = getfixture('recwarn')
    >>> class DeprecatedDict(Deprecated, dict): pass
    >>> dd = DeprecatedDict(foo='bar')
    >>> dd.get('baz', None)
    >>> dd['foo']
    'bar'
    >>> list(dd)
    ['foo']
    >>> list(dd.keys())
    ['foo']
    >>> 'foo' in dd
    True
    >>> list(dd.values())
    ['bar']
    >>> len(recwarn)
    1
    z:SelectableGroups dict interface is deprecated. Use select.rzr{cs|��t��|�Sr')r~rr�r)r�r#r$r���zDeprecated.__getitem__Ncs|��t��||�Sr')r~r�get)r"r �defaultr�r#r$r��szDeprecated.getc�|��t���Sr')r~rrlr!r�r#r$rl��
zDeprecated.__iter__cs|��t�j|�Sr')r~r�__contains__)r"r(r�r#r$r��r�zDeprecated.__contains__cr�r')r~r�keysr!r�r#r$r��r�zDeprecated.keyscr�r')r~rrtr!r�r#r$rt�r�zDeprecated.valuesr')r*r+r,r-rYr�rgrhrir~r�r�rlr�r�rtr�r#r#r�r$r��s�r�csPeZdZdZedd��Ze�fdd��Zedd��Zedd	��Z	d
d�Z
�ZS)�SelectableGroupszs
    A backward- and forward-compatible result from
    entry_points that fully implements the dict interface.
    cCs4t�d�}t||d�}t�||�}|dd�|D��S)NrW��keycss �|]\}}|t|�fVqdSr'r�)r3rW�epsr#r#r$r5�s�z(SelectableGroups.load.<locals>.<genexpr>)rr�
attrgetter�sortedr��groupby)r:r�Zby_groupZorderedZgroupedr#r#r$r]�s
zSelectableGroups.loadcstt|���}ttj�|��S)zH
        Reconstruct a list of all entrypoints from the groups.
        )rr�rtr�r��chain�
from_iterable)r"r�r�r#r$�_all�szSelectableGroups._allcC�|jjSr')r�r�r!r#r#r$r���zSelectableGroups.groupscCr�)zR
        for coverage:
        >>> SelectableGroups().names
        set()
        )r�r�r!r#r#r$r��szSelectableGroups.namescKs|s|S|jjdi|��Sr�)r�r�r�r#r#r$r��szSelectableGroups.select)r*r+r,r-rMr]r.r�r�r�r�r�r#r#r�r$r��s


r�c@s*eZdZdZd
dd�Zdd�Zdd�Zd	S)�PackagePathz"A reference to a path in a package�utf-8cCs<|��j|d��}|��Wd�S1swYdS)N��encoding��locate�openr7)r"r��streamr#r#r$�	read_text�s$�zPackagePath.read_textcCs:|���d��}|��Wd�S1swYdS)N�rbr�)r"r�r#r#r$�read_binary�s$�zPackagePath.read_binarycCs|j�|�S)z'Return a path-like object for this path)rP�locate_filer!r#r#r$r���zPackagePath.locateN)r�)r*r+r,r-r�r�r�r#r#r#r$r��s

r�c@seZdZdd�Zdd�ZdS)�FileHashcCs|�d�\|_}|_dS)N�=)�	partition�moder0)r"�spec�_r#r#r$�__init__�szFileHash.__init__cCsd|j�d|j�d�S)Nz<FileHash mode: z value: �>)r�r0r!r#r#r$�__repr__�szFileHash.__repr__N)r*r+r,r�r�r#r#r#r$r��sr�c@s�eZdZdZejdd��Zejdd��Zedd��Z	edd	��Z
ed
d��Zedd
��Z
ed-dd��Zedejfdd��Zedd��Zedd��Zedd��Zedd��Zedd��Zdd�Zd d!�Zed"d#��Zd$d%�Zd&d'�Zed(d)��Zed*d+��Zd,S).rzA Python distribution package.cC�dS)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.
        Nr#�r"�filenamer#r#r$r��zDistribution.read_textcCr�)z[
        Given a path to a file in this distribution, return a path
        to it.
        Nr#�r"�pathr#r#r$r�
r�zDistribution.locate_filecCsD|��D]}|tj|d��}tt|�d�}|dur|Sqt|��)afReturn 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.
        rN)�_discover_resolversr�Contextr�rjr)r:r �resolverZdistsrPr#r#r$�	from_names
�zDistribution.from_namecsN|�dd���r|rtd���ptjdi|���tj��fdd�|��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 kwargsc3s�|]}|��VqdSr'r#)r3r��r�r#r$r54s�
�z(Distribution.discover.<locals>.<genexpr>r#)r��
ValueErrorrr�r�r�r�r�)r:r�r#r�r$�discover&s
�zDistribution.discovercCstt�|��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�r#r#r$�at8szDistribution.atcCsdd�tjD�}td|�S)z#Search the meta_path for resolvers.css�|]	}t|dd�VqdS)�find_distributionsNro)r3�finderr#r#r$r5Ds�
�z3Distribution._discover_resolvers.<locals>.<genexpr>N)�sys�	meta_pathr?)Zdeclaredr#r#r$r�As�
z Distribution._discover_resolversrTcCs@ddlm}m}|�|�}tj|j||d�}tt�|�	|���S)Nr)�build�meta)Z
source_dir�system)
Zpep517r�r�Z
compat_systemrYr�r��zipfiler�Zbuild_as_zip)r:�rootr�r�r�Zbuilderr#r#r$�_localIs
�zDistribution._local�returncCs.|�d�p|�d�p|�d�}t�t�|��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.
        ZMETADATAzPKG-INFOrS)r�rZMessage�emailZmessage_from_string�r"r;r#r#r$rUs
��zDistribution.metadatacC�
|jdS)z8Return the 'Name' metadata for the distribution package.�Name�rr!r#r#r$r f�
zDistribution.namecCst�|j�S)z(Return a normalized version of the name.)�Prepared�	normalizer r!r#r#r$�_normalized_namekszDistribution._normalized_namecCr�)z;Return the 'Version' metadata for the distribution package.ZVersionr�r!r#r#r$rpr�zDistribution.versioncCst�|�d�|�S)Nzentry_points.txt)r�r�r�r!r#r#r$ruszDistribution.entry_pointscs6���p���}d�fdd�	}|ott|t�|���S)aBFiles 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 SOURCES.txt for egg-info) is
        missing.
        Result may be empty if the metadata exists but is empty.
        Ncs6t|�}|r
t|�nd|_|rt|�nd|_�|_|Sr')r�r��hashr��sizerP)r rZsize_str�resultr!r#r$�	make_file�s
z%Distribution.files.<locals>.make_file)NN)�_read_files_distinfo�_read_files_egginfo�listr�csv�reader)r"Z
file_linesrr#r!r$ryszDistribution.filescCs|�d�}|o
|��S)z*
        Read the lines of RECORD
        ZRECORD)r�rCr�r#r#r$r�s
z!Distribution._read_files_distinfocCs|�d�}|otdj|���S)z`
        SOURCES.txt might contain literal commas, so wrap each line
        in quotes.
        zSOURCES.txtz"{}")r�r@�formatrCr�r#r#r$r�s
z Distribution._read_files_egginfocCs|��p|��}|o
t|�S)z6Generated requirements specified for this Distribution)�_read_dist_info_reqs�_read_egg_info_reqsr)r"Zreqsr#r#r$r�szDistribution.requirescCs|j�d�S)Nz
Requires-Dist)rZget_allr!r#r#r$r�r&z!Distribution._read_dist_info_reqscCs |�d�}|durdS|�|�S)Nzrequires.txt)r��_deps_from_requires_text)r"�sourcer#r#r$r
�s
z Distribution._read_egg_info_reqscCs|�t�|��Sr')�%_convert_egg_info_reqs_to_simple_reqsr/r7)r:rr#r#r$r�rIz%Distribution._deps_from_requires_textc#sL�dd���fdd�}dd�}|D]}||j�}|j|||j�VqdS)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.
        cSs|od|�d�S)Nz
extra == "�"r#rr#r#r$�make_condition�szJDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.make_conditioncsX|pd}|�d�\}}}|r|rd|�d�}ttd|�|�g��}|r*dd�|�SdS)NrS�:�(�)z; z and )r�rr?�join)r4Zextra�sepZmarkersZ
conditions�rr#r$�
quoted_marker�szIDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.quoted_markercSsdd|vS)z�
            PEP 508 requires a space between the url_spec and the quoted_marker.
            Ref python/importlib_metadata#357.
            � �@r#)Zreqr#r#r$�
url_req_space��zIDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.url_req_spaceNr�)Zsectionsrrr4Zspacer#rr$r�s�
�z2Distribution._convert_egg_info_reqs_to_simple_reqsN)rT)r*r+r,r-�abc�abstractmethodr�r�rMr�r�rNr�r�r�r.rrrr rrrrrrrrr
rrr#r#r#r$rsL












rc@s2eZdZdZGdd�d�Zeje�fdd��ZdS)rzJ
    A MetaPathFinder capable of discovering installed distributions.
    c@s*eZdZdZdZ	dd�Zedd��ZdS)zDistributionFinder.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.
        NcKst|��|�dSr')�vars�update)r"r�r#r#r$r���z#DistributionFinder.Context.__init__cCst|��dtj�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�)r r�r�r�r!r#r#r$r��r�zDistributionFinder.Context.path)r*r+r,r-r r�r.r�r#r#r#r$r��sr�cCr�)z�
        Find distributions.

        Return an iterable of all Distribution instances capable of
        loading the metadata for packages matching the ``context``,
        a DistributionFinder.Context instance.
        Nr#)r"r�r#r#r$r��r�z%DistributionFinder.find_distributionsN)r*r+r,r-r�rrr�r#r#r#r$r�s
 rcsheZdZdZe���fdd��Zdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zedd��Z
edd��Z�ZS)�FastPathzF
    Micro-optimized class for searching a path for
    children.
    cst��|�Sr')r�__new__)r:r�r�r#r$r$	r�zFastPath.__new__cCs
||_dSr')r�)r"r�r#r#r$r�
�
zFastPath.__init__cCst�|j|�Sr')r�r�r�)r"�childr#r#r$�joinpath�zFastPath.joinpathcCsltt��t�|jpd�Wd�S1swYtt��|��Wd�S1s/wYgS)NrT)r�	Exception�os�listdirr��zip_childrenr!r#r#r$�childrens
 �
 �zFastPath.childrencCs2t�|j�}|j��}|j|_t�dd�|D��S)Ncss"�|]}|�tjd�dVqdS)rrN)rX�	posixpathr)r3r&r#r#r$r5s� z(FastPath.zip_children.<locals>.<genexpr>)r�r�r�Znamelistr'�dict�fromkeys)r"Zzip_pathr�r#r#r$r,s
zFastPath.zip_childrencCs|�|j��|�Sr')�lookup�mtime�searchr)r#r#r$r3!r"zFastPath.searchcCsDtt��t�|j�jWd�S1swY|j��dSr')r�OSErrorr*�statr��st_mtimer1�cache_clearr!r#r#r$r2$s
 �zFastPath.mtimecCst|�Sr')�Lookup)r"r2r#r#r$r1*r�zFastPath.lookup)r*r+r,r-rY�	lru_cacher$r�r'r-r,r3r.r2rr1r�r#r#r�r$r#s
r#c@s"eZdZdefdd�Zdd�ZdS)r8r�c	Cs�tj�|j���}|�d�}tt�|_tt�|_	|�
�D]J}|��}|�d�rD|�d�d�d�d}t
�|�}|j|�|�|��q|rf|dkrf|�d�d�d�d}t
�|�}|j	|�|�|��q|j��|j	��dS)Nz.egg�z
.dist-infoz	.egg-inforTr�-zegg-info)r*r��basenamer��lowerrErr�infos�eggsr-�
rpartitionr�r�rr�r'�legacy_normalizeZfreeze)	r"r��baseZbase_is_eggr&Zlowr �
normalized�legacy_normalizedr#r#r$r�0s"





�
zLookup.__init__cCsP|r|j|jntj�|j���}|r|j|jntj�|j���}t�||�Sr')r>rCr�r�r�rtr?rD)r"�preparedr>r?r#r#r$r3Es����z
Lookup.searchN)r*r+r,r#r�r3r#r#r#r$r8/sr8c@s@eZdZdZdZdZdd�Zedd��Zedd��Z	d	d
�Z
dS)r�zE
    A prepared search for metadata on a possibly-named package.
    NcCs.||_|dur	dS|�|�|_|�|�|_dSr')r rrCrArDr)r#r#r$r�[s
zPrepared.__init__cCst�dd|����dd�S)zC
        PEP 503 normalization plus dashes as underscores.
        z[-_.]+r;r�)rc�subr=�replacerr#r#r$rbszPrepared.normalizecCs|���dd�S)z|
        Normalize the package name as found in the convention in
        older packaging tools versions and specs.
        r;r�)r=rGrr#r#r$rAiszPrepared.legacy_normalizecCs
t|j�Sr')�boolr r!r#r#r$�__bool__qr%zPrepared.__bool__)r*r+r,r-rCrDr�rNrrArIr#r#r#r$r�Ss

r�c@s4eZdZee��fdd��Zedd��Zdd�ZdS)�MetadataPathFindercCs|�|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�r@r�)r:r��foundr#r#r$r�vs

z%MetadataPathFinder.find_distributionscs(t|��tj��fdd�tt|�D��S)z1Find metadata directories in paths heuristically.c3r�r')r3)r3r��rEr#r$r5�s�

�z3MetadataPathFinder._search_paths.<locals>.<genexpr>)r�r�r�r�r@r#)r:r �pathsr#rMr$rK�s�z MetadataPathFinder._search_pathscCstj��dSr')r#r$r7)r:r#r#r$�invalidate_caches�r(z$MetadataPathFinder.invalidate_cachesN)	r*r+r,rMrr�r�rKrOr#r#r#r$rJus
rJcsTeZdZdefdd�Zdd�Zejje_dd�Ze	�fdd	��Z
ed
d��Z�Z
S)r�r�cCs
||_dS)zfConstruct a distribution.

        :param path: SimplePath indicating the metadata directory.
        N)�_pathr�r#r#r$r��s
zPathDistribution.__init__cCsHtttttt��|j�|�jdd�Wd�S1swYdS)Nr�r�)	r�FileNotFoundError�IsADirectoryErrorr��NotADirectoryError�PermissionErrorrPr'r�r�r#r#r$r��s�$�zPathDistribution.read_textcCs|jj|Sr')rP�parentr�r#r#r$r��r&zPathDistribution.locate_filecs.tj�t|j��}ttj�|�|��pt	�j
S)zz
        Performance optimization: where possible, resolve the
        normalized name from the file system path.
        )r*r�r<rArPr	r�r�_name_from_stemrr)r"�stemr�r#r$r�s�z!PathDistribution._normalized_namecCs0tj�|�\}}|dvrdS|�d�\}}}|S)z�
        >>> 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'
        r:Nr;)r*r��splitextr�)rWr�Zextr r�restr#r#r$rV�s

z PathDistribution._name_from_stem)r*r+r,rr�r�rr-r�r.rrNrVr�r#r#r�r$r��s

r�cCs
t�|�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��Zdistribution_namer#r#r$r��
rcKstjdi|��S)z|Get all ``Distribution`` instances in the current environment.

    :return: An iterable of ``Distribution`` instances.
    Nr#)rr�)r�r#r#r$r�srr�cCst�|�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�rrZr#r#r$r�rrcC�
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.
    )rrrZr#r#r$r��
rcKsJt�d�}tjt|d�}tj�dd�|t��D��}t	�
|�jdi|��S)a�Return 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()).

    For compatibility, returns ``SelectableGroups`` object unless
    selection parameters are supplied. In the future, this function
    will return ``EntryPoints`` instead of ``SelectableGroups``
    even when no selection parameters are supplied.

    For maximum future compatibility, pass selection parameters
    or invoke ``.select`` with parameters on the result.

    :return: EntryPoints or SelectableGroups for all installed packages.
    rr�csr�r')r)r3rPr#r#r$r5�s�
�zentry_points.<locals>.<genexpr>Nr#)rrr�rYr�r
r�r�r�rr�r]r�)ruZ	norm_name�uniquer�r#r#r$r�s
�rcCr\)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.
    )rrrZr#r#r$rr[rcCr\)z�
    Return a list of requirements for the named package.

    :return: An iterator of requirements, suitable for
        packaging.requirement.Requirement.
    )rrrZr#r#r$r	r]rcCsJt�t�}t�D]}|�d�pd��D]}||�|jd�qqt|�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
    z
top_level.txtrSr�)	�collections�defaultdictrrr�rXr�rr/)Zpkg_to_distrPZpkgr#r#r$rs


�r)Gr*rcrr	r�r�r�r�rrrJrgrYr�r.r_rSrrr�_collectionsrr�
_functoolsrr	�
_itertoolsr
r�
contextlibr�	importlibr
Z
importlib.abcrr�typingrrrr�__all__�ModuleNotFoundErrorrr/�
namedtuplerOrryr�r�r/r�Z
PurePosixPathr�r�rrr#r8r�rJr�rrrrrrrrArr#r#r#r$�<module>sl
A
�o_A7(R0,$"4		
	

?>