D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
lib
/
python3.8
/
importlib
/
__pycache__
/
Filename :
metadata.cpython-38.pyc
back
Copy
U �������g�D������������������� ���@���s���d�dl�Z�d�dlZd�dlZd�dlZd�dlZd�dlZd�dlZd�dlZd�dlZd�dl Z d�dl Z d�dlZd�dlZd�dl Z d�dlmZ�d�dlmZ�d�dlmZ�d�dlmZ�d�dlmZ�ddd d ddd dddg ZG�dd ��d e�ZG�dd��de �dd��ZG�dd��dej�ZG�dd��d�ZG�dd��d�ZG�dd��de�Z G�dd��d�Z!G�dd��d�Z"G�d d!��d!e �Z#G�d"d#��d#e�Z$d$d ��Z%d%d��Z&d&d��Z'd'd��Z(d(d��Z)d)d ��Z*d*d��Z+dS�)+�����N)�ConfigParser)�suppress)� import_module)�MetaPathFinder)�starmap�Distribution�DistributionFinder�PackageNotFoundError�distribution� distributions�entry_points�files�metadata�requires�versionc�������������������@���s���e�Zd�ZdZdS�)r ���zThe package was not found.N)�__name__� __module__�__qualname__�__doc__��r���r����(/usr/lib/python3.8/importlib/metadata.pyr ���%���s���c�������������������@���sV���e�Zd�ZdZe�d�Zdd��Zedd���Z e dd���Ze d d ���Zdd��Z d d��ZdS�)� EntryPointz�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. zF(?P<module>[\w.]+)\s*(:\s*(?P<attr>[\w.]+))?\s*(?P<extras>\[.*\])?\s*$c�����������������C���sD���|�j��|�j�}t|�d��}td|�d�p,d�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�match�valuer����group�filter�split� functools�reduce�getattr)�selfr���r���Zattrsr���r���r����loadG���s����zEntryPoint.loadc�����������������C���s(���|�j��|�j�}tt�d|�d�p"d��S�)Nz\w+�extrasr���)r���r���r����list�re�finditerr���)r%���r���r���r���r���r'���Q���s����zEntryPoint.extrasc��������������������s������fdd������D��S�)Nc��������������������s,���g�|�]$}���|�D�]\}}��|||��qqS�r�����items)�.0r����namer�����cls�configr���r���� <listcomp>X���s�����z+EntryPoint._from_config.<locals>.<listcomp>)�sectionsr/���r���r/���r����_from_configV���s�����zEntryPoint._from_configc�����������������C���sN���t�dd�}t|_z|�|��W�n$�tk rB���|�t�|���Y�nX�t� |�S�)N�=)Z delimiters) r����strZoptionxformZread_string�AttributeErrorZreadfp�io�StringIOr���r4���)r0����textr1���r���r���r���� _from_text^���s���� zEntryPoint._from_textc�����������������C���s���t�|�j|�f�S�)zO Supply iter so one may construct dicts of EntryPoints easily. )�iterr.����r%���r���r���r����__iter__j���s����zEntryPoint.__iter__c�����������������C���s���|�j�|�j|�j|�jffS��N)� __class__r.���r���r���r=���r���r���r���� __reduce__p���s�����zEntryPoint.__reduce__N)r���r���r���r���r)����compiler���r&����propertyr'����classmethodr4���r;���r>���rA���r���r���r���r���r���)���s���� r���ZEntryPointBasezname value groupc�������������������@���s*���e�Zd�ZdZd dd�Zdd��Zdd��Zd S�)�PackagePathz"A reference to a path in a package�utf-8c�������������� ���C���s0���|�����j|d��}|���W��5�Q�R���S�Q�R�X�d�S�)N��encoding��locate�open�read)r%���rH����streamr���r���r���� read_textz���s����zPackagePath.read_textc�������������� ���C���s.���|������d��}|���W��5�Q�R���S�Q�R�X�d�S�)N�rbrI���)r%���rM���r���r���r����read_binary~���s����zPackagePath.read_binaryc�����������������C���s���|�j��|��S�)z'Return a path-like object for this path)�dist�locate_filer=���r���r���r���rJ�������s����zPackagePath.locateN)rF���)r���r���r���r���rN���rP���rJ���r���r���r���r���rE���w���s��� rE���c�������������������@���s���e�Zd�Zdd��Zdd��ZdS�)�FileHashc�����������������C���s���|��d�\|�_}|�_d�S�)Nr5���)� partition�moder���)r%����spec�_r���r���r����__init__����s����zFileHash.__init__c�����������������C���s���d��|�j|�j�S�)Nz<FileHash mode: {} value: {}>)�formatrU���r���r=���r���r���r����__repr__����s����zFileHash.__repr__N)r���r���r���rX���rZ���r���r���r���r���rS�������s���rS���c�������������������@���s����e�Zd�ZdZejdd���Zejdd���Zedd���Z edd ���Z ed d���Zedd ���Z edd���Zedd���Zedd���Zedd���Zdd��Zdd��Zedd���Zdd��Zdd��Zed d!���Zed"d#���Zed$d%���Zd&S�)'r���zA Python distribution package.c�����������������C���s���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���rN�������s����zDistribution.read_textc�����������������C���s���dS�)z[ Given a path to a file in this distribution, return a path to it. Nr����r%����pathr���r���r���rR�������s����zDistribution.locate_filec�����������������C���sD���|�����D�].}|tj|d��}t|d�}|dk r|��S�qt|��dS�)af��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. �r.���N)�_discover_resolversr����Context�nextr ���)r0���r.����resolverZdistsrQ���r���r���r���� from_name����s���� zDistribution.from_namec��������������������sJ���|��dd�����r|rtd����p*tjf�|���tj���fdd�|����D���S�)a��Return 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 kwargsc�����������������3���s���|�]}|���V��qd�S�r?���r���)r-���rc����re���r���r���� <genexpr>����s����z(Distribution.discover.<locals>.<genexpr>)�pop� ValueErrorr���ra���� itertools�chain� from_iterabler`���)r0����kwargsr���rf���r����discover����s���� �zDistribution.discoverc�����������������C���s���t�t�|���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����at����s����zDistribution.atc������������������C���s���dd��t�jD��}�td|��S�)z#Search the meta_path for resolvers.c�����������������s���s���|�]}t�|d�d�V��qdS�)�find_distributionsN)r$���)r-����finderr���r���r���rg�������s����z3Distribution._discover_resolvers.<locals>.<genexpr>N)�sys� meta_pathr ���)Zdeclaredr���r���r���r`�������s�����z Distribution._discover_resolversc�����������������C���s(���|���d�p|���d�p|���d�}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-INFOr���)rN����emailZmessage_from_string�r%���r:���r���r���r���r�������s���� ��zDistribution.metadatac�����������������C���s ���|�j�d�S�)z;Return the 'Version' metadata for the distribution package.ZVersion)r���r=���r���r���r���r�������s����zDistribution.versionc�����������������C���s���t��|��d��S�)Nzentry_points.txt)r���r;���rN���r=���r���r���r���r�������s����zDistribution.entry_pointsc��������������������s6���������p�����}d��fdd� }|o4tt|t�|���S�)aB��Files 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. Nc��������������������s6���t�|��}|rt|�nd�|_|r&t|�nd�|_��|_|S�r?���)rE���rS����hash�int�sizerQ���)r.���ry���Zsize_str�resultr=���r���r���� make_file����s ����z%Distribution.files.<locals>.make_file)NN)�_read_files_distinfo�_read_files_egginfor(���r����csv�reader)r%���Z file_linesr}���r���r=���r���r �������s����zDistribution.filesc�����������������C���s���|���d�}|o|���S�)z* Read the lines of RECORD ZRECORD)rN���� splitlinesrx���r���r���r���r~�����s���� z!Distribution._read_files_distinfoc�����������������C���s���|���d�}|otdj|����S�)z` SOURCES.txt might contain literal commas, so wrap each line in quotes. zSOURCES.txtz"{}")rN����maprY���r����rx���r���r���r���r�����s���� z Distribution._read_files_egginfoc�����������������C���s���|�����p|����}|ot|�S�)z6Generated requirements specified for this Distribution)�_read_dist_info_reqs�_read_egg_info_reqsr(���)r%���Zreqsr���r���r���r�����s����zDistribution.requiresc�����������������C���s���|�j��d�S�)Nz Requires-Dist)r���Zget_allr=���r���r���r���r������s����z!Distribution._read_dist_info_reqsc�����������������C���s���|���d�}|o|��|�S�)Nzrequires.txt)rN����_deps_from_requires_text)r%����sourcer���r���r���r���� ��s���� z Distribution._read_egg_info_reqsc�����������������C���s4���|���|����}dd��t�|t�d��D��}|��|�S�)Nc�����������������S���s&���i�|�]\}}|t�tt�d��|���qS�)�line)r(���r�����operator� itemgetter)r-����sectionZresultsr���r���r���� <dictcomp>'��s�����z9Distribution._deps_from_requires_text.<locals>.<dictcomp>r����)�_read_sectionsr����rj����groupbyr����r�����%_convert_egg_info_reqs_to_simple_reqs)r0���r����Z section_pairsr3���r���r���r���r����$��s �����z%Distribution._deps_from_requires_textc�����������������c���s<���d�}t�d�|��D�](}t�d|�}|r.|�d�}qt��V��qd�S�)Nz \[(.*)\]$����)r ���r)���r���r����locals)�linesr����r����Z section_matchr���r���r���r����.��s���� zDistribution._read_sectionsc�����������������#���sB���dd������fdd�}|�����D�] \}}|D�]}|||��V��q(qdS�)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�����������������S���s���|�odj�|�d�S�)Nzextra == "{name}"r_���)rY���r_���r���r���r����make_conditionC��s����zJDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.make_conditionc��������������������sX���|�pd}�|���d�\}}}|r,|r,dj|d�}ttd�|��|�g��}|rTdd�|��S�dS�)Nr����:z({markers}))�markersz; z and )rT���rY���r(���r ����join)r����Zextra�sepr����Z conditions�r����r���r����parse_conditionF��s����zKDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.parse_conditionNr+���)r3���r����r����ZdepsZdepr���r����r���r����8��s ����z2Distribution._convert_egg_info_reqs_to_simple_reqsN)r���r���r���r����abc�abstractmethodrN���rR���rD���rd���rn����staticmethodrr���r`���rC���r���r���r���r ���r~���r���r���r����r����r����r����r����r���r���r���r���r�������sB��� c�������������������@���s2���e�Zd�ZdZG�dd��d�Zeje��fdd��ZdS�)r���zJ A MetaPathFinder capable of discovering installed distributions. c�������������������@���s(���e�Zd�ZdZdZdd��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. Nc�����������������K���s���t�|���|��d�S�r?���)�vars�update)r%���rm���r���r���r���rX���j��s����z#DistributionFinder.Context.__init__c�����������������C���s���t�|���dtj�S�)z� The path that a distribution finder should search. Typically refers to Python package paths and defaults to ``sys.path``. r^���)r�����getru���r^���r=���r���r���r���r^���m��s����zDistributionFinder.Context.path)r���r���r���r���r.���rX���rC���r^���r���r���r���r���ra���X��s ���ra���c�����������������C���s���dS�)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%���re���r���r���r���rs���w��s����z%DistributionFinder.find_distributionsN)r���r���r���r���ra���r����r����rs���r���r���r���r���r���S��s���c�������������������@���s@���e�Zd�ZdZdd��Zdd��Zdd��Zdd ��Zd d��Zdd ��Z dS�)�FastPathzF Micro-optimized class for searching a path for children. c�����������������C���s���||�_�tj�|����|�_d�S�r?���)�root�osr^����basename�lower�base)r%���r����r���r���r���rX������s����zFastPath.__init__c�����������������C���s���t��|�j|�S�r?���)rp���rq���r����)r%����childr���r���r����joinpath���s����zFastPath.joinpathc�������������� ���C���sT���t�t���t�|�jpd�W��5�Q�R���S�Q�R�X�t�t���|����W��5�Q�R���S�Q�R�X�g�S�)Nr���)r���� Exceptionr�����listdirr�����zip_childrenr=���r���r���r����children���s ���� " zFastPath.childrenc�����������������C���s2���t��|�j�}|j���}|j|�_t�dd��|D���S�)Nc�����������������s���s ���|�]}|��tjd��d�V��qdS�)r����r���N)r!���� posixpathr����)r-���r����r���r���r���rg������s����z(FastPath.zip_children.<locals>.<genexpr>)�zipfilerq���r����Znamelistr�����dict�fromkeys)r%���Zzip_path�namesr���r���r���r�������s���� �zFastPath.zip_childrenc�����������������C���s&���|�j�}||jkp$|�|j�o$|�d�S�)N�.egg)r�����versionless_egg_name� startswith�prefix�endswith)r%����searchr����r���r���r����is_egg���s ���� �zFastPath.is_eggc�����������������c���sZ���|�����D�]L}|���}||jksH|�|j�r6|�|j�sH|��|�r|dkr|��|�V��qd�S�)Nzegg-info) r����r����� exact_matchesr����r����r�����suffixesr����r����)r%���r.���r����Zn_lowr���r���r���r�������s���� � ���zFastPath.searchN) r���r���r���r���rX���r����r����r����r����r����r���r���r���r���r�������s��� r����c�������������������@���s6���e�Zd�ZdZdZdZdZdgdd��ZdZdd��Z dS�)�PreparedzE A prepared search for metadata on a possibly-named package. r���)z .dist-infoz .egg-infoNr���c��������������������sV���|��_�|d�krd�S�|����dd���_��jd���_��fdd���jD����_��jd���_d�S�)N�-rW���c��������������������s���g�|�]}��j�|��qS�r���)� normalized)r-����suffixr=���r���r���r2������s����z%Prepared.__init__.<locals>.<listcomp>r����)r.���r�����replacer����r����r����r����r����)r%���r.���r���r=���r���rX������s���� �zPrepared.__init__) r���r���r���r���r����r����r����r����r����rX���r���r���r���r���r�������s���r����c�������������������@���s,���e�Zd�Zee���fdd��Zedd���ZdS�)�MetadataPathFinderc�����������������C���s���|���|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����ro���)r0���re����foundr���r���r���rs������s���� z%MetadataPathFinder.find_distributionsc��������������������s ���t�j���fdd�tt|�D���S�)z1Find metadata directories in paths heuristically.c�����������������3���s���|�]}|��t����V��qd�S�r?���)r����r����)r-���r^���r_���r���r���rg������s����z3MetadataPathFinder._search_paths.<locals>.<genexpr>)rj���rk���rl���r����r����)r0���r.����pathsr���r_���r���r�������s�����z MetadataPathFinder._search_pathsN)r���r���r���rD���r���ra���rs���r����r���r���r���r���r�������s���r����c�������������������@���s.���e�Zd�Zdd��Zdd��Zejje_dd��ZdS�)ro���c�����������������C���s ���||�_�dS�)z�Construct a distribution from a path to the metadata directory. :param path: A pathlib.Path or similar object supporting .joinpath(), __div__, .parent, and .read_text(). N)�_pathr]���r���r���r���rX������s����zPathDistribution.__init__c�������������� ���C���s<���t�ttttt��"�|�j�|�jdd�W��5�Q�R���S�Q�R�X�d�S�)NrF���rG���) r����FileNotFoundError�IsADirectoryError�KeyError�NotADirectoryError�PermissionErrorr����r����rN���r[���r���r���r���rN������s ������zPathDistribution.read_textc�����������������C���s���|�j�j|�S�r?���)r�����parentr]���r���r���r���rR������s����zPathDistribution.locate_fileN)r���r���r���rX���rN���r���r���rR���r���r���r���r���ro������s��� ro���c�����������������C���s ���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). )r���rd����Zdistribution_namer���r���r���r ������s����c������������������K���s���t�jf�|��S�)z|Get all ``Distribution`` instances in the current environment. :return: An iterable of ``Distribution`` instances. )r���rn���)rm���r���r���r���r������s����c�����������������C���s���t��|��jS�)z�Get the metadata for the named package. :param distribution_name: The name of the distribution package to query. :return: An email.Message containing the parsed metadata. )r���rd���r���r����r���r���r���r�����s����c�����������������C���s ���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. )r ���r���r����r���r���r���r�����s����c������������������C���sH���t�j�dd��t��D���}�t�d�}t|�|d�}t��||�}dd��|D��S�)zwReturn EntryPoint objects for all installed packages. :return: EntryPoint objects for all installed packages. c�����������������s���s���|�]}|j�V��qd�S�r?���)r���)r-���rQ���r���r���r���rg�����s����zentry_points.<locals>.<genexpr>r���)�keyc�����������������S���s���i�|�]\}}|t�|��qS�r���)�tuple)r-���r����epsr���r���r���r������s�����z entry_points.<locals>.<dictcomp>)rj���rk���rl���r���r����� attrgetter�sortedr����)r����Zby_groupZorderedZgroupedr���r���r���r�����s����� �c�����������������C���s ���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. )r ���r ���r����r���r���r���r ���%��s����c�����������������C���s ���t�|��jS�)z� Return a list of requirements for the named package. :return: An iterator of requirements, suitable for packaging.requirement.Requirement. )r ���r���r����r���r���r���r���.��s����),r8���r����r)���r����r����ru���rw���rp���r����r����r"���rj���r�����collectionsZconfigparserr���� contextlibr���� importlibr���� importlib.abcr���r����__all__�ModuleNotFoundErrorr ���� namedtupler���Z PurePosixPathrE���rS���r���r���r����r����r����ro���r ���r���r���r���r���r ���r���r���r���r���r����<module>���sb���� �N�E/0