HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/pip/_internal/resolution/resolvelib/__pycache__/factory.cpython-310.pyc
o

@%Ne�n�@sddlZddlZddlZddlmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZddlmZddlmZddlmZmZddlmZddlmZmZddlmZm Z m!Z!m"Z"m#Z#m$Z$dd	l%m&Z&dd
l'm(Z(m)Z)ddl*m+Z+ddl,m-Z-dd
l.m/Z/ddl0m1Z1ddl2m3Z3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:ddl;m<Z<ddl=m>Z>ddl?m@Z@mAZAmBZBmCZCddlDmEZEmFZFmGZGmHZHmIZImJZJmKZKddlLmMZMmNZNddlOmPZPmQZQmRZRmSZSer�ddlmTZTGdd�deT�ZUe�VeW�ZXed�ZYee+eYfZZGdd�de�Z[Gd d!�d!�Z\dS)"�N)�
TYPE_CHECKING�Dict�	FrozenSet�Iterable�Iterator�List�Mapping�
NamedTuple�Optional�Sequence�Set�Tuple�TypeVar�cast)�InvalidRequirement)�SpecifierSet)�NormalizedName�canonicalize_name)�ResolutionImpossible)�
CacheEntry�
WheelCache)�DistributionNotFound�InstallationError�InstallationSubprocessError�MetadataInconsistent�UnsupportedPythonVersion�UnsupportedWheel)�
PackageFinder)�BaseDistribution�get_default_environment)�Link)�Wheel)�RequirementPreparer)�install_req_from_link_and_ireq)�InstallRequirement�check_invalid_constraint_type)�InstallRequirementProvider)�
get_supported)�Hashes)�get_requirement)�running_under_virtualenv�)�	Candidate�CandidateVersion�
Constraint�Requirement)�AlreadyInstalledCandidate�
BaseCandidate�EditableCandidate�ExtrasCandidate�
LinkCandidate�RequiresPythonCandidate�as_base_candidate)�FoundCandidates�IndexCandidateInfo)�ExplicitRequirement�RequiresPythonRequirement�SpecifierRequirement�UnsatisfiableRequirement)�Protocolc@seZdZUeed<eed<dS)�
ConflictCause�requirement�parentN)�__name__�
__module__�__qualname__r:�__annotations__r,�rErE�M/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/factory.pyr>Hs
r>�Cc@s:eZdZUeeed<eeefed<eee	fed<dS)�CollectedRootRequirements�requirements�constraints�user_requestedN)
rArBrCrr/rDr�strr.�intrErErErFrHSs
rHc@s�eZdZ	dTdedededeedededed	ed
edee	e
dfd
dfdd�Zed
efdd��Z
ded
dfdd�Zdedeed
efdd�Zdedeeded
efdd�Zdedeededeedeed
eefdd �Zd!eed"ed#ed$ed%ee
d
e efd&d'�Z!d(e e"deed
e#efd)d*�Z$d+ed,e%ded
e#efd-d.�Z&d+ed/e'ee e"fd0e'ee#efd,e%d$ed
e efd1d2�Z(d3ed4e ed
ee"fd5d6�Z)d7e*ed
e+fd8d9�Z,d:ed
e-fd;d<�Z.	=dUd"ed>eed4e ed
ee"fd?d@�Z/d"ed
ee"fdAdB�Z0dedeed
ee1fdCdD�Z2d:ed
eefdEdF�Z3dGedHd
e4fdIdJ�Z5dKe"dLeed
e6fdMdN�Z7dOdPdQe8ee%fd
e9fdRdS�Z:dS)V�FactoryN�finder�preparer�make_install_req�wheel_cache�
use_user_site�force_reinstall�ignore_installed�ignore_requires_python�suppress_build_failures�py_version_info.�returncCs�||_||_||_t|
�|_||_||_||_||_|	|_	i|_
i|_i|_i|_
i|_|s?t�}dd�|jdd�D�|_dSi|_dS)NcSsi|]}|j|�qSrE)�canonical_name)�.0�distrErErF�
<dictcomp>{s��z$Factory.__init__.<locals>.<dictcomp>F)�
local_only)�_finderrP�_wheel_cacher5�_python_candidate�_make_install_req_from_spec�_use_user_site�_force_reinstall�_ignore_requires_python�_suppress_build_failures�_build_failures�_link_candidate_cache�_editable_candidate_cache�_installed_candidate_cache�_extras_candidate_cacher�iter_installed_distributions�_installed_dists)�selfrOrPrQrRrSrTrUrVrWrX�envrErErF�__init__Zs*

