JFIF$        dd7 

Viewing File: /usr/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/req_command.cpython-39.opt-1.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_urlscCs"|jdur|�|�|��|_|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�t|jrtj�|jd�nd|dur&|n|j|j|�|�d�}|jrJ|j|_	|j
rX|j
|_|jsb|rv|durn|n|j|_|jr�|j|jd�|_
|j|j_|S)N�http)�cacher;�
trusted_hostsr5)r=�https)rZ	cache_dir�os�path�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.cCsZ|js|jrdS|j|dtd|j�d�}|�t||�Wd�n1sL0YdS)z�
        Do the pip version check if not disabled.

        This overrides the default behavior of not doing the check.
        Nr�)r;r<)Zdisable_pip_version_checkr0r9�minr<r)r)r/rEr,r,r-�handle_pip_version_check�s	�z*IndexGroupCommand.handle_pip_version_check)rFrGrHrIrrQr,r,r,r-rN{srNr#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!�hasattrrA�sys�platformrR�logger�warningr,r,r,r-�warn_if_run_as_root�s
�rZ)�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$csB|jr�|j�z�|||�WSty<�|j��Yn0dSr%)�no_cleanZtempdir_registryr
)r)r/r`�r_r[r,r-�wrapper�s

zwith_cleanup.<locals>.wrapper)r�RequirementCommandrrrrrL)r[rcr,rbr-�with_cleanup�s

�recs�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)rdN)r`�kwr$cs&t�j|i|��|j�t���dSr%)r&r'Zcmd_optsZ
add_optionr	ra)r)r`rfr*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_trackerrE�finder�
use_user_site�download_dirr$cCs�|j}|�|�}	|	dkr2d|jv}
|
rJt�d�nd}
d|jvrJt�d�d|jv}d|jvrltdd	d
d�d|jvr�tdd
d
d�t||j||j	|||j
||j||
|d�S)zQ
        Create a RequirementPreparer instance for the given parameters.
        rhz	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.N)Z	build_dir�src_dirrp�build_isolationrmrE�progress_barrn�require_hashesro�
lazy_wheel�
in_tree_build)rBrkZfeatures_enabledrXrYrirrrrrsrtru)r4rlr/rmrErnrorpZtemp_build_dir_path�resolver_variantrvrwr,r,r-�make_requirement_preparer�sP

�
�

�
��z,RequirementCommand.make_requirement_preparerFT�to-satisfy-only.)�preparerrnr/�wheel_cachero�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�rhrN)r{rnr|�make_install_reqro�ignore_dependenciesr}r~rr�r�)
rr�
isolated_moderkZ,pip._internal.resolution.resolvelib.resolverZ	_internalZ
resolutionZ
resolvelibZresolverZResolverr�Z(pip._internal.resolution.legacy.resolverrg)r4r{rnr/r|ror}r~rr�r�r�r�rxZpipr,r,r-�
make_resolver&sF�
�
�z RequirementCommand.make_resolver)r`r/rnrEr$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
constraintrnr/rEF)r��
user_suppliedN)r�r�r�)r�r�r�)rnr/rEcss|]}|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�anyrur�Z
find_linksr�format�dictrC)r)r`r/rnrEr��filenameZ
parsed_reqZ
req_to_addr�Zoptsr,r,r-�get_requirementsasv

�
��
�
�
�
����z#RequirementCommand.get_requirements)rnr$cCs |j}|��}|rt�|�dS)zE
        Trace basic information about the provided objects.
        N)�search_scopeZget_formatted_locationsrX�info)rnr�Z	locationsr,r,r-�trace_basic_info�sz#RequirementCommand.trace_basic_info)r/rE�
target_pythonr~r$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.
        rjT)Zallow_yanked�format_controlZallow_all_prereleases�
prefer_binaryr~)�link_collector�selection_prefsr�)rZcreaterr�Zprer�r)r)r/rEr�r~r�r�r,r,r-�_build_package_finder�s
��z(RequirementCommand._build_package_finder)N)NFTFFrzNN)NN)rFrGrHrr'�staticmethodrrKrkrJrrrr�boolrrryrrrLrr�rrr�r�rr�rMr,r,r*r-rd�sn	��?��<�O��rd)GrIZloggingrArV�	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	getLoggerrFrXr"rNZ	BUILD_ENVZEPHEM_WHEEL_CACHEZ	REQ_BUILDr]rZrerdr,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)!JJӁ* %݉?|D}d5:eP0R;{$X'xF@.Ê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