
    
_d                     J   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	 Zd
 Zd Zde
j$                  fdZe j(                  d        Zej-                  e      d        Zej-                   ed      d        ede
j$                  fd       Zd Zy)    N   )OptionError)yield_lines)	pass_none)metadata)ensure_unique)consumec                 d    	 | j                    y# t        $ r}d|  d}t        |      |d}~ww xY w)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AttributeErrorr   )epexmsgs      :/usr/lib/python3/dist-packages/setuptools/_entry_points.pyensure_validr      sE    
'
		 '  %R R 	 #B&'s    	/*/c                     t        |       }d| ddj                  |      z   }t        j                  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texts       r   
load_groupr      s@     EugS>DIIe,,D**400    c                 2    | j                   | j                  fS N)r   name)r   s    r   by_group_and_namer"   '   s    88RWWr   epsc           	      V    t        t        t        t        | t                           | S )zM
    Ensure entry points are unique by group and name and validate each.
    key)r	   mapr   r   r"   r#   s    r   validater)   +   s      CmC5FGHIJr   c                     t         j                  j                  d | j                         D              }t	        t        j                  |            S )zA
    Given a Distribution.entry_points, produce EntryPoints.
    c              3   :   K   | ]  \  }}t        ||        y wr    )r   ).0r   r   s      r   	<genexpr>zload.<locals>.<genexpr>8   s       +%1UE
5% +s   )	itertoolschainfrom_iterableitemsr)   r   r   )r#   groupss     r   loadr3   3   sC    
 __** +58YY[+ F H((011r   c                 x    t        t        j                  t        j                  j                  |                   S )z
    >>> ep, = load('[console_scripts]\nfoo=bar')
    >>> ep.group
    'console_scripts'
    >>> ep.name
    'foo'
    >>> ep.value
    'bar'
    )r)   r   r   r   r(   s    r   _r5   >   s+     H(()=)=)H)H)MNOOr   c                     | S r     )xs    r   <lambda>r9   L   s    A r   c                     t        j                  d      }t        j                  t	        | |      |      }dj                  d |D              S )Nr   r%   r   c              3   F   K   | ]  \  }}d | dt        |       d  yw)r   r   r   N)render_items)r,   r   r1   s      r   r-   zrender.<locals>.<genexpr>T   s)     V|ueqs<#6"7r:Vs   !)operator
attrgetterr.   groupbysortedr   )r#   by_groupr2   s      r   renderrB   O   s@    ""7+Hvcx8(CF99VvVVVr   c                 D    dj                  d t        |       D              S )Nr   c              3   R   K   | ]  }|j                    d |j                    ! yw)z = N)r!   r   )r,   r   s     r   r-   zrender_items.<locals>.<genexpr>X   s#     E2yBHH:.Es   %')r   r@   r(   s    r   r<   r<   W   s    99EEEEr   )	functoolsr=   r.   errorsr   extern.jaraco.textr   extern.jaraco.functoolsr   
_importlibr   
_itertoolsr   extern.more_itertoolsr	   r   r   r"   r   r)   singledispatchr3   registerstrr5   typerB   r<   r7   r   r   <module>rP      s        + .   % *'1(&&  2 2 s
P 
P d4j+ & W$$ W WFr   