
    e                     *   d Z ddl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mZ ddlmZ ddlmZ ddlmZ dd	lmZ  ej        e          Z G d
 de          Zeeef         Ze	eef         Ze	eeef         Zeeee         f         Zeeee         f         Ze	eef         Z e	ee f         Z!de	ee"f         fdZ#	 ddedeee$ge"f                  de fdZ%dee         de!fdZ&dee         dedee         fdZ'dee         dedee         fdZ(dS )z'Validation of dependencies of packages
    N)CallableDictList
NamedTupleOptionalSetTuple)Requirement)NormalizedNamecanonicalize_name))make_distribution_for_install_requirement)get_default_environment)DistributionVersion)InstallRequirementc                   0    e Zd ZU eed<   ee         ed<   dS )PackageDetailsversiondependenciesN)__name__
__module____qualname__r   __annotations__r   r
        U/var/www/html/api/venv/lib/python3.11/site-packages/pip/_internal/operations/check.pyr   r      s/             {######r   r   returnc                  \   i } d}t                      }|                    dd          D ]}|j        }	 t          |                                          }t          |j        |          | |<   D# t          t          f$ r(}t          
                    d||           d}Y d}~xd}~ww xY w| |fS )z3Converts a list of distributions into a PackageSet.Fr   )
local_onlyskipz%Error parsing requirements for %s: %sTN)r   iter_installed_distributionscanonical_namelistiter_dependenciesr   r   OSError
ValueErrorloggerwarning)package_setproblemsenvdistnamer   es          r   !create_package_set_from_installedr.   "   s    KH
!
#
#C00E0KK  "	 6 6 8 899L .t|\ J JK$ 	 	 	NNBD!LLLHHHHHH	   s   9A..B'?B""B'r(   should_ignorec                 N   i }i }|                                  D ]\  }}t                      }t                      }|r ||          r0|j        D ]}t          |j                  }	|	| vr?d}
|j        |j                            ddi          }
|
r|                    |	|f           Y| |	         j        }|j	        
                    |d          s|                    |	||f           |rt          |t                    ||<   |rt          |t                    ||<   
||fS )zCheck if a package set is consistent

    If should_ignore is passed, it should be a callable that takes a
    package name and returns a boolean.
    TNextra )prereleases)key)itemssetr   r   r,   markerevaluateaddr   	specifiercontainssortedstr)r(   r/   missingconflictingpackage_namepackage_detailmissing_depsconflicting_depsreqr,   missedr   s               r   check_package_setrF   3   sk    GK(3(9(9(;(; J J$n%(UU-0UU 	]]<88 	!. 	; 	;C$SX..D ;&&:) Z00'2??F 2 $$dC[111 "$'/G=))'t)DD ; $$dGS%9::: 	B$*<S$A$A$AGL! 	J(./?S(I(I(IK%Kr   
to_installc                     t                      \  }}t          | |          }t          ||          |t          |fd          fS )zeFor checking if the dependency graph would be consistent after     installing given requirements
    c                     | vS Nr   )r,   	whitelists    r   <lambda>z)check_install_conflicts.<locals>.<lambda>o   s    D	4I r   )r/   )r.   _simulate_installation_of_create_whitelistrF   )rG   r(   _would_be_installedrK   s       @r   check_install_conflictsrQ   `   sf    
 788NK2:{KK ""4kBBI 	'I'I'I'I	
 	
 	
 r   c                    t                      }| D ]x}t          |          }|                                }|j        }t	          |j        t          |                                                    ||<   |                    |           y|S )z=Computes the version of packages after installing to_install.)	r6   r   get_metadata_distributionr!   r   r   r"   r#   r9   )rG   r(   	installedinst_reqabstract_distr+   r,   s          r   rM   rM   t   s    
 I   A(KK6688"*4<d>T>T>V>V9W9WXXDdr   rP   c                     t          |           }|D ]D}||v r||         j        D ]/}t          |j                  |v r|                    |            n0E|S rJ   )r6   r   r   r,   r9   )rP   r(   packages_affectedr@   rD   s        r   rN   rN      s     .//#  ,,,|,9 	 	C **.???!%%l333 @ r   rJ   ))__doc__loggingtypingr   r   r   r   r   r   r	   "pip._vendor.packaging.requirementsr
   pip._vendor.packaging.utilsr   r   pip._internal.distributionsr   pip._internal.metadatar   pip._internal.metadata.baser   pip._internal.req.req_installr   	getLoggerr   r&   r   
PackageSetMissingConflictingMissingDictConflictingDictCheckResultConflictDetailsboolr.   r=   rF   rQ   rM   rN   r   r   r   <module>rk      s     I I I I I I I I I I I I I I I I I I : : : : : : I I I I I I I I Q Q Q Q Q Q : : : : : : ; ; ; ; ; ; < < < < < <		8	$	$$ $ $ $ $Z $ $ $ ..01

+
,N$7DE>4=01~tK'889K01
K/0!5T1A+B ! ! ! !$ OS*  * * ,4XseTk5J,K* *  *  *  * Z-?(@ _    ('(7A   &N+:D     r   