JFIF$        dd7 

Viewing File: /usr/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/req_command.cpython-39.pyc

a

[��f�B�@s�dZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
mZmZddl
mZddlmZddlmZdd	lmZdd
lmZmZddlmZddlmZdd
lmZddlmZddl m!Z!ddl"m#Z#ddl$m%Z%m&Z&m'Z'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6m7Z7m8Z8ddl9m:Z:e�;e<�Z=Gdd�de�Z>Gdd�dee>�Z?e8j@e8jAe8jBgZCdd�dd �ZDe	e	d!�d"d#�ZEGd$d%�d%e?�ZFdS)&aContains 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)�Values)�Any�List�Optional�Tuple)�
WheelCache)�
cmdoptions)�Command)�CommandContextMixIn)�CommandError�PreviousBuildDirError)�
LinkCollector)�
PackageFinder)�SelectionPreferences)�TargetPython)�
PipSession)�RequirementPreparer)�install_req_from_editable�install_req_from_line�#install_req_from_parsed_requirement�install_req_from_req_string)�parse_requirements)�InstallRequirement)�RequirementTracker)�BaseResolver)�pip_self_version_check)�
deprecated)�
TempDirectory�TempDirectoryTypeRegistry�
tempdir_kinds)�running_under_virtualenvcspeZdZdZdd��fdd�Zeeeee	d�dd��Z
eed�d	d
�Zdeee
ee
ed�dd
�Z�ZS)�SessionCommandMixinzE
    A class mixin for command classes needing _build_session().
    N��returncst���d|_dS�N)�super�__init__�_session)�self��	__class__��A/usr/lib/python3.9/site-packages/pip/_internal/cli/req_command.pyr'6s
zSessionCommandMixin.__init__��optionsr$cCsLg}t|dd�s*t|dd�}|r*|�|�t|dd�}|rD|�|�|pJdS)z7Return a list of index urls from user-provided options.�no_indexFZ	index_urlNZextra_index_urls)�getattr�append�extend)�clsr/�
index_urls�urlZurlsr,r,r-�_get_index_urls:s

z#SessionCommandMixin._get_index_urlscCs0|jdur*|�|�|��|_|jdus*J�|jS)zGet a default-managed session.N)r(�
enter_context�_build_session)r)r/r,r,r-�get_default_sessionHs
z'SessionCommandMixin.get_default_session)r/�retries�timeoutr$cCs�|jrtj�|j�sJ�t|jr0tj�|jd�nd|dur>|n|j|j|�|�d�}|j	rb|j	|_
|jrp|j|_	|jsz|r�|dur�|n|j|_|j
r�|j
|j
d�|_|j|j_|S)N�http)�cacher;�
trusted_hostsr5)r=�https)Z	cache_dir�os�path�isabsr�joinr;r?r7ZcertZverifyZclient_certr<�proxyZproxiesZno_inputZauthZ	prompting)r)r/r;r<�sessionr,r,r-r9Rs&�

�z"SessionCommandMixin._build_session)NN)�__name__�
__module__�__qualname__�__doc__r'�classmethodrrr�strr7rr:�intr9�
__classcell__r,r,r*r-r"0s

��r"c@s eZdZdZedd�dd�ZdS)�IndexGroupCommandz�
    Abstract base class for commands with the index_group options.

    This also corresponds to the commands that permit the pip version check.
    Nr.cCsht|d�sJ�|js|jrdS|j|dtd|j�d�}|�t||�Wd�n1sZ0YdS)z�
        Do the pip version check if not disabled.

        This overrides the default behavior of not doing the check.
        r0Nr�)r;r<)�hasattrZdisable_pip_version_checkr0r9�minr<r)r)r/rFr,r,r-�handle_pip_version_check�s�z*IndexGroupCommand.handle_pip_version_check)rGrHrIrJrrSr,r,r,r-rO{srOr#cCsNt�r
dSttd�sdStjdks,tjdkr0dSt��dkr@dSt�d�dS)z�Output a warning for sudo users on Unix.

    In a virtual environment, sudo pip still writes to virtualenv.
    On Windows, users may run pip as Administrator without issues.
    This warning only applies to Unix root users outside of virtualenv.
    N�getuid�win32�cygwinrz�Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv)r!rQrA�sys�platformrT�logger�warningr,r,r,r-�warn_if_run_as_root�s
