<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
U
    .e4)                     @   s   d dl m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	lmZ d d
lmZ d dlmZmZmZ d dlmZ eeZG dd deZdd Zdd Zdd Z dS )    )absolute_importN)six)zip_longest)
cmdoptions)IndexGroupCommand)CommandError)PackageFinder)SelectionPreferences)make_link_collector)dist_is_editableget_installed_distributionswrite_output)get_installerc                       sd   e Zd ZdZdZ fddZdd Zdd Zd	d
 Zdd Z	dd Z
dd Zdd Zdd Z  ZS )ListCommandzt
    List installed packages, including editables.

    Packages are listed in a case-insensitive sorted order.
    z
      %prog [options]c                    s  t t| j|| | j}|jdddddd |jddddd	d |jd
ddddd |jdddddd | jjdddddd |t  |jddddd |jddddddd |jddddd  |jd!d"d#d$d  |jd%dd#d&d'd( ttj| j	}| j	
d)| | j	
d)| d S )*Nz-oz
--outdated
store_trueFzList outdated packages)actiondefaulthelpz-uz
--uptodatezList uptodate packagesz-ez
--editablezList editable projects.z-lz--localzSIf in a virtualenv that has global access, do not list globally-installed packages.z--useruserz,Only output packages installed in user-site.)destr   r   r   z--prezYInclude pre-release and development versions. By default, pip only finds stable versions.z--formatZstorelist_formatcolumns)r   freezejsonzBSelect the output format among: columns (default), freeze, or json)r   r   r   choicesr   z--not-requirednot_requiredz>List packages that are not dependencies of installed packages.)r   r   r   z--exclude-editableZstore_falseinclude_editablez%Exclude editable package from output.z--include-editablez%Include editable package from output.T)r   r   r   r   r   )superr   __init__cmd_optsZ
add_optionr   Z	list_pathZmake_option_groupZindex_groupparserZinsert_option_group)selfargskwr   Z
index_opts	__class__ ?/usr/lib/python3.8/site-packages/pip/_internal/commands/list.pyr   &   s        
 zListCommand.__init__c                 C   s(   t ||d}td|jd}tj||dS )zK
        Create a package finder appropriate to this list command.
        )optionsF)Zallow_yankedZallow_all_prereleases)link_collectorselection_prefs)r
   r	   prer   Zcreate)r!   r(   sessionr)   r*   r&   r&   r'   _build_package_finderv   s    z!ListCommand._build_package_finderc                 C   s   |j r|jrtdt| t|j|j|j|j	|j
