o �J�h� �@s�dZddlmZddlZddlZddlZddlmZGdd�de�Z Gdd�dej �Z Gd d �d ej �Z Gd d �d ej �Z Gd d�d�ZdS)a; ELF file parser. This provides a class ``ELFFile`` that parses an ELF executable in a similar interface to ``ZipFile``. Only the read interface is implemented. Based on: https://gist.github.com/lyssdod/f51579ae8d93c8657a5564aefc2ffbca ELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html �)� annotationsN)�IOc@s eZdZdS)� ELFInvalidN)�__name__� __module__� __qualname__�rr�PC:\pinokio\api\whisper-webui.git\app\env\lib\site-packages\packaging\_elffile.pyrsrc@�eZdZdZdZdS)�EIClass��N)rrr�C32ZC64rrrr r �r c@r )�EIDatar r N)rrr�LsbZMsbrrrr rrrc@s eZdZdZdZdZdZdZdS)�EMachine���(�>�N)rrr�I386ZS390�ArmZX8664ZAArc64rrrr r!s rc@s2eZdZdZddd�Zdd d �Zeddd��ZdS)�ELFFilez. Representation of an ELF executable. �f� IO[bytes]�return�Nonec Cs||_z|�d�}Wn tjytd��wt|dd��}|dkr*td|����|d|_|d|_zddd d d �|j|jf\}|_|_ Wnt y\td |j�d |j�d���wz|�|�\ }|_ }}|_ }|_ }|_|_WdStjy�}ztd�|�d}~ww)NZ16Bzunable to parse identification�sELFzinvalid magic: �)z <HHIIIIIHHHz <IIIIIIII�rr r)z >HHIIIIIHHHz >IIIIIIIIr!)z <HHIQQQIHHHz <IIQQQQQQ�rr r )z >HHIQQQIHHHz >IIQQQQQQr"))r r )r r )r r )r r zunrecognized capacity (z) or encoding (�)z/unable to parse machine and section information)�_f�_read�struct�errorr�bytes�capacity�encoding�_p_fmt�_p_idx�KeyError�machine�_e_phoff�flags� _e_phentsize�_e_phnum)�selfr�ident�magicZe_fmt�_�errr �__init__.sV�  � �  ��� �  ��zELFFile.__init__�fmt�str�tuple[int, ...]cCst�||j�t�|���S)N)r&�unpackr$�read�calcsize)r3r9rrr r%\sz ELFFile._read� str | Nonec Cs�t|j�D]H}|j�|j|j|�z|�|j�}Wn tj y%Yqw||j ddkr0q|j�||j d�t � |j� ||j d���d�SdS)zH The path recorded in the ``PT_INTERP`` section header. rrr r �N)�ranger2r$�seekr/r1r%r+r&r'r,�os�fsdecoder=�strip)r3�index�datarrr � interpreter_s�&zELFFile.interpreterN)rrrr)r9r:rr;)rr?)rrr�__doc__r8r%�propertyrHrrrr r)s   .r)rI� __future__r�enumrCr&�typingr� ValueErrorr�IntEnumr rrrrrrr �<module>s  
Memory