Ë
    tPêjb  ã                  ó¸   — d Z ddlmZ ddl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  ej                  e«      Z ed¬	«       G d
„ d«      «       Z G d„ d«      Zy)z
Core auditing APIs.
é    )ÚannotationsN)ÚIterator)Ú	dataclass)ÚDependencySource)Ú
DependencyÚVulnerabilityResultÚVulnerabilityServiceT)Úfrozenc                  ó    — e Zd ZU dZdZded<   y)ÚAuditOptionszE
    Settings the control the behavior of an `Auditor` instance.
    FÚboolÚdry_runN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__© ó    úU/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/pip_audit/_audit.pyr   r      s   … ñð €GˆTÔr   r   c                  ó<   — e Zd ZdZ e«       f	 	 	 dd„Z	 	 	 	 dd„Zy)ÚAuditorz­
    The core class of the `pip-audit` API.

    For a given dependency source and vulnerability service, supply a mapping of dependencies to
    known vulnerabilities.
    c                ó    — || _         || _        y)zñ
        Create a new auditor. Auditors start with no dependencies to audit;
        each `audit` step is fed a `DependencySource`.

        The behavior of the auditor can be optionally tweaked with the `options`
        parameter.
        N)Ú_serviceÚ_options)ÚselfÚserviceÚoptionss      r   Ú__init__zAuditor.__init__"   s   € ð  ˆŒØˆ�r   c              #  ó2  ‡	K  — |j                  «       }| j                  j                  r6t        j	                  dt        t        |«      «      › d�«       dE d{  –—†  y| j                  j                  |«      D �]  \  }}g }t        «       }|D ]X  Š	‰	j                  j                  d«      sŒ|j                  ‰	j                  ‰	j                  hz  «       |j                  ‰	«       ŒZ |D ]š  Š	|j                  ‰	j                  ‰	j                  hz  «      r5t!        ˆ	fd„t#        |«      D «       «      \  }}|j%                  ‰	«      ||<   Œa|j                  ‰	j                  ‰	j                  hz  «       |j                  ‰	«       Œœ ||f–— �Œ y7 �Œ:­w)a  
        Perform the auditing step, collecting dependencies from `source`.

        Individual vulnerability results are uniqued based on their `aliases` sets:
        any two results for the same dependency that share an alias are collapsed
        into a single result with a union of all aliases.

        `PYSEC`-identified results are given priority over other results.
        zDry run: would have audited z	 packagesr   NÚPYSECc              3  óP   •K  — | ]  \  }}|j                  ‰«      sŒ||f–— Œ y ­w)N)Úalias_of)Ú.0ÚiÚpÚvs      €r   ú	<genexpr>z Auditor.audit.<locals>.<genexpr>W   s)   øè ø€ ò -Ù'-¨¨1ÈAÏJÉJÐWXÍM˜Q œFñ-ùs   ƒ&�	&)Úcollectr   r   ÚloggerÚinfoÚlenÚlistr   Ú	query_allÚsetÚidÚ
startswithÚupdateÚaliasesÚappendÚintersectionÚnextÚ	enumerateÚmerge_aliases)
r   ÚsourceÚspecsÚdepÚvulnsÚunique_vulnsÚseen_aliasesÚidxÚpreviousr'   s
            @r   ÚauditzAuditor.audit1   sm  øè ø€ ð —‘Ó ˆà�=‰=× Ò ä�K‰KÐ6´s¼4À»;Ó7GÐ6HÈ	ÐRÔSØ�M‰Mà"Ÿm™m×5Ñ5°eÓ<ó (‘
��UØ:<�Ü),«�ð ò +�AØŸ4™4Ÿ?™?¨7Ô3Ø à ×'Ñ'¨¯	©	°Q·T±T°FÑ(:Ô;Ø ×'Ñ'¨Õ*ð+ð ò +�Að $×0Ñ0°·±¸a¿d¹d¸VÑ1CÔDÜ(,ó -Ü1:¸<Ó1Hô-ó )™˜˜Xð -5×,BÑ,BÀ1Ó,E˜ SÑ)Ø à ×'Ñ'¨¯	©	°Q·T±T°FÑ(:Ô;Ø ×'Ñ'¨Õ*ð+ð ˜<Ð'Ô'ñ9(ð ûs   ƒAFÁFÁD:FN)r   r	   r   r   )r9   r   Úreturnz6Iterator[tuple[Dependency, list[VulnerabilityResult]]])r   r   r   r   r   r   rA   r   r   r   r   r      s:   „ ññ !-£ð à%ð ð ó ð/(Ø&ð/(à	?ô/(r   r   )r   Ú
__future__r   ÚloggingÚcollections.abcr   Údataclassesr   Úpip_audit._dependency_sourcer   Úpip_audit._servicer   r   r	   Ú	getLoggerr   r*   r   r   r   r   r   ú<module>rJ      s]   ðñõ #ã Ý $Ý !å 9ß TÑ Tà	ˆ×	Ñ	˜8Ó	$€ñ �$Ô÷ð ó ð÷F(ò F(r   