<!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
    .ec,                     @   sX  d 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 ddlmZmZ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 r"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/m0Z0 G dd deZ1G dd dee1Z2G dd de2Z3dS )a  Contains the Command base classes that depend on PipSession.

The classes in this module are in a separate module so the commands not
needing download / PackageFinder capability don't unnecessarily import the
PackageFinder machinery and all its vendored dependencies, etc.
    N)partial)Command)CommandContextMixIn)CommandError)PackageFinder)Resolver)SelectionPreferences)
PipSession)RequirementPreparer)install_req_from_editableinstall_req_from_lineinstall_req_from_req_string)parse_requirements)make_link_collectorpip_self_version_check)normalize_path)MYPY_CHECK_RUNNING)Values)ListOptionalTuple)
WheelCache)TargetPython)RequirementSet)RequirementTracker)TempDirectoryc                       s>   e Zd ZdZ fddZedd Zdd Zdd	d
Z  Z	S )SessionCommandMixinzE
    A class mixin for command classes needing _build_session().
    c                    s   t t|   d | _d S )N)superr   __init___session)self	__class__ A/usr/lib/python3.8/site-packages/pip/_internal/cli/req_command.pyr   2   s    zSessionCommandMixin.__init__c                 C   sL   g }t |dds*t |dd}|r*|| t |dd}|rD|| |pJdS )z7Return a list of index urls from user-provided options.no_indexFZ	index_urlNZextra_index_urls)getattrappendextend)clsoptions
index_urlsZurlZurlsr#   r#   r$   _get_index_urls6   s    

z#SessionCommandMixin._get_index_urlsc                 C   s"   | j dkr| | || _ | j S )zGet a default-managed session.N)r   enter_context_build_session)r    r*   r#   r#   r$   get_default_sessionD   s    
z'SessionCommandMixin.get_default_sessionNc                 C   s   t |jrttj|jdnd |d k	r*|n|j|j| |d}|j	rN|j	|_
|jr\|j|_	|jsf|rz|d k	rr|n|j|_|jr|j|jd|_|j |j_|S )Nhttp)cacheretriestrusted_hostsr+   )r0   Zhttps)r	   	cache_dirr   ospathjoinr2   r3   r,   ZcertZverifyZclient_certtimeoutproxyZproxiesZno_inputZauthZ	prompting)r    r*   r2   r8   sessionr#   r#   r$   r.   K   s*    
z"SessionCommandMixin._build_session)NN)
__name__
__module____qualname____doc__r   classmethodr,   r/   r.   __classcell__r#   r#   r!   r$   r   -   s   
r   c                   @   s   e Zd ZdZdd ZdS )IndexGroupCommandz
    Abstract base class for commands with the index_group options.

    This also corresponds to the commands that permit the pip version check.
    c              	   C   sF   |j s|jrdS | j|dtd|jd}| t|| W 5 Q R X dS )z
        Do the pip version check if not disabled.

        This overrides the default behavior of not doing the check.
        Nr      )r2   r8   )Zdisable_pip_version_checkr%   r.   minr8   r   )r    r*   r:   r#   r#   r$   handle_pip_version_checkz   s    

z*IndexGroupCommand.handle_pip_version_checkN)r;   r<   r=   r>   rD   r#   r#   r#   r$   rA   r   s   rA   c                	   @   s:   e Zd ZedddZedddZd	d
 ZdddZdS )RequirementCommandNc              	   C   s"   | j }t||j|||j|j|dS )zQ
        Create a RequirementPreparer instance for the given parameters.
        )Z	build_dirsrc_dirdownload_dirwheel_download_dirprogress_barbuild_isolationreq_tracker)r6   r
   rF   rI   rJ   )Ztemp_build_dirr*   rK   rG   rH   Ztemp_build_dir_pathr#   r#   r$   make_requirement_preparer   s    z,RequirementCommand.make_requirement_preparerFTto-satisfy-onlyc                 C   s2   t t|j||
d}t| |||||j||||	|dS )zF
        Create a Resolver instance for the given parameters.
        )isolatedwheel_cache
use_pep517)preparerr:   findermake_install_requse_user_siteignore_dependenciesignore_installedignore_requires_pythonforce_reinstallupgrade_strategypy_version_info)r   r   isolated_moder   rU   )rQ   r:   rR   r*   rO   rT   rV   rW   rX   rY   rP   rZ   rS   r#   r#   r$   make_resolver   s&    z RequirementCommand.make_resolverc              	   C   s,  |j D ].}t|d||||dD ]}d|_|| qq|D ]*}	t|	d|j|j|d}d|_|| q:|jD ](}	t|	|j|j|d}d|_|| ql|j	D ]0}t||||||jdD ]}d|_|| qq|j
|_
|s(|js(|j	s(d| ji}
|jrtdt|
d|jd	 ntd
|
 dS )z?
        Marshal cmd line args into a requirement set.
        T)Z
constraintrR   r*   r:   rO   N)rN   rP   rO   )rR   r*   r:   rO   rP   namez^You must give at least one requirement to %(name)s (maybe you meant "pip %(name)s %(links)s"?) )ZlinkszLYou must give at least one requirement to %(name)s (see "pip help %(name)s"))Zconstraintsr   Z	is_directZadd_requirementr   r[   rP   Z	editablesr   ZrequirementsZrequire_hashesr]   Z
find_linksr   dictr7   )r    Zrequirement_setargsr*   rR   r:   rO   filenameZ
req_to_addZreqZoptsr#   r#   r$   populate_requirement_set   sn    
   
  

  

z+RequirementCommand.populate_requirement_setc                 C   s4   t ||d}td|j|j|j|d}tj|||dS )z
        Create a package finder appropriate to this requirement command.

        :param ignore_requires_python: Whether to ignore incompatible
            "Requires-Python" values in links. Defaults to False.
        )r*   T)Zallow_yankedformat_controlZallow_all_prereleasesprefer_binaryrW   )link_collectorselection_prefstarget_python)r   r   rc   Zprerd   r   Zcreate)r    r*   r:   rg   rW   re   rf   r#   r#   r$   _build_package_finder  s    z(RequirementCommand._build_package_finder)NN)NFTFFrM   NN)NN)r;   r<   r=   staticmethodrL   r\   rb   rh   r#   r#   r#   r$   rE      s$             &G  rE   )4r>   r5   	functoolsr   Zpip._internal.cli.base_commandr   Z!pip._internal.cli.command_contextr   Zpip._internal.exceptionsr   Zpip._internal.indexr   Zpip._internal.legacy_resolver   Z$pip._internal.models.selection_prefsr   Zpip._internal.network.sessionr	   Z pip._internal.operations.preparer
   Zpip._internal.req.constructorsr   r   r   Zpip._internal.req.req_filer   Z!pip._internal.self_outdated_checkr   r   Zpip._internal.utils.miscr   Zpip._internal.utils.typingr   Zoptparser   typingr   r   r   Zpip._internal.cacher   Z"pip._internal.models.target_pythonr   Zpip._internal.req.req_setr   Zpip._internal.req.req_trackerr   Zpip._internal.utils.temp_dirr   r   rA   rE   r#   r#   r#   r$   <module>   s4   
E