�r[)�funcr$cs6tdd�dd��ttttttd���fdd�}|S)zNDecorator for common logic related to managing temporary
    directories.
    N)�registryr$cSstD]}|�|d�qdS)NF)�KEEPABLE_TEMPDIR_TYPESZ
set_delete)r]�tr,r,r-�configure_tempdir_registry�sz0with_cleanup.<locals>.configure_tempdir_registry)r)r/�argsr$csP|jdusJ�|jr�|j�z�|||�WStyJ�|j��Yn0dSr%)Ztempdir_registry�no_cleanr
)r)r/ra�r`r\r,r-�wrapper�s

zwith_cleanup.<locals>.wrapper)r�RequirementCommandrrrrrM)r\rdr,rcr-�with_cleanup�s

�rfcs�eZdZeedd��fdd�Zeeed�dd��Ze	de
eeee
eeeed�d	d
��Ze	dee
eeeeeeeeeeeeedfed�dd��Zeeee
eeed�dd�Zee
dd�dd��Zdeeeeeee
d�dd�Z�ZS)reN)ra�kwr$cs&t�j|i|��|j�t���dSr%)r&r'Zcmd_optsZ
add_optionr	rb)r)rargr*r,r-r'�szRequirementCommand.__init__r.cCsd|jvrdSdS)zEDetermines which resolver should be used, based on the given options.zlegacy-resolver�legacy�
2020-resolver)�deprecated_features_enabled�r/r,r,r-�determine_resolver_variant�s
z-RequirementCommand.determine_resolver_variant)�temp_build_dirr/�req_trackerrF�finder�
use_user_site�download_dirr$cCs�|j}|dusJ�|�|�}	|	dkr>d|jv}
|
rVt�d�nd}
d|jvrVt�d�d|jv}d|jvrxtd	d
dd�d|jvr�td
ddd�t||j||j	|||j
||j||
|d�S)zQ
        Create a RequirementPreparer instance for the given parameters.
        Nriz	fast-depsz�pip is using lazily downloaded wheels using HTTP range requests to obtain dependency information. This experimental feature is enabled through --use-feature=fast-deps and it is not ready for production.Fz;fast-deps has no effect when used with the legacy resolver.zout-of-tree-buildz
in-tree-buildz#In-tree builds are now the default.z.to remove the --use-feature=in-tree-build flagz22.1)�reasonZreplacementZgone_inz"Out-of-tree builds are deprecated.)Z	build_dir�src_dirrq�build_isolationrnrF�progress_barro�require_hashesrp�
lazy_wheel�
in_tree_build)rBrlZfeatures_enabledrYrZrjrrrsrtrurv)r4rmr/rnrFrorprqZtemp_build_dir_path�resolver_variantrwrxr,r,r-�make_requirement_preparer�sR

�
�

�
��z,RequirementCommand.make_requirement_preparerFT�to-satisfy-only.)�preparerror/�wheel_cacherp�ignore_installed�ignore_requires_python�force_reinstall�upgrade_strategy�
use_pep517�py_version_infor$c
Cs�tt|j|
d�}|�|�}
|
dkrTddl}|jjjjj	||||||j
||||	|d�Sddl}|jjjjj	||||||j
||||	|d�S)zF
        Create a Resolver instance for the given parameters.
        )�isolatedr�rirN)r|ror}�make_install_reqrp�ignore_dependenciesr~rr�r�r�)
rr�
isolated_moderlZ,pip._internal.resolution.resolvelib.resolverZ	_internalZ
resolutionZ
resolvelibZresolverZResolverr�Z(pip._internal.resolution.legacy.resolverrh)r4r|ror/r}rpr~rr�r�r�r�r�ryZpipr,r,r-�
make_resolver&sF�
�
�z RequirementCommand.make_resolver)rar/rorFr$c	CsTg}|jD]6}t|d|||d�D]}t||jdd�}|�|�q q
|D]$}	t|	d|j|jdd�}|�|�qF|jD]"}	t|	d|j|jd�}|�|�qr|j	D]8}t||||d�D]"}t||j|jdd�}|�|�q�q�t
d	d
�|D��r�d|_|�sP|j�sP|j	�sPd|ji}
|j
�r<tdjfit|
d
�|j
�d�����ntdjfi|
����|S)zS
        Parse command-line arguments into the corresponding requirements.
        T)Z
constraintror/rFF)r��
user_suppliedN)r�r�r�)r�r�r�)ror/rFcss|]}|jVqdSr%)Zhas_hash_options)�.0�reqr,r,r-�	<genexpr>��z6RequirementCommand.get_requirements.<locals>.<genexpr>�namezXYou must give at least one requirement to {name} (maybe you meant "pip {name} {links}"?)� )ZlinkszHYou must give at least one requirement to {name} (see "pip help {name}"))�constraintsrrr�r2rr�Z	editablesr�requirements�anyrvr�Z
find_linksr�format�dictrD)r)rar/rorFr��filenameZ
parsed_reqZ
req_to_addr�Zoptsr,r,r-�get_requirementsasv

�
��
�
�
�
����z#RequirementCommand.get_requirements)ror$cCs |j}|��}|rt�|�dS)zE
        Trace basic information about the provided objects.
        N)�search_scopeZget_formatted_locationsrY�info)ror�Z	locationsr,r,r-�trace_basic_info�sz#RequirementCommand.trace_basic_info)r/rF�
target_pythonrr$cCs6tj||d�}td|j|j|j|d�}tj|||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.
        rkT)Zallow_yanked�format_controlZallow_all_prereleases�
prefer_binaryr)�link_collector�selection_prefsr�)rZcreaterr�Zprer�r)r)r/rFr�rr�r�r,r,r-�_build_package_finder�s
��z(RequirementCommand._build_package_finder)N)NFTFFr{NN)NN)rGrHrIrr'�staticmethodrrLrlrKrrrr�boolrrrzrrrMrr�rrr�r�rr�rNr,r,r*r-re�sn	��?��<�O��re)GrJZloggingrArW�	functoolsrZoptparser�typingrrrrZpip._internal.cacherZpip._internal.clir	Zpip._internal.cli.base_commandr
Z!pip._internal.cli.command_contextrZpip._internal.exceptionsrr
Zpip._internal.index.collectorrZ"pip._internal.index.package_finderrZ$pip._internal.models.selection_prefsrZ"pip._internal.models.target_pythonrZpip._internal.network.sessionrZ pip._internal.operations.preparerZpip._internal.req.constructorsrrrrZpip._internal.req.req_filerZpip._internal.req.req_installrZpip._internal.req.req_trackerrZpip._internal.resolution.baserZ!pip._internal.self_outdated_checkrZpip._internal.utils.deprecationrZpip._internal.utils.temp_dirrrr Zpip._internal.utils.virtualenvr!Z	getLoggerrGrYr"rOZ	BUILD_ENVZEPHEM_WHEEL_CACHEZ	REQ_BUILDr^r[rfrer,r,r,r-�<module>sH
K�
Back to Directory  nL+D550H?Mx ,D"v]qv;6*Zqn)ZP0!1 A "#a$2Qr D8 a Ri[f\mIykIw0cuFcRı?lO7к_f˓[C$殷WF<_W ԣsKcëIzyQy/_LKℂ;C",pFA:/]=H  ~,ls/9ć:[=/#f;)x{ٛEQ )~ =𘙲r*2~ a _V=' kumFD}KYYC)({ *g&f`툪ry`=^cJ.I](*`wq1dđ#̩͑0;H]u搂@:~וKL Nsh}OIR*8:2 !lDJVo(3=M(zȰ+i*NAr6KnSl)!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