Ë
    tPêj  ã                   óB  — d Z ddlZddlZddlZddlZddlmZmZ ddlm	Z	 ddl
Z
ddlmZmZ ddlmZmZmZ ddlmZ ddlmZmZmZ dd	lmZ  ej4                  e«      Z ed
«      Z e ee
j>                  «      «      Z  G d„ de«      Z! G d„ de«      Z" G d„ de«      Z#y)z[
Collect the local environment's active dependencies via `pip list`, wrapped
by `pip-api`.
é    N)ÚIteratorÚSequence)ÚPath)ÚInvalidVersionÚVersion)ÚDependencyFixErrorÚDependencySourceÚDependencySourceError)ÚResolvedFixVersion)Ú
DependencyÚResolvedDependencyÚSkippedDependency)Ú
AuditStatez10.0.0b0c                   ój   — e Zd ZdZdg d e«       dœdedee   dededd	f
d
„Zde	e
   fd„Zdedd	fd„Zy	)Ú	PipSourcezG
    Wraps `pip` (specifically `pip list`) as a dependency source.
    F)ÚlocalÚpathsÚskip_editableÚstater   r   r   r   ÚreturnNc                óv  — || _         || _        || _        || _        t        j
                  j                  dt        j                  «      }t	        j                  d«      }|�-|j                  |«      st        j                  d|› d|› d�«       t        t        k  rt        j                  dt        › d�«       yy)	aE  
        Create a new `PipSource`.

        `local` determines whether to do a "local-only" list. If `True`, the
        `DependencySource` does not expose globally installed packages.

        `paths` is a list of locations to look for installed packages. If the
        list is empty, the `DependencySource` will query the current Python
        environment.

        `skip_editable` controls whether dependencies marked as "editable" are skipped.
        By default, editable dependencies are not skipped.

        `state` is an `AuditState` to use for state callbacks.
        ÚPIPAPI_PYTHON_LOCATIONÚVIRTUAL_ENVNzpip-audit will run pip against z/, but you have a virtual environment loaded at zè. This may result in unintuitive audits, since your local environment will not be audited. You can forcefully override this behavior by setting PIPAPI_PYTHON_LOCATION to the location of your virtual environment's Python interpreter.zpip z„ is very old, and may not provide reliable dependency information! You are STRONGLY encouraged to upgrade to a newer version of pip.)Ú_localÚ_pathsÚ_skip_editabler   ÚosÚenvironÚgetÚsysÚ
executableÚgetenvÚ
startswithÚloggerÚwarningÚ_PIP_VERSIONÚ_MINIMUM_RELIABLE_PIP_VERSION)Úselfr   r   r   r   Úeffective_pythonÚvenv_prefixs          úe/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/pip_audit/_dependency_source/pip.pyÚ__init__zPipSource.__init__,   s¹   € ð. ˆŒØˆŒØ+ˆÔØˆŒ
ô" Ÿ:™:Ÿ>™>Ð*BÄCÇNÁNÓSÐÜ—i‘i Ó.ˆØÐ"Ð+;×+FÑ+FÀ{Ô+SÜ�N‰NØ1Ð2BÐ1Cð D3Ø3>°-ð @TðTôô Ô7Ò7Ü�N‰NØ”|�nð %(ð (õð 8ó    c           	   #   óÂ  K  — 	 t        j                  | j                  t        | j                  «      ¬«      j                  «       D ]   }|j                  r$| j                  rt        |j                  d¬«      }nj	 t        |j                  t        t        |j                  «      «      ¬«      }| j                  j                  d|j                  › d|j                  › d�«       |–— Œ¢ y
# t         $ rL d|j                  › d|j                  › d�}t"        j%                  |«       t        |j                  |¬«      }Y Œ[w xY w# t&        $ r}t)        d	«      |‚d
}~ww xY w­w)zƒ
        Collect all of the dependencies discovered by this `PipSource`.

        Raises a `PipSourceError` on any errors.
        )r   r   zdistribution marked as editable)ÚnameÚskip_reason)r/   ÚversionzCollecting ú (ú)z6Package has invalid version and could not be audited: z&failed to list installed distributionsN)Úpip_apiÚinstalled_distributionsr   Úlistr   ÚvaluesÚeditabler   r   r/   r   r   Ústrr1   r   Úupdate_stater   r$   ÚdebugÚ	ExceptionÚPipSourceError)r(   ÚdistÚdepr0   Úes        r+   ÚcollectzPipSource.collecti   s1  è ø€ ð	RÜ×7Ñ7Ø—k‘k¬¨d¯k©kÓ):ôç‰f‹hò�ð —=’= T×%8Ò%8Ü+Ø!ŸY™YÐ4Uô‘Cð	YÜ0°d·i±iÌÔQTÐUY×UaÑUaÓQbÓIcÔd˜ØŸ
