
    *,h@^              	          d Z ddlZddlZddlmZ ddlmZ ddlmZm	Z	m
Z
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mZmZmZ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$m%Z% ddl&m'Z'm(Z( ddl)m*Z* ddl+m,Z,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5 ddl6m7Z7 ddl8m9Z9  ejt                  e;      Z<ee=e
e'   f   Z>	 ddedee?e?e?f   de@ddfdZA G d de,      ZBy) ay  Dependency Resolution

The dependency resolution in pip is performed as follows:

for top-level requirements:
    a. only one spec allowed per project, regardless of conflicts or not.
       otherwise a "double requirement" exception is raised
    b. they override sub-dependency requirements.
for sub-dependencies
    a. "first found, wins" (where the order is breadth first)
    N)defaultdict)chain)DefaultDictIterableListOptionalSetTuple)
specifiers)Requirement)
WheelCache)BestVersionAlreadyInstalledDistributionNotFound	HashError
HashErrorsInstallationErrorNoneMetadataErrorUnsupportedPythonVersion)PackageFinder)BaseDistribution)Link)Wheel)RequirementPreparer)InstallRequirementcheck_invalid_constraint_type)RequirementSet)BaseResolverInstallRequirementProvider)compatibility_tags)get_supported)direct_url_from_link)
indent_log)normalize_version_info)check_requires_pythondistversion_infoignore_requires_pythonreturnc                    	 t        | j                        }	 t	        ||      }|rydj                  t        t         |            }|r#t        j                  d| j                  ||       yt        dj                  | j                  ||            # t        $ r}t        | t        |            d}~ww xY w# t
        j                  $ r+}t        j                  d| j                  |       Y d}~yd}~ww xY w)a  
    Check whether the given Python version is compatible with a distribution's
    "Requires-Python" value.

    :param version_info: A 3-tuple of ints representing the Python
        major-minor-micro version to check.
    :param ignore_requires_python: Whether to ignore the "Requires-Python"
        value if the given Python version isn't compatible.

    :raises UnsupportedPythonVersion: When the given Python version isn't
        compatible.
    N)r&   z-Package %r has an invalid Requires-Python: %s.zBIgnoring failed Requires-Python check for package %r: %s not in %rz8Package {!r} requires a different Python: {} not in {!r})strrequires_pythonFileNotFoundErrorr   r$   r   InvalidSpecifierloggerwarningraw_namejoinmapdebugr   format)r%   r&   r'   r,   eis_compatibleexcversions           j/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pip/_internal/resolution/legacy/resolver.py_check_dist_requires_pythonr;   :   s    (.d223	-%
 hhs3-.GPMM		
 	
"BIIMM7O	
 5  .c!f--. && ;T]]C	
 		s.   B B8 	B5B00B58C6!C11C6c                   v    e Zd ZdZh dZ	 d%dededee   de	de
d	e
d
e
de
de
dedeeedf      ddf fdZdee   de
defdZ	 	 d&dededee   deee      deee   ee   f   f
dZdede
fdZdeddfdZdedee   fdZdedee   fdZdeddfd Zdedefd!Zdededee   fd"Zd#edee   fd$Z xZS )'ResolverzResolves which packages need to be installed/uninstalled to perform     the requested operation without breaking the requirements of any package.
    >   eageronly-if-neededto-satisfy-onlyNpreparerfinderwheel_cachemake_install_requse_user_siteignore_dependenciesignore_installedr'   force_reinstallupgrade_strategypy_version_info.r(   c                 F   t         |           |
| j                  v sJ |t        j                  d d }nt        |      }|| _        || _        || _        || _	        |
| _
        |	| _        || _        || _        || _        || _        || _        t#        t$              | _        y )N   )super__init___allowed_strategiessysr&   r#   _py_version_inforA   rB   rC   rI   rH   rF   rG   r'   rE   _make_install_reqr   list_discovered_dependencies)selfrA   rB   rC   rD   rE   rF   rG   r'   rH   rI   rJ   	__class__s               r:   rN   zResolver.__init__x   s     	4#;#;;;"!..r2O4_EO / & 0.#6  0&<#*!1@KD@Q%    	root_reqscheck_supported_wheelsc                 t   t        |      }|D ]+  }|j                  rt        |       | j                  ||       - g }t	               }t        |j                  |      D ]$  }	 |j                  | j                  ||             & |r||S # t        $ r"}||_
        |j                  |       Y d}~Sd}~ww xY w)a  Resolve what operations need to be done

        As a side-effect of this method, the packages (and their dependencies)
        are downloaded, unpacked and prepared for installation. This
        preparation is done by ``pip.operations.prepare``.

        Once PyPI has static dependency metadata available, it would be
        possible to move the preparation to become a step separated from
        dependency resolution.
        )rY   N)r   