�
�
zFactory.__init__cCs|jS�N)rd�rnrErErFrT�szFactory.force_reinstall�linkcCs>|jsdSt|j�}|�|jj���rdS|j�d�}t|��)Nz+ is not a supported wheel on this platform.)�is_wheelr!�filename�	supportedr_�
target_python�get_tagsr)rnrs�wheel�msgrErErF�"_fail_if_link_is_unsupported_wheel�s
z*Factory._fail_if_link_is_unsupported_wheel�base�extrascCsFt|�|f}z|j|}W|Sty"t||�}||j|<Y|Swrq)�idrk�KeyErrorr3)rnr|r}�	cache_key�	candidaterErErF�_make_extras_candidate�s�
�zFactory._make_extras_candidater\�templatecCsRz|j|j}Wntyt|||d�}||j|j<Ynw|s#|S|�||�S)N)�factory)rjrZrr0r�)rnr\r}r�r|rErErF�_make_candidate_from_dist�s�z!Factory._make_candidate_from_dist�name�versionc
Cs�||jvrdS|jri||jvrczt|||||d�|j|<WnEty@}ztjd||ddid�||j|<WYd}~dSd}~wtyb}z|jsK�t�	d||�||j|<WYd}~dSd}~ww|j|}n^||j
vr�zt|||||d�|j
|<WnEty�}ztjd||ddid�||j|<WYd}~dSd}~wty�}z|js��t�	d||�||j|<WYd}~dSd}~ww|j
|}|s�|S|�||�S)N)r�r�r�z3Discarding [blue underline]%s[/]: [yellow]%s[reset]�markupT)�extraz&Discarding %s due to build failure: %s)
rg�editablerir2r�logger�inforrf�warningrhr4r�)rnrsr}r�r�r��er|rErErF�_make_candidate_from_link�s|

��
�
��
��
�
��
z!Factory._make_candidate_from_link�ireqs�	specifier�hashes�prefers_installed�incompatible_idsc	s�|sdS|d��jsJd��t�jj��t��|D]}|js#Jd���|jjM��|jdd�M��t|j�O�qdttf������fdd�}dt	t
f������fd	d
�}t||�|��S)NrErz)Candidates found on index must be PEP 508F)�trust_internetrYcsf�jrdSz�j�}Wn
tyYdSw�j|jdd�s!dS�j|��d�}t|��vr1dS|S)z6Get the candidate for the currently-installed version.NT)�prereleases)r\r}r�)rdrmr�containsr�r�r~)�installed_distr�)r}r�r�rnr�r�rErF�_get_installed_candidate
s"��z@Factory._iter_found_candidates.<locals>._get_installed_candidatec	3s���jj���d�}t|���}tdd�|D��}dtdtfdd�}|��}t|�D]}|r0|s5|jj	r5q*t
j�j|j���|j
d�}|j
|fVq*dS)	N)�project_namer�r�css�|]}|jjVqdSrq)rs�	is_yanked)r[�icanrErErF�	<genexpr>0s�zUFactory._iter_found_candidates.<locals>.iter_index_candidate_infos.<locals>.<genexpr>r�rYcSs<|D]}|jdkrdS|jdkrq|j�d�rqdSdS)Nz===T�==z.*F)�operatorr��endswith)r��sprErErF�	is_pinned2s

zUFactory._iter_found_candidates.<locals>.iter_index_candidate_infos.<locals>.is_pinned)rsr}r�r�r�)r_�find_best_candidate�list�iter_applicable�allr�bool�reversedrsr��	functools�partialr�r�)�result�icans�
all_yankedr��pinnedr��func)r}r�r�rnr�r�rErF�iter_index_candidate_infos%s.����zBFactory._iter_found_candidates.<locals>.iter_index_candidate_infos)�reqrr��	frozensetr�r�r}r
r,rr8r7)	rnr�r�r�r�r��ireqr�r�rE)r}r�r�r�rnr�r�rF�_iter_found_candidates�s&  (�zFactory._iter_found_candidates�base_requirementsccsL�|D] }|��\}}|durqt|�}|dusJd��|�||�VqdS)a8Produce explicit candidates from the base given an extra-ed package.

        :param base_requirements: Requirements known to the resolver. The
            requirements are guaranteed to not have extras.
        :param extras: The extras to inject into the explicit requirements'
            candidates.
        Nzno extras here)�get_candidate_lookupr6r�)rnr�r}r��lookup_cand�_�	base_candrErErF�#_iter_explicit_candidates_from_baseTs��z+Factory._iter_explicit_candidates_from_base�
