o
    Wi2                     @  s   d dl mZ d dlZd dlmZ d dlmZ d dlmZ er2d dl	m
Z
 d dlmZ d dlmZmZ d	ZG d
d dZG dd deZddgZdS )    )annotationsN)OrderedDict)entry_points)TYPE_CHECKING)Sequence)
PythonInfo)VirtualEnvConfigParserVirtualEnvOptions c                   @  s0   e Zd ZdZdZedddZedd	d
ZdS )PluginLoaderNkeystrreturnOrderedDict[str, type]c                 C  sN   t jdks	tdkrtdd |  j|dD S tdd |  |i D S )N)   
   )r      c                 s      | ]
}|j | fV  qd S Nnameload.0er
   r
   N/home/ubuntu/.local/lib/python3.10/site-packages/virtualenv/run/plugin/base.py	<genexpr>       z0PluginLoader.entry_points_for.<locals>.<genexpr>)groupc                 s  r   r   r   r   r
   r
   r   r      r   )sysversion_infoimportlib_metadata_versionr   r   selectgetclsr   r
   r
   r   entry_points_for   s   zPluginLoader.entry_points_forobjectc                   C  s   t jd u r	t t _t jS r   )r   _ENTRY_POINTSr   r
   r
   r
   r   r      s   
zPluginLoader.entry_pointsr   r   r   r   )r   r'   )	__name__
__module____qualname___OPTIONSr(   classmethodr&   staticmethodr   r
   r
   r
   r   r      s    r   c                   @  sL   e Zd Zd!ddZed"ddZd#ddZd$ddZd%ddZd&ddZ	d S )'ComponentBuilderinterpreterr   parserr   r   r   possibledict[str, type]r   Nonec                 C  s<   || _ || _d | _|| _|j|d| _| |t| j d S )N)title)r1   r   _impl_classr3   add_argument_groupr2   add_selector_arg_parselist)selfr1   r2   r   r3   r
   r
   r   __init__$   s   zComponentBuilder.__init__r   r   c                 C  s   | j d u r| || _ | j S r   )r-   r&   r$   r
   r
   r   options.   s   
zComponentBuilder.optionschoicesSequence[str]c                 C  s   t r   )NotImplementedError)r;   r   r>   r
   r
   r   r9   4   s   z'ComponentBuilder.add_selector_arg_parser=   r	   c                 C  sH   t || j}|| jvrd| j }t|| j| | _| ||j |S )NzNo implementation for )getattrr   r3   r1   RuntimeErrorr7   populate_selected_argparseapp_data)r;   r=   selectedmsgr
   r
   r   handle_selected_arg_parse7   s   
z*ComponentBuilder.handle_selected_arg_parserE   rD   r'   c                 C  s<   d| j  d| | j_| jd usJ | j| j| j| d S )Nzoptions for  )r   r2   descriptionr7   add_parser_argumentsr1   )r;   rE   rD   r
   r
   r   rC   @   s   z+ComponentBuilder.populate_selected_argparsec                 C  s   | j d usJ |  || jS r   )r7   r1   )r;   r=   r
   r
   r   createE   s   zComponentBuilder.createN)
r1   r   r2   r   r   r   r3   r4   r   r5   r)   )r   r   r>   r?   r   r5   )r=   r	   r   r   )rE   r   rD   r'   r   r5   )r=   r	   r   r'   )
r*   r+   r,   r<   r.   r=   r9   rG   rC   rK   r
   r
   r
   r   r0   #   s    




	r0   )
__future__r   r   collectionsr   importlib.metadatar   typingr   collections.abcr   python_discoveryr   virtualenv.config.cli.parserr   r	   r!   r   r0   __all__r
   r
   r
   r   <module>   s    (