™
×/Ñ/°+¸c¿h¹h¸ZÀrÈ#Ï+É+ÈÐVWÐ0XÔYð “	ñ'øô *ò YàTØ#Ÿy™y˜k¨¨D¯L©L¨>¸ð<ð $ô Ÿ™ [Ô1Ü/°T·Y±YÈKÔXšðYûô ò 	RÜ Ð!IÓJÐPQÐQûð	RüsO   ‚E„A5E Á:A)C*Ã#E Ã)EÃ*AD?Ä<E Ä>D?Ä?E Å	EÅEÅEÅEÚfix_versionc           	      ó$  — | j                   j                  d|j                  j                  › d|j                  j                  › d|j                  › d�«       t
        j                  ddd|j                  j                  › d|j                  › �g}	 t        j                  |d	t        j                  t        j                  ¬
«       y# t        j                  $ r5}t        d|j                  j                  › d|j                  › �«      |‚d}~ww xY w)zA
        Fixes a dependency version in this `PipSource`.
        zFixing r2   z => r3   z-mÚpipÚinstallz==T)ÚcheckÚstdoutÚstderrzfailed to upgrade dependency z to fix version N)r   r:   r?   r/   r1   r    r!   Úcanonical_nameÚ
subprocessÚrunÚDEVNULLÚCalledProcessErrorÚPipFixError)r(   rB   Úfix_cmdÚcpes       r+   ÚfixzPipSource.fixŠ   sþ   € ð 	�
‰
×ÑØ�k—o‘o×*Ñ*Ð+¨2¨k¯o©o×.EÑ.EÐ-FÀdÈ;×K^ÑK^ÐJ_Ð_`Ðaô	
ô �N‰NØØØØ�‰×-Ñ-Ð.¨b°×1DÑ1DÐ0EÐFð
ˆð	Ü�N‰NØØÜ!×)Ñ)Ü!×)Ñ)ö	øô ×,Ñ,ò 	ÜØ/°·±×0DÑ0DÐ/EÐEUØ×&Ñ&Ð'ð)óð ðûð	ús   Â5C ÃDÃ0D
Ä
D)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úboolr   r   r,   r   r   rA   r   rQ   © r-   r+   r   r   '   s{   „ ñð Ø "Ø#Ù&›Lò;ð ð;ð ˜‰~ð	;ð
 ð;ð ð;ð 
ó;ðzR˜ *Ñ-ó RðBÐ1ð °dô r-   r   c                   ó   — e Zd ZdZy)r=   z)A `pip` specific `DependencySourceError`.N©rR   rS   rT   rU   rW   r-   r+   r=   r=   ¦   s   „ Ù3àr-   r=   c                   ó   — e Zd ZdZy)rN   z&A `pip` specific `DependencyFixError`.NrY   rW   r-   r+   rN   rN   ¬   s   „ Ù0àr-   rN   )$rU   Úloggingr   rJ   r    Úcollections.abcr   r   Úpathlibr   r4   Úpackaging.versionr   r   Úpip_audit._dependency_sourcer   r	   r
   Úpip_audit._fixr   Úpip_audit._servicer   r   r   Úpip_audit._stater   Ú	getLoggerrR   r$   r'   r9   ÚPIP_VERSIONr&   r   r=   rN   rW   r-   r+   ú<module>re      sœ   ðñó
 Û 	Û Û 
ß .Ý ã ß 5÷ñ õ
 .ß PÑ PÝ 'à	ˆ×	Ñ	˜8Ó	$€ñ
 !(¨
Ó 3Ð ñ ‘s˜7×.Ñ.Ó/Ó0€ô|Ð ô |ô~	Ð*ô 	ô	Ð$õ 	r-   