identifier�
constraintccsF�|jD]}|�|�|j|t�t||�t|�dd�}|r |VqdS)z�Produce explicit candidates from constraints.

        This creates "fake" InstallRequirement objects that are basically clones
        of what "should" be the template, but with original_link set to link.
        N�r}r�r�r�)�linksr{r�r�r#r)rnr�r�r�rsr�rErErF�!_iter_candidates_from_constraintsjs�

���z)Factory._iter_candidates_from_constraintsrI�incompatibilitiesc	st�}g}��D]}|��\}	}
|	dur|�|	�|
dur#|�|
�q	t�t��t��}|�|�	��
|jd�t|j
���Wd�n1sIwY|rjz|�|j��|dd��Wn
tyiYdSwdd�|�
�d�D��|s�|�|�j�j|��S����fdd�|D�S)NrEr)r�cSsh|]}t|��qSrE)r~�r[�crErErF�	<setcomp>��z*Factory.find_candidates.<locals>.<setcomp>c3sD�|]�t���vr����rt�fdd���D��r�VqdS)c3s�|]}|���VqdSrq)�is_satisfied_by)r[r��r�rErFr��s�z4Factory.find_candidates.<locals>.<genexpr>.<genexpr>N)r~r�r�)r[�r�r��incompat_idsrIr�rFr��s�����z*Factory.find_candidates.<locals>.<genexpr>)�setr��add�append�
contextlib�suppressrr)�updater��getr�r�r}r�rr�r�r�)rnr�rIr�r�r��explicit_candidatesr�r��candr��parsed_requirementrEr�rF�find_candidates�sT	

����
�����zFactory.find_candidatesr��requested_extrascCs�|�|�st�d|j|j�dS|jst|�S|�|j�|j|jt	|j
�||jr.t|j�nddd�}|durG|js@|j|j�t
t|j��S|�|�S)Nz6Ignoring %s: markers '%s' don't match your environmentr�)�
match_markersr�r�r��markersrsr;r{r�r�r}rrgr<�make_requirement_from_candidate)rnr�r�r�rErErF�"_make_requirement_from_install_req�s,
��
z*Factory._make_requirement_from_install_req�
root_ireqscCs�tgii�}t|�D][\}}|jrDt|�}|rt|��|��s q
|js'Jd��t|j�}||jvr;|j||M<q
t	�
|�|j|<q
|j|dd�}|durPq
|jr_|j|j
vr_||j
|j<|j�|�q
|S)NzConstraint must be namedrE)r�)rH�	enumerater�r%rr�r�rrJr.�	from_ireqr��
user_suppliedrKrIr�)rnr��	collected�ir��problemr�r�rErErF�collect_root_requirements�s.

