a XC?h>I�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZddlmZddlmZddl mZgd�ZGdd �d e�ZGd d �d e �d d ��ZGdd�dej�ZGdd�d�ZGdd�d�ZGdd�de�Z Gdd�d�Z!Gdd�d�Z"Gdd�de �Z#Gdd�de�Z$dd�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 eZdZdS)r N)�__name__� __module__� __qualname__�rr�7/opt/alt/python39/lib64/python3.9/importlib/metadata.pyr %sr c@sjeZdZe�d�Zdd�Zedd��Zedd��Z edd ��Z e d d ��Z e d d ��Z dd�Zdd�ZdS)� EntryPointzH(?P[\w.]+)\s*(:\s*(?P[\w.]+)\s*)?((?P\[.*\])\s*)?$cCsD|j�|j�}t|�d��}td|�d�p,d�d��}t�t ||�S)N�module�attr��.) �pattern�match�valuer�group�filter�split� functools�reduce�getattr)�selfrr�attrsrrr�loadPszEntryPoint.loadcCs|j�|j�}|�d�S)Nr�rrrr�r$rrrrrZszEntryPoint.modulecCs|j�|j�}|�d�S)Nrr'r(rrrr_szEntryPoint.attrcCs$|j�|j�}t�d|�d�p d�S)Nz\w+�extrasr)rrr�re�findallrr(rrrr)dszEntryPoint.extrascs��fdd����D�S)Ncs,g|]$}��|�D]\}}�|||��qqSr��items)�.0r�namer��cls�configrr� ks�z+EntryPoint._from_config..)�sectionsr0rr0r� _from_configis �zEntryPoint._from_configcCsLtdd�}t|_z|�|�Wn"ty@|�t�|��Yn0t� |�S)N�=)Z delimiters) r�strZ optionxformZ read_string�AttributeErrorZreadfp�io�StringIOrr5)r1�textr2rrr� _from_textqs  zEntryPoint._from_textcCst|j|f�S�N)�iterr/�r$rrr�__iter__}szEntryPoint.__iter__cCs|j|j|j|jffSr=)� __class__r/rrr?rrr� __reduce__�s�zEntryPoint.__reduce__N)rrrr*�compilerr&�propertyrrr)� classmethodr5r<r@rBrrrrr)s �      rZEntryPointBasezname value groupc@s&eZdZd dd�Zdd�Zdd�ZdS) � PackagePath�utf-8cCs<|��j|d��}|��Wd�S1s.0YdS)N��encoding��locate�open�read)r$rI�streamrrr� read_text�szPackagePath.read_textcCs:|���d��}|��Wd�S1s,0YdS)N�rbrJ)r$rNrrr� read_binary�szPackagePath.read_binarycCs |j�|�Sr=)�dist� locate_filer?rrrrK�szPackagePath.locateN)rG)rrrrOrQrKrrrrrF�s rFc@seZdZdd�Zdd�ZdS)�FileHashcCs|�d�\|_}|_dS)Nr6)� partition�moder)r$�spec�_rrr�__init__�szFileHash.__init__cCsd�|j|j�S)Nz)�formatrVrr?rrr�__repr__�szFileHash.__repr__N)rrrrYr[rrrrrT�srTc@s�eZdZejdd��Zejdd��Zedd��Zedd��Z e d d ��Z e d d ��Z ed)dd��Z edd��Zedd��Zedd��Zedd��Zdd�Zdd�Zedd��Zdd�Zd d!�Zed"d#��Ze d$d%��Ze d&d'��Zd(S)*rcCsdSr=r�r$�filenamerrrrO�szDistribution.read_textcCsdSr=r�r$�pathrrrrS�szDistribution.locate_filecCsH|��D]2}|tj|d��}tt|�d�}|dur|Sqt|��dS)N�r/)�_discover_resolversr�Context�nextr>r )r1r/�resolverZdistsrRrrr� from_name�s  zDistribution.from_namec sN|�dd���r|rtd���p.tjfi|���tj��fdd�|��D��S)N�contextz cannot accept context and kwargsc3s|]}|��VqdSr=r)r.rd�rfrr� �s�z(Distribution.discover..)�pop� ValueErrorrrb� itertools�chain� from_iterablera)r1�kwargsrrgr�discover�s �zDistribution.discovercCstt�|��Sr=)�PathDistribution�pathlib�Path)r_rrr�at�szDistribution.atcCsdd�tjD�}td|�S)Ncss|]}t|dd�VqdS)�find_distributionsN)r#)r.�finderrrrrh�s�z3Distribution._discover_resolvers..)�sys� meta_pathr)Zdeclaredrrrra�s�z Distribution._discover_resolversrcCs@ddlm}m}|�|�}tj|j||d�}tt�|� |���S)Nr)�build�meta)Z source_dir�system) Zpep517rxryZ compat_systemr!�partialrp�zipfilerrZ build_as_zip)r1�rootrxryrzZbuilderrrr�_local�s �zDistribution._localcCs(|�d�p|�d�p|�d�}t�|�S)NZMETADATAzPKG-INFOr)rO�emailZmessage_from_string�r$r;rrrr�s  ��zDistribution.metadatacCs |jdS)NZVersion)rr?rrrrszDistribution.versioncCst�|�d��S)Nzentry_points.txt)rr<rOr?rrrr szDistribution.entry_pointscs6���p���}d�fdd� }|o4tt|t�|���S)Ncs6t|�}|rt|�nd|_|r&t|�nd|_�|_|Sr=)rFrT�hash�int�sizerR)r/r�Zsize_str�resultr?rr� make_files z%Distribution.files..make_file)NN)�_read_files_distinfo�_read_files_egginfo�listr�csv�reader)r$Z file_linesr�rr?rr s zDistribution.filescCs|�d�}|o|��S)NZRECORD)rO� splitlinesr�rrrr�&s z!Distribution._read_files_distinfocCs|�d�}|otdj|���S)Nz SOURCES.txtz"{}")rO�maprZr�r�rrrr�-s z Distribution._read_files_egginfocCs|��p|��}|ot|�Sr=)�_read_dist_info_reqs�_read_egg_info_reqsr�)r$Zreqsrrrr5szDistribution.requirescCs |j�d�S)Nz Requires-Dist)rZget_allr?rrrr�;sz!Distribution._read_dist_info_reqscCs |�d�}|durdS|�|�S)Nz requires.txt)rO�_deps_from_requires_text)r$�sourcerrrr�>s z Distribution._read_egg_info_reqscCs4|�|���}dd�t�|t�d��D�}|�|�S)NcSs&i|]\}}|ttt�d�|���qS)�line)r�r��operator� itemgetter)r.�sectionZresultsrrr� Es�z9Distribution._deps_from_requires_text..r�)�_read_sectionsr�rk�groupbyr�r��%_convert_egg_info_reqs_to_simple_reqs)r1r�Z section_pairsr4rrrr�Bs �z%Distribution._deps_from_requires_textccs<d}td|�D](}t�d|�}|r.|�d�}qt�VqdS)Nz \[(.*)\]$�)rr*rr�locals)�linesr�r�Z section_matchrrrr�Ls  zDistribution._read_sectionsc#sVdd���fdd�}dd�}|��D],\}}|D]}||�}||||�Vq0q$dS)NcSs|odj|d�S)Nzextra == "{name}"r`)rZr`rrr�make_conditionaszJDistribution._convert_egg_info_reqs_to_simple_reqs..make_conditioncsX|pd}|�d�\}}}|r,|r,d|�d�}ttd|�|�g��}|rTdd�|�SdS)Nr�:�(�)z; z and )rUr�r�join)r�Zextra�sepZmarkersZ conditions�r�rr� quoted_markerds  zIDistribution._convert_egg_info_reqs_to_simple_reqs..quoted_markercSs dd|vS)N� �@r)Zreqrrr� url_req_spacelszIDistribution._convert_egg_info_reqs_to_simple_reqs..url_req_spacer,)r4r�r�r�ZdepsZdepZspacerr�rr�Vs  z2Distribution._convert_egg_info_reqs_to_simple_reqsN)r)rrr�abc�abstractmethodrOrSrErero� staticmethodrsrar~rDrrr r r�r�rr�r�r�r�r�rrrrr�sD              rc@s.eZdZGdd�d�Zeje�fdd��ZdS)rc@s$eZdZdZdd�Zedd��ZdS)zDistributionFinder.ContextNcKst|��|�dSr=)�vars�update)r$rnrrrrY�sz#DistributionFinder.Context.__init__cCst|��dtj�S)Nr_)r��getrvr_r?rrrr_�szDistributionFinder.Context.path)rrrr/rYrDr_rrrrrbs rbcCsdSr=r)r$rfrrrrt�sz%DistributionFinder.find_distributionsN)rrrrbr�r�rtrrrrrzsrc@s<eZdZdd�Zdd�Zdd�Zdd�Zd d �Zd d �Zd S)�FastPathcCs||_tj�|j���|_dSr=)r}�osr_�basename�lower�base)r$r}rrrrY�szFastPath.__init__cCst�|j|�Sr=)rqrrr})r$�childrrr�joinpath�szFastPath.joinpathcCsltt�� t�|jpd�Wd�S1s.0Ytt��|��Wd�S1s^0YgS)Nr)r� Exceptionr��listdirr}� zip_childrenr?rrr�children�s  . &zFastPath.childrencCs2t�|j�}|j��}|j|_t�dd�|D��S)Ncss |]}|�tjd�dVqdS)r�rN)r � posixpathr�)r.r�rrrrh�s�z(FastPath.zip_children..)r|rrr}Znamelistr��dict�fromkeys)r$Zzip_path�namesrrrr��s    �zFastPath.zip_childrencCs&|j}||jkp$|�|j�o$|�d�S)N�.egg)r��versionless_egg_name� startswith�prefix�endswith)r$�searchr�rrr�is_egg�s   �zFastPath.is_eggccsZ|��D]L}|��}||jvsH|�|j�r6|�|j�sH|�|�r|dkr|�|�VqdS)Nzegg-info) r�r�� exact_matchesr�r�r��suffixesr�r�)r$r/r�Zn_lowrrrr��s   � ���zFastPath.searchN) rrrrYr�r�r�r�r�rrrrr��s  r�c@s2eZdZdZdZdZdgdd�ZdZdd�ZdS)�Preparedr)z .dist-infoz .egg-infoNrcsV|�_|durdS|���dd��_�jd�_�fdd��jD��_�jd�_dS)N�-rXcsg|]}�j|�qSr)� normalized)r.�suffixr?rrr3�sz%Prepared.__init__..r�)r/r��replacer�r�r�r�r�)r$r/rr?rrY�s  �zPrepared.__init__) rrrr�r�r�r�r�rYrrrrr��s r�c@s,eZdZee��fdd��Zedd��ZdS)�MetadataPathFindercCs|�|j|j�}tt|�Sr=)� _search_pathsr/r_r�rp)r1rf�foundrrrrt�s z%MetadataPathFinder.find_distributionscs tj��fdd�tt|�D��S)Nc3s|]}|�t���VqdSr=)r�r�)r.r_r`rrrh�s�z3MetadataPathFinder._search_paths..)rkrlrmr�r�)r1r/�pathsrr`rr��s�z MetadataPathFinder._search_pathsN)rrrrErrbrtr�rrrrr��s r�c@s.eZdZdd�Zdd�Zejje_dd�ZdS)rpcCs ||_dSr=)�_pathr^rrrrYszPathDistribution.__init__cCsHtttttt��$|j�|�jdd�Wd�S1s:0YdS)NrGrH) r�FileNotFoundError�IsADirectoryError�KeyError�NotADirectoryError�PermissionErrorr�r�rOr\rrrrOs�zPathDistribution.read_textcCs |jj|Sr=)r��parentr^rrrrSszPathDistribution.locate_fileN)rrrrYrOr�__doc__rSrrrrrps rpcCs t�|�Sr=)rre�Zdistribution_namerrrr sr cKstjfi|��Sr=)rro)rnrrrr !sr cCs t�|�jSr=)rrerr�rrrr)srcCs t|�jSr=)r rr�rrrr2srcCsHtj�dd�t�D��}t�d�}t||d�}t�||�}dd�|D�S)Ncss|] }|jVqdSr=)r )r.rRrrrrhAszentry_points..r)�keycSsi|]\}}|t|��qSr)�tuple)r.r�epsrrrr�Fs�z entry_points..)rkrlrmr r�� attrgetter�sortedr�)r�Zby_groupZorderedZgroupedrrrr <s �   �r cCs t|�jSr=)r r r�rrrr Lsr cCs t|�jSr=)r rr�rrrrUsr),r9r�r*r�r�rvrrqr|r�r!rkr�� collectionsZ configparserr� contextlibr� importlibr� importlib.abcrr�__all__�ModuleNotFoundErrorr � namedtuplerZ PurePosixPathrFrTrrr�r�r�rpr r rrr r rrrrr�sN       �aY/0