Ë
    sPêj£	  ã                   óf   — d Z dg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mZ  G d	„ d«      Zy
)zComponent related buildersÚComponentBuilderé    )Úsha1)Úexists)ÚOptionalé   )ÚHashAlgorithmÚHashType)Ú	ComponentÚComponentTypec                   ó@   — e Zd Zdedee   defd„Zededefd„«       Zy)r   Úabsolute_file_pathÚnameÚreturnc          
      óÈ   — t        |«      st        d|›d�«      ‚t        t        j                  |xs |t        t        j                  | j                  |«      ¬«      g¬«      S )aø  
        Helper method to create a :class:`cyclonedx.model.component.Component`
        that represents the provided local file as a Component.

        Args:
            absolute_file_path:
                Absolute path to the file you wish to represent
            name:
                Optionally, if supplied this is the name that will be used for the component.
                Defaults to arg ``absolute_file_path``.

        Returns:
            `Component` representing the supplied file
        zSupplied file path z does not exist)ÚalgÚcontent)Útyper   Úhashes)	r   ÚFileExistsErrorr
   r   ÚFILEr	   r   ÚSHA_1Ú_file_sha1sum)Úselfr   r   s      úi/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/cyclonedx/contrib/component/builders.pyÚmake_for_filezComponentBuilder.make_for_file    sd   € ô  Ð(Ô)Ü!Ð$7Ð8JÐ7MÈ_Ð"]Ó^Ð^äÜ×#Ñ#ØÒ+Ð+äœ]×0Ñ0¸$×:LÑ:LÐM_Ó:`Ôaðô
ð 	
ó    Úfilenamec                 óä   ‡— t        «       }t        | d«      5 Št        ˆfd„d«      D ]  }|j                  |«       Œ 	 ddd«       |j	                  «       S # 1 sw Y   |j	                  «       S xY w)zÁ
        Generate a SHA1 hash of the provided file.

        Args:
            filename:
                Absolute path to file to hash as `str`

        Returns:
            SHA-1 hash
        Úrbc                  ó&   •— ‰ j                  d«      S )Ni   )Úread)Úfs   €r   ú<lambda>z0ComponentBuilder._file_sha1sum.<locals>.<lambda>I   s   ø€ ¨1¯6©6°$«<€ r   r   N)r   ÚopenÚiterÚupdateÚ	hexdigest)r   ÚhÚ
byte_blockr"   s      @r   r   zComponentBuilder._file_sha1sum;   sg   ø€ ô ‹FˆÜ�(˜DÓ!ð 	% QÜ"Ó#7¸Ó=ò %�
Ø—‘˜Õ$ñ%÷	%ð �{‰{‹}Ð÷	%ð �{‰{‹}Ðús   ˜&AÁA/N)	Ú__name__Ú
__module__Ú__qualname__Ústrr   r
   r   Ústaticmethodr   © r   r   r   r      sD   „ ð
°ð 
Ø$ S™Mð
Ø.7ó
ð6 ð ð ¨ò ó ñr   N)Ú__doc__Ú__all__Úhashlibr   Úos.pathr   Útypingr   Úmodelr   r	   Úmodel.componentr
   r   r   r/   r   r   ú<module>r7      s+   ðñ$ !àÐ
€å Ý Ý ç ,ß 7÷-ò -r   