U
    aÊ¹j	  ã                   @   sÜ   d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ ddl	m
Z
 ddlmZ ddlmZ d	d
„ Zdd„ Zdd„ Ze
jdœdd„Ze jdd„ ƒZe e¡dd„ ƒZe edƒdd„ ¡ ee
jdœdd„ƒZdd„ ZdS )é    N)Ú	pass_none)Úyield_lines)Úconsumeé   )Úmetadata)Úensure_unique)ÚOptionErrorc              
   C   sL   z
| j  W n< ttfk
rF } zd| › d�}t|ƒ|‚W 5 d}~X Y nX dS )zR
    Exercise one of the dynamic properties to trigger
    the pattern match.
    zProblems to parse zq.
Please ensure entry-point follows the spec: https://packaging.python.org/en/latest/specifications/entry-points/N)ÚextrasÚAttributeErrorÚAssertionErrorr   )ÚepÚexÚmsg© r   úW/var/www/html/bwave/python/venv/lib/python3.8/site-packages/setuptools/_entry_points.pyÚensure_valid   s    

ÿr   c                 C   s*   t | ƒ}d|› d�d |¡ }tj |¡S )zf
    Given a value of an entry point or series of entry points,
    return each as an EntryPoint.
    ú[ú]
Ú
)r   Újoinr   ÚEntryPointsÚ
_from_text)ÚvalueÚgroupÚlinesÚtextr   r   r   Ú
load_group   s    r   c                 C   s   | j | jfS ©N)r   Úname)r   r   r   r   Úby_group_and_name)   s    r   ©Úepsc                 C   s   t ttt| td�ƒƒ | S )zM
    Ensure entry points are unique by group and name and validate each.
    ©Úkey)r   Úmapr   r   r   r    r   r   r   Úvalidate-   s    r%   c                 C   s(   t j dd„ |  ¡ D ƒ¡}tt |¡ƒS )zA
    Given a Distribution.entry_points, produce EntryPoints.
    c                 s   s   | ]\}}t ||ƒV  qd S r   )r   )Ú.0r   r   r   r   r   Ú	<genexpr>:   s    zload.<locals>.<genexpr>)Ú	itertoolsÚchainÚfrom_iterableÚitemsr%   r   r   )r!   Úgroupsr   r   r   Úload5   s    ÿr-   c                 C   s   t t tj | ¡¡ƒS )z’
    >>> ep, = load('[console_scripts]\nfoo=bar')
    >>> ep.group
    'console_scripts'
    >>> ep.name
    'foo'
    >>> ep.value
    'bar'
    )r%   r   r   r   r    r   r   r   Ú_@   s    r.   c                 C   s   | S r   r   )Úxr   r   r   Ú<lambda>N   ó    r0   c                 C   s2   t  d¡}t t| |d�|¡}d dd„ |D ƒ¡S )Nr   r"   r   c                 s   s(   | ] \}}d |› dt |ƒ› d�V  qdS )r   r   r   N)Úrender_items)r&   r   r+   r   r   r   r'   V   s     zrender.<locals>.<genexpr>)ÚoperatorÚ
attrgetterr(   ÚgroupbyÚsortedr   )r!   Úby_groupr,   r   r   r   ÚrenderQ   s    
r8   c                 C   s   d  dd„ t| ƒD ƒ¡S )Nr   c                 s   s    | ]}|j › d |j› �V  qdS )z = N)r   r   )r&   r   r   r   r   r'   Z   s     zrender_items.<locals>.<genexpr>)r   r6   r    r   r   r   r2   Y   s    r2   )Ú	functoolsr(   r3   Zjaraco.functoolsr   Zjaraco.textr   Zmore_itertoolsr   Z
_importlibr   Ú
_itertoolsr   Úerrorsr   r   r   r   r   r%   Úsingledispatchr-   ÚregisterÚstrr.   Útyper8   r2   r   r   r   r   Ú<module>   s(   