d}|jrL| ||}|j r`| ||}n|jrr| ||}| || d S )Nz5Options --outdated and --uptodate cannot be combined.)Z
local_onlyZ	user_onlyZeditables_onlyZinclude_editablespaths)outdatedZuptodater   r   Zcheck_list_path_optionr   Zlocalr   Zeditabler   pathr   get_not_requiredget_outdatedget_uptodateoutput_package_listing)r!   r(   r"   packagesr&   r&   r'   run   s&    
zListCommand.runc                 C   s   dd |  ||D S )Nc                 S   s   g | ]}|j |jkr|qS r&   latest_versionZparsed_version.0distr&   r&   r'   
<listcomp>   s   z,ListCommand.get_outdated.<locals>.<listcomp>iter_packages_latest_infosr!   r5   r(   r&   r&   r'   r2      s    
zListCommand.get_outdatedc                 C   s   dd |  ||D S )Nc                 S   s   g | ]}|j |jkr|qS r&   r7   r9   r&   r&   r'   r<      s   z,ListCommand.get_uptodate.<locals>.<listcomp>r=   r?   r&   r&   r'   r3      s    
zListCommand.get_uptodatec                    s:   t   |D ]} dd | D  q
 fdd|D S )Nc                 s   s   | ]}|j V  qd S Nkey)r:   Zrequirementr&   r&   r'   	<genexpr>   s     z/ListCommand.get_not_required.<locals>.<genexpr>c                    s   h | ]}|j  kr|qS r&   rA   )r:   ZpkgZdep_keysr&   r'   	<setcomp>   s     
 z/ListCommand.get_not_required.<locals>.<setcomp>)setupdateZrequires)r!   r5   r(   r;   r&   rD   r'   r1      s    zListCommand.get_not_requiredc              	   c   s   |  |}| ||}|D ]t}d}||j}|jsDdd |D }|j|jd}||}	|	d krfq|	j}
|	j	j
rzd}nd}|
|_||_|V  qW 5 Q R X d S )Nunknownc                 S   s   g | ]}|j js|qS r&   )versionZis_prerelease)r:   	candidater&   r&   r'   r<      s    z:ListCommand.iter_packages_latest_infos.<locals>.<listcomp>)project_nameZwheelZsdist)Z_build_sessionr-   Zfind_all_candidatesrB   r+   Zmake_candidate_evaluatorrK   Zsort_best_candidaterI   linkZis_wheelr8   latest_filetype)r!   r5   r(   r,   finderr;   typZall_candidatesZ	evaluatorZbest_candidateZremote_versionr&   r&   r'   r>      s(    
z&ListCommand.iter_packages_latest_infosc                 C   s   t |dd d}|jdkr:|r:t||\}}| || n^|jdkr|D ]4}|jdkrltd|j|j|j qHtd|j|j qHn|jd	krtt	|| d S )
Nc                 S   s
   | j  S r@   )rK   lower)r;   r&   r&   r'   <lambda>       z4ListCommand.output_package_listing.<locals>.<lambda>rA   r   r      z%s==%s (%s)z%s==%sr   )
sortedr   format_for_columnsoutput_package_listing_columnsverboser   rK   rI   locationformat_for_json)r!   r5   r(   dataheaderr;   r&   r&   r'   r4      s"    

 
z"ListCommand.output_package_listingc                 C   sb   t |dkr|d| t|\}}t |dkrL|ddtdd | |D ]}t| qPd S )Nr   rS    c                 S   s   d|  S )N-r&   )xr&   r&   r'   rQ      rR   z<ListCommand.output_package_listing_columns.<locals>.<lambda>)leninserttabulatejoinmapr   )r!   rZ   r[   Zpkg_stringssizesvalr&   r&   r'   rV      s    z*ListCommand.output_package_listing_columns)__name__
__module____qualname____doc__Zusager   r-   r6   r2   r3   r1   r>   r4   rV   __classcell__r&   r&   r$   r'   r      s   Pr   c                 C   s   t | dkstdgtdd | D  }| D ]}dd t||D }q,g }| D ](}ddd t||D }|| qN||fS )Nr   c                 s   s   | ]}t |V  qd S r@   )r_   r:   r^   r&   r&   r'   rC      s     ztabulate.<locals>.<genexpr>c                 S   s"   g | ]\}}t |tt|qS r&   )maxr_   strr:   scr&   r&   r'   r<      s     ztabulate.<locals>.<listcomp>r\   c                 S   s*   g | ]"\}}|d k	r"t ||ndqS )N )rm   ljustrn   r&   r&   r'   r<      s   )r_   AssertionErrorrl   r   rb   append)Zvalsrd   rowresultZdisplayr&   r&   r'   ra      s    
ra   c                 C   s   |j }|rddddg}nddg}g }|jdks@tdd | D rJ|d |jdkr^|d	 | D ]l}|j|jg}|r||j ||j |jdkst|r||j	 |jdkr|t
| || qb||fS )
z_
    Convert the package data into something usable
    by output_package_listing_columns.
    ZPackageZVersionZLatestZTyperS   c                 s   s   | ]}t |V  qd S r@   )r   rk   r&   r&   r'   rC     s     z%format_for_columns.<locals>.<genexpr>ZLocationZ	Installer)r/   rW   anyrt   rK   rI   r8   rM   r   rX   r   )Zpkgsr(   Zrunning_outdatedr[   rZ   Zprojru   r&   r&   r'   rU     s(    



rU   c                 C   sv   g }| D ]b}|j t|jd}|jdkr@|j|d< t||d< |jr`t|j|d< |j	|d< |
| qt|S )N)namerI   rS   rX   Z	installerr8   rM   )rK   r   Z	text_typerI   rW   rX   r   r/   r8   rM   rt   r   dumps)r5   r(   rZ   r;   infor&   r&   r'   rY   +  s    



rY   )!Z
__future__r   r   ZloggingZpip._vendorr   Zpip._vendor.six.movesr   Zpip._internal.clir   Zpip._internal.cli.req_commandr   Zpip._internal.exceptionsr   Zpip._internal.indexr   Z$pip._internal.models.selection_prefsr	   Z!pip._internal.self_outdated_checkr
   Zpip._internal.utils.miscr   r   r   Zpip._internal.utils.packagingr   Z	getLoggerrf   Zloggerr   ra   rU   rY   r&   r&   r&   r'   <module>   s$   
 Y%