�z!Factory.collect_root_requirementsr�cCst|�Srq)r9)rnr�rErErFr�sz'Factory.make_requirement_from_candidaterE�
comes_fromcCs|�||�}|�||�Srq)rbr�)rnr�r�r�r�rErErF�make_requirement_from_spec
sz"Factory.make_requirement_from_speccCs"|jrdSt|�sdSt||j�Srq)rerLr:ra)rnr�rErErF� make_requires_python_requirements
z(Factory.make_requires_python_requirementcCs*|jdus	|jjrdS|jj||t�d�S)a�Look up the link in the wheel cache.

        If ``preparer.require_hashes`` is True, don't use the wheel cache,
        because cached wheels, always built locally, have different hashes
        than the files downloaded from the index server and thus throw false
        hash mismatches. Furthermore, cached wheels at present have
        nondeterministic contents due to file modification times.
        N)rs�package_name�supported_tags)r`rP�require_hashes�get_cache_entryr')rnrsr�rErErF�get_wheel_cache_entrys�zFactory.get_wheel_cache_entrycCsZ|j�|j�}|dur
dS|js|S|jr|St�r+|jr+d|j�d|j��}t	|��dS)NzNWill not install to the user site because it will lack sys.path precedence to z in )
rmr�r�rc�in_usersiter*�in_site_packages�raw_name�locationr)rnr�r\�messagerErErF�get_dist_to_uninstall1s ���zFactory.get_dist_to_uninstall�causesr>cCs�|sJd��|jj}t|�dkr+t|djj�}d|djj�d|�d|��}t|�Sd|�d�}|D]}|j�	�}t|jj�}|d	|�d
|�d�7}q3t|�S)Nz,Requires-Python error reported with no causer+rzPackage z requires a different Python: z not in z%Packages require a different Python. z not in:�
z (required by �))
rar��lenrLr?r�r@r�r�format_for_error)rnr�r�r�r��cause�packagerErErF�_report_requires_python_errorMs"���
z%Factory._report_requires_python_errorr�r@cCs�|dur	t|�}n	|�d|j�d�}|j�|j�}dd�tdd�|D��D�}t�d|d�|�p1d	�t|�d
kr>t�	d�t
d|���S)
Nz (from r�cSsg|]}t|��qSrE)rL)r[�vrErErF�
<listcomp>lr�z?Factory._report_single_requirement_conflict.<locals>.<listcomp>cSsh|]}|j�qSrE)r�r�rErErFr�lsz>Factory._report_single_requirement_conflict.<locals>.<setcomp>zNCould not find a version that satisfies the requirement %s (from versions: %s)�, �nonezrequirements.txtz�HINT: You are attempting to install a package literally named "requirements.txt" (which cannot exist). Consider using the '-r' flag to install the packages listed in requirements.txtz#No matching distribution found for )rLr�r_�find_all_candidatesr��sortedr��critical�joinr�r)rnr�r@�req_disp�cands�versionsrErErF�#_report_single_requirement_conflictcs
��z+Factory._report_single_requirement_conflictr�z,ResolutionImpossible[Requirement, Candidate]rJcs�|jsJd���fdd�|jD�}|r��td|��St|j�dkr4|jd\}}|j|vr4��||�Sdttdtfd	d
�}dtdtfdd
�}t	�}|jD]\}}|dur[|�
�}	n||�}	|�|	�qN|rn|t|��}
nd}
d�
|
�}t�|�d}t	�}|jD],\}}|j|vr�|�|j�|d}|r�||j�d|j�d�}n|d}||�
�}q�|D]}
||
j}|d|
�|��7}q�|ddddd}t�|�td�S)Nz)Installation error reported with no causecs*g|]}t|jt�r|j��j�s|�qSrE)�
isinstancer?r:r�ra)r[r�rrrErFr��s
���z2Factory.get_installation_error.<locals>.<listcomp>zSequence[ConflictCause]r+r�partsrYcSs2t|�dkr
|dSd�|dd��d|dS)Nr+rr����z and )r�r�)rrErErF�	text_join�sz1Factory.get_installation_error.<locals>.text_joinr@cSsF|��}|r	|js|j�d|j��St|jt�rt|jj�St|j�S)Nr�)�get_install_requirementr�r�r�rr$rL)r@r�rErErF�describe_trigger�s

z8Factory.get_installation_error.<locals>.describe_triggerzthe requested packageszOCannot install {} because these package versions have conflicting dependencies.z
The conflict is caused by:z
    � z depends on zThe user requested z%
    The user requested (constraint) z

zTo fix this you could try to:
z91. loosen the range of package versions you've specified
z92. remove package versions to allow pip attempt to solve zthe dependency conflict
z�ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts)r�r�rr�r�rrrLr,r�r�r�r��formatr�r�r�r�r�r)rnr�rJ�requires_python_causesr�r@rr�triggers�triggerr�rz�relevant_constraints�key�specrErrrF�get_installation_error~sp
��	

�


������
	�zFactory.get_installation_errorrq)rE);rArBrCrr"r&r
rr�r
rMrp�propertyrTr r{r1rrLr3r�rr$r,r�rr-r�rrr(rrr�r/rr�r.r�rr�r�rrHr�r9r�r�r�rr�r�rr�rrrrrrErErErFrNYs<��������	�
��
�(	��
����
������
�J�����
�a��
����
������
�F��
� �
��
�	����
�	�
���
��
���
��
��rN)]r�r��logging�typingrrrrrrrr	r
rrr
rr�"pip._vendor.packaging.requirementsr� pip._vendor.packaging.specifiersr�pip._vendor.packaging.utilsrr�pip._vendor.resolvelibr�pip._internal.cacherr�pip._internal.exceptionsrrrrrr�"pip._internal.index.package_finderr�pip._internal.metadatarr�pip._internal.models.linkr �pip._internal.models.wheelr!� pip._internal.operations.preparer"�pip._internal.req.constructorsr#�pip._internal.req.req_installr$r%�pip._internal.resolution.baser&�&pip._internal.utils.compatibility_tagsr'�pip._internal.utils.hashesr(�pip._internal.utils.packagingr)�pip._internal.utils.virtualenvr*r|r,r-r.r/�
candidatesr0r1r2r3r4r5r6�found_candidatesr7r8rIr9r:r;r<r=r>�	getLoggerrAr�rG�CacherHrNrErErErF�<module>sD@ $