constraintr   _add_requirement_to_setr   r   all_requirementsextend_resolve_oner   reqappend)rU   rX   rY   requirement_setr`   discovered_reqshash_errorsr8   s           r:   resolvezResolver.resolve   s     )@VW 	?C~~-c2((#>	? 57 l99?K 	(C(&&t'8'8#'NO	(   (""3''(s   #!B	B7B22B7rb   install_reqparent_req_nameextras_requestedc                    |j                  |      s/t        j                  d|j                  |j                         g dfS |j
                  r|j
                  j                  rtt        |j
                  j                        }t        j                         }|j                  r5|j                  |      s$t        dj                  |j                              |j                  r	|J d       |j                  s|j!                  |       |gdfS 	 |j#                  |j                        }|du xrw |xrs |j&                   xrd |j(                  |j(                  k(  xrI |j*                  xr; |j*                  xr- |j*                  j,                  |j*                  j,                  k7  }|r&t        dj                  |||j                              |s|j/                  |       |g|fS |j&                  s|j&                  sg |fS |j
                  xr< |j
                  xr- |j
                  j0                  |j
                  j0                  k(   }	|	r$t        dj                  |j                              d|_        |j                  rd|_        t3        t5        t7        |j(                        t7        |j(                        z              |_        t        j9                  d	||j(                         |g|fS # t$        $ r d}Y w xY w)
a&  Add install_req as a requirement to install.

        :param parent_req_name: The name of the requirement that needed this
            added. The name is used because when multiple unnamed requirements
            resolve to the same name, we could otherwise end up with dependency
            links that point outside the Requirements set. parent_req must
            already be added. Note that None implies that this is a user
            supplied requirement, vs an inferred one.
        :param extras_requested: an iterable of extras used to evaluate the
            environment markers.
        :return: Additional requirements to scan. That is either [] if
            the requirement is not applicable, or [install_req] if the
            requirement is applicable and has just been added.
        z6Ignoring %s: markers '%s' don't match your environmentNz-{} is not a supported wheel on this platform.z+a user supplied req shouldn't have a parentz7Double requirement given: {} (already in {}, name={!r})zhCould not satisfy constraints for '{}': installation from path or url cannot be constrained to a versionFTzSetting %s extras to: %s)match_markersr/   infonamemarkerslinkis_wheelr   filenamer   r    rY   	supportedr   r5   user_suppliedadd_unnamed_requirementget_requirementKeyErrorr[   extrasr`   	specifieradd_named_requirementpathtuplesortedsetr4   )
rU   rb   rf   rg   rh   wheeltagsexisting_reqhas_conflicting_requirementdoes_not_satisfy_constraints
             r:   r\   z Resolver._add_requirement_to_set   s   , (()9:KKH  ##
 t8O  0 0 9 9+**334E%335D55eood>S'CJJ  ))_-D	98	9 33K@=$&&	   //0@0@A  t# HH +++H ##{'9'99H   	H
 H   **koo.G.GG 	$ '#IPP{/?/?  11+>=+-- !!)@)@|##&1&6&6 '
Q+"2"2"7"7<;L;L;Q;Q"Q<
# '#++16+2B2B+C  #( $$)-L&#3|**+c+2D2D.EEF
 	&	
 ~|++s  	 L	 s   K5 5LLr`   c                     | j                   dk(  ry| j                   dk(  ry| j                   dk(  sJ |j                  xs |j                  S )Nr@   Fr>   Tr?   )rI   rr   r[   rU   r`   s     r:   _is_upgrade_allowedzResolver._is_upgrade_allowed9  sL      $55""g-((,<<<$$66rW   c                 d    | j                   r|j                  j                  rd|_        d|_        y)z4
        Set a requirement to be installed.
        TN)rE   satisfied_byin_usersiteshould_reinstallr   s     r:   _set_req_to_reinstallzResolver._set_req_to_reinstallB  s+     !!S%5%5%A%A#'C rW   req_to_installc                    | j                   ry|j                  | j                         |j                  sy| j                  r| j                  |       y| j                  |      s| j                  dk(  ryy|j                  s	 | j                  j                  |d       | j                  |       y# t        $ r Y yt        $ r Y 'w xY w)a  Check if req_to_install should be skipped.

        This will check if the req is installed, and whether we should upgrade
        or reinstall it, taking into account all the relevant user options.

        After calling this req_to_install will only have satisfied_by set to
        None if the req_to_install is to be upgraded/reinstalled etc. Any
        other value will be a dist recording the current thing installed that
        satisfies the requirement.

        Note that for vcs urls and the like we can't assess skipping in this
        routine - we simply identify that we need to pull the thing down,
        then later on it is pulled down and introspected to assess upgrade/
        reinstalls etc.

        :return: A text reason for why it was skipped, or None.
        Nr?   z#already satisfied, skipping upgradezalready satisfiedT)upgradezalready up-to-date)rG   check_if_existsrE   r   rH   r   r   rI   rn   rB   find_requirementr   r   )rU   r   s     r:   _check_skip_installedzResolver._check_skip_installedL  s    (   &&t'9'9:**&&~6''7$$(88<&
 ""	,,^T,J 	"">2 / ,+'  	s   B2 2	C=CCc                    | j                  |      }| j                  j                  ||      }|sy |j                  }|j                  r8|j
                  xs d}dj                  ||      }t        j                  |       |S )Nz<none given>zqThe candidate selected for download or install is a yanked version: {candidate}
Reason for being yanked: {reason})	candidatereason)	r   rB   r   rn   	is_yankedyanked_reasonr5   r/   r0   )rU   r`   r   best_candidatern   r   msgs          r:   _find_requirement_linkzResolver._find_requirement_link  s    **3/55c7C "">>''9>F
4 f~ff=  NN3rW   c                 \   |j                   | j                  |      |_         | j                  | j                  j                  ry| j                  j                  |j                   |j                  t                     }|t        j                  d|j                          |j                   |j                  u r|j                  r|j                   |_        |j                  |j                  |_        n&t        |j                   |j                        |_        |j                   |_         yy)af  Ensure that if a link can be found for this, that it is found.

        Note that req.link may still be None - if the requirement is already
        installed and not needed to be upgraded based on the return value of
        _is_upgrade_allowed().

        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 undeterministic
        contents due to file modification times.
        N)rn   package_namesupported_tagszUsing cached wheel link: %s)link_is_in_wheel_cache)rn   r   rC   rA   require_hashesget_cache_entryrl   r    r/   r4   original_link
persistentcached_wheel_source_linkorigindownload_infor!   )rU   r`   cache_entrys      r:   _populate_linkzResolver._populate_link  s     882237CH#t}}'C'C&&66(? 7 

 "LL68H8HIxx3,,,1G1G/2xx,!!-$/$6$6! %9HH[5K5K%! #''CH #rW   c                    |j                   r| j                  j                  |      S |j                  J | j	                  |      }|j                  r| j                  j                  ||      S | j                  |       | j                  j                  |      }| j                  s|j                  | j                         |j                  rq| j                  dk7  xs5 | j                  xs' | j                  xs |j                  j                  dk(  }|r| j                  |       |S t         j#                  d|       |S )zzTakes a InstallRequirement and returns a single AbstractDist         representing a prepared variant of the same.
        r@   filez<Requirement already satisfied (use --upgrade to upgrade): %s)editablerA   prepare_editable_requirementr   r   prepare_installed_requirementr   prepare_linked_requirementrG   r   rE   rI   rH   rn   schemer   r/   rk   )rU   r`   skip_reasonr%   should_modifys        r:   _get_dist_forzResolver._get_dist_for  s)    <<====cBB ''005==>>sKPP 	C }}77< $$ 2 23%%):: -''-((- 88??f,	  **3/ 	 R rW   c                    	 j                   sj                  rg S d_         j                        }t        | j                   j
                         g 	dt        dt        t           ddf	 fd}t               5  j                  j                        s"j                  sJ  j                  d        j                  sj                  r/t         j#                  d	d
j%                  j                               t'        t)        j                        t)        |j+                               z
        }|D ].  }t         j-                  d|j.                  |j0                  |       0 t'        t)        |j+                               t)        j                        z        }|j3                  |      D ]  } |||        ddd       	S # 1 sw Y   	S xY w)zxPrepare a single requirements file.

        :return: A list of additional InstallRequirements to also install.
        T)r&   r'   subreqrh   r(   Nc                     	j                  t        |             }j                  }	j                  |||      \  }}|r |r	j                  |   j                  |       j                  |       y )N)rg   rh   )rR   r+   rl   r\   rT   ra   r^   )
r   rh   sub_install_reqrg   to_scan_againadd_to_parent	more_reqsr   rb   rU   s
         r:   add_reqz&Resolver._resolve_one.<locals>.add_req  s{     #44S[.QO,11O+/+G+G /!1	 ,H ,(M= =--o>EEmT]+rW   )rg   z!Installing extra requirements: %r,z%%s %s does not provide the extra '%s')rh   )r[   preparedr   r;   rQ   r'   r   r   r+   r"   has_requirementrl   rr   r\   rF   rv   r/   r4   r2   r{   r|   iter_provided_extrasr0   r1   r9   iter_dependencies)
rU   rb   r   r%   r   missing_requestedmissingavailable_requestedr   r   s
   ```      @r:   r_   zResolver._resolve_one  s    $$(?(?I"& !!.1 	$..#'#>#>	
 /1		,K 	,8C= 	,T 	, 	,  \ !	J #22>3F3FG &333,,#^T -  ++!((LL;!6!67 %+--.T5N5N5P1QQ%!  1 GNN?	 '-1134s>;P;P7QQ'# #445HI JFF5HIJA!	JF G!	JF s   EGGreq_setc                      g t               dt        ddf fd|j                  j                         D ]
  } |        S )zCreate the installation order.

        The installation order is topological - requirements are installed
        before the requiring thing. We break cycles at an arbitrary point,
        and make no other guarantees.
        r`   r(   Nc                     | j                   s| v ry | j                  ry j                  |        j                  | j                     D ]
  } |        j                  |        y N)r   r[   addrT   rl   ra   )r`   deporderordered_reqsschedulerU   s     r:   r   z1Resolver.get_installation_order.<locals>.scheduleL  s_    3,#6~~S!44SXX> LLrW   )r|   r   requirementsvalues)rU   r   rf   r   r   r   s   `  @@@r:   get_installation_orderzResolver.get_installation_order=  sW     03	, 	 	 	 #//668 	"K[!	"rW   r   )NN) __name__
