+
     h  c                  s    R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHt  ! R R]4      t	 ! R R]P                  4      t ! R R	]P                  4      t ! R
 R]P                  4      t ! R R4      tR# )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    ] tR t^tRtR# )
ELFInvalid N)__name__
__module____qualname____firstlineno____static_attributes__r       C/usr/lib/python3.14/site-packages/pip/_vendor/packaging/_elffile.pyr   r      s    r	   r   c                  s    ] tR t^t^t^tRtR# )EIClassr   N)r   r   r   r   ZC32ZC64r   r   r	   r
   r   r          
C
Cr	   r   c                  s    ] tR t^t^t^tRtR# )EIDatar   N)r   r   r   r   ZLsbZMsbr   r   r	   r
   r   r      r   r	   r   c                  s*    ] tR t^!t^t^t^(t^>t^tRt	R# )EMachiner   N)
r   r   r   r   ZI386ZS390ZArmZX8664ZAArc64r   r   r	   r
   r   r   !   s    DD
CEFr	   r   c                  sH    ] tR t^)tRtR R ltR R lt]R R l4       tRt	R	# )
ELFFilez&
Representation of an ELF executable.
c                    V ^8  d   QhRRRR/# )   fz	IO[bytes]returnZNoner   Zformat   "r
   __annotate__ELFFile.__annotate__.   s     +W +W) +W +Wr	   c           
     	s   Wn          V P                  R 4      p\        TR,          4      pTR8w  d   \	        RT: 24      hT^,          T n        T^,          T n         R
RRRRRRR/T P                  T P                  3,          w  qPn        T n	         T P                  T4      w
  pT n        ppT n        pT n        pT n        T n        R#   \        P                   d   p\	        R4      ThRp?ii ; i  \         d-   p\	        RT P                   RT P                   R24      ThRp?ii ; i  \        P                   d   p\	        R	4      ThRp?ii ; i)Z16Bzunable to parse identificationN:N   Ns   ELFzinvalid magic: zunrecognized capacity (z) or encoding (Z)z/unable to parse machine and section information)   r   )z<HHIIIIIHHHz	<IIIIIIII    r   r   )r   r   )z>HHIIIIIHHHz	>IIIIIIIIr   )r   r   )z<HHIQQQIHHHz	<IIQQQQQQr   r   i   )r   r   )z>HHIQQQIHHHz	>IIQQQQQQr   )_f_readstructerrorr   Zbytescapacityencoding_p_fmt_p_idxZKeyErrormachine_e_phoffflags_e_phentsize_e_phnum)selfr   ZidentZeZmagicZe_fmtZ_s   &&     r
   __init__ZELFFile.__init__.   sl   	FJJu%E eBi Jui899aa	
 ????	/
 }}dmm,/.+E;	W 

5!
!G || 	F=>AE	F&  	)$--VWX	$ || 	WNOUVV	WsG   C
 4C3 5D- 
C0C++C03D*>'D%%D*-EEEc               r   )r   fmtZstrr   ztuple[int, ...]r   r   r   r
   r   r   [   s     F F F Fr	   c                	s    \         P                  ! WP                  P                  \         P                  ! V4      4      4      # )N)r   Zunpackr   readZcalcsize)r*   r,   s   &&r
   r   ZELFFile._read[   s'    }}S'',,vs/C"DEEr	   c               s    V ^8  d   QhRR/# )r   r   z
str | Noner   r   r   r
   r   r   _   s      Z r	   c                sz   \        V P                  4       EF  pV P                  P                  V P                  V P
                  V,          ,           4        V P                  V P                  4      pY P                  ^ ,          ,          ^8w  d   K}  T P                  P                  Y P                  ^,          ,          4       \        P                  ! T P                  P                  Y P                  ^,          ,          4      4      P                  R4      u # 	  R#   \        P                   d     EK#  i ; i)z8
The path recorded in the ``PT_INTERP`` section header.
Z N)Zranger)   r   Zseekr&   r(   r   r#   r   r    r$   osZfsdecoder-   Zstrip)r*   ZindexZdatas   &  r
   interpreterZELFFile.interpreter^   s    
 4==)EGGLL):):U)BBCzz$++. KKN#q(GGLLkk!n-.;;tww||DQ,@ABHHNN *  << s   D  D:9D:)
r(   r)   r&   r   r#   r$   r!   r"   r'   r%   N)
r   r   r   r   __doc__r+   r   Zpropertyr/   r   r   r	   r
   r   r   )   s(    +WZF  r	   r   )r0   Z
__future__r    Zenumr.   r   Ztypingr   Z
ValueErrorr   ZIntEnumr   r   r   r   r   r	   r
   <module>r1      sc    #  	  	 	dll 
T\\ 
t|| D Dr	   