o
    ©„jq  ã                   @   s®   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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)Ú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   ú\/var/www/html/django_cbt/venv/lib/python3.10/site-packages/pip/_internal/commands/inspect.pyÚadd_options   s   û	ûzInspectCommand.add_optionsÚoptionsÚargsc                    sT   t  |¡ t|jƒj|j|jttƒd�}dt	‡ fdd„|D ƒt
ƒ dœ}t|d� tS )N)Ú
local_onlyÚ	user_onlyÚskipÚ1c                    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)r   Ú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_locationr9   Úto_dict_compatÚeditable_project_locationr   r=   Úinstalled_with_dist_infor>   )r   r(   Úresr9   rB   r=   r   r   r   r&   A   s$   þÿ
þ
zInspectCommand._dist_to_dict)r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úignore_require_venvÚusager   r   ÚlistÚstrÚintr6   r
   Údictr   r&   r   r   r   r   r      s    
r   )ÚloggingÚoptparser   Útypingr   Úpip._vendor.packaging.markersr   Úpip._vendor.richr   Úpipr   Úpip._internal.clir   Úpip._internal.cli.base_commandr   Úpip._internal.cli.status_codesr	   Úpip._internal.metadatar
   r   Úpip._internal.metadata.baser   Úpip._internal.utils.urlsr   Ú	getLoggerrE   Úloggerr   r   r   r   r   Ú<module>   s    
