o
    ñ‘Oj.  ã                   @   s¶   d dl Z d dlmZ d dlmZmZ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	lmZ d d
lmZmZ d dlmZ d dlmZ e  e¡ZG dd„ deƒZdS )é    N)ÚValues)ÚAnyÚDictÚList)Údefault_environment)Ú
print_json)Ú__version__)Ú
cmdoptions)ÚCommand)ÚSUCCESS)ÚBaseDistributionÚget_environment)Ústdlib_pkgs)Úpath_to_urlc                   @   sV   e Zd ZdZdZdZddd„Zded	ee	 de
fd
d„Zdedee	ef fdd„ZdS )ÚInspectCommandzZ
    Inspect the content of a Python environment and produce a report in JSON format.
    Tz
      %prog [options]ÚreturnNc                 C   sN   | j jddddd� | j jdddddd	� | j  t ¡ ¡ | j d
| j ¡ d S )Nz--localÚ
store_trueFzSIf in a virtualenv that has global access, do not list globally-installed packages.)ÚactionÚdefaultÚhelpz--userÚuserz,Only output packages installed in user-site.)Údestr   r   r   r   )Úcmd_optsÚ
add_optionr	   Ú	list_pathÚparserÚinsert_option_group©Úself© r   úd/var/www/html/pharmsmart-cdr-gen/venv/lib/python3.10/site-packages/pip/_internal/commands/inspect.pyÚadd_options   s   û	ûzInspectCommand.add_optionsÚoptionsÚargsc                    s^   t  d¡ t |¡ t|jƒj|j|jt	t
ƒd�}dt‡ fdd„|D ƒtƒ dœ}t|d� tS )Nzypip inspect is currently an experimental command. The output format may change in a future release without prior warning.)Ú
local_onlyÚ	user_onlyÚskipÚ0c                    s   g | ]}ˆ   |¡‘qS r   )Ú_dist_to_dict)Ú.0Údistr   r   r    Ú
<listcomp>?   s    z&InspectCommand.run.<locals>.<listcomp>)ÚversionÚpip_versionÚ	installedÚenvironment)Údata)ÚloggerÚwarningr	   Úcheck_list_path_optionr   ÚpathÚiter_installed_distributionsÚlocalr   Úsetr   r   r   r   r   )r   r"   r#   ÚdistsÚoutputr   r   r    Úrun0   s    ÿ

ýü
zInspectCommand.runr*   c                 C   sv   |j |jdœ}|j}|d ur| ¡ |d< n|j}|d ur't|ƒddidœ|d< |j}|jr1||d< |jr9|j|d< |S )N)ÚmetadataÚmetadata_locationÚ
direct_urlÚeditableT)ÚurlÚdir_infoÚ	installerÚ	requested)	Úmetadata_dictÚinfo_locationr=   Úto_dictÚeditable_project_locationr   rA   Úinstalled_with_dist_inforB   )r   r*   Úresr=   rF   rA   r   r   r    r(   F   s$   þÿ
þ
zInspectCommand._dist_to_dict)r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úignore_require_venvÚusager!   r   r   ÚstrÚintr:   r   r   r   r(   r   r   r   r    r      s    
r   )ÚloggingÚoptparser   Útypingr   r   r   Úpip._vendor.packaging.markersr   Úpip._vendor.richr   Úpipr   Úpip._internal.clir	   Úpip._internal.cli.req_commandr
   Úpip._internal.cli.status_codesr   Úpip._internal.metadatar   r   Úpip._internal.utils.compatr   Úpip._internal.utils.urlsr   Ú	getLoggerrI   r1   r   r   r   r   r    Ú<module>   s    