__module____qualname____doc__rO   r   r   r   r   r   boolr+   r
   intrN   r   r   r   re   r   r\   r   r   r   r   r   r   r   r   r_   r   __classcell__)rV   s   @r:   r=   r=   q   s    I 6:$R%$R $R j)	$R
 5$R $R "$R $R !%$R $R $R "%S/2$R 
$RL#01#KO#	#R *.48t,'t, (t, "#	t,
 #8C=1t, 
t&'2D)EE	Ft,l7'9 7d 7 );    404	#4l*< $ ,#("4 #( #(J,!3 ,8H ,\P'P +P 
 	!	Pd%	 	!rW   r=   )F)Cr   loggingrP   collectionsr   	itertoolsr   typingr   r   r   r   r	   r
   pip._vendor.packagingr   "pip._vendor.packaging.requirementsr   pip._internal.cacher   pip._internal.exceptionsr   r   r   r   r   r   r   "pip._internal.index.package_finderr   pip._internal.metadatar   pip._internal.models.linkr   pip._internal.models.wheelr    pip._internal.operations.preparer   pip._internal.req.req_installr   r   pip._internal.req.req_setr   pip._internal.resolution.baser   r   pip._internal.utilsr   &pip._internal.utils.compatibility_tagsr    &pip._internal.utils.direct_url_helpersr!   pip._internal.utils.loggingr"   pip._internal.utils.miscr#   pip._internal.utils.packagingr$   	getLoggerr   r/   r+   DiscoveredDependenciesr   r   r;   r=    rW   r:   <module>r      s   
  
 #  D D , : *   = 3 * , @ 5 R 2 @ G 2 ; ?			8	$$S$/A*B%BC  $)4
4S#&4 !4 
	4ng| grW   