Your IP : 3.137.181.194


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/binhex.cpython-310.opt-2.pyc

o

6��f�9�@s	ddlZddlZddlZddlZddlZddlZejdedd�gd�ZGdd�de	�Z
dZdZd	Z
d
ZdZGdd
�d
�Zdd�ZGdd�d�Zejdd��ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZGdd�d�ZGdd�d�ZGd d!�d!�Zd"d#�ZdS)$�Nzthe binhex module is deprecated�)�
stacklevel)�binhex�hexbin�Errorc@seZdZdS)rN)�__name__�
__module__�__qualname__�r
r
�-/opt/alt/python310/lib64/python3.10/binhex.pyr%sr�i��@��c@seZdZdd�ZdS)�FInfocCsd|_d|_d|_dS)Nz????r)�Type�Creator�Flags��selfr
r
r�__init__6s
zFInfo.__init__N)rrr	rr
r
r
rr5srcCs�t�}t�|d��}|�d�}d|vrd|_|�dd�|��}Wd�n1s*wYtj�	|�\}}|�
ddd�}|||dfS)	N�rbirZTEXTr�:�-r)r�io�open�readr�seek�tell�os�path�split�replace)�name�finfo�fp�dataZdsize�dir�filer
r
r�getfileinfo;s

�r(c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�openrsrccG�dS�Nr
�r�argsr
r
rrI�zopenrsrc.__init__cGsdS�N�r
r,r
r
rrLr.z
openrsrc.readcGr*r+r
r,r
r
r�writeOr.zopenrsrc.writecCr*r+r
rr
r
r�closeRr.zopenrsrc.closeN)rrr	rrr1r2r
r
r
rr)Hs
r)ccsD�t���t�ddt�dVWd�dS1swYdS)N�ignore�)�warnings�catch_warnings�filterwarnings�DeprecationWarningr
r
r
r�_ignore_deprecation_warningXs
�
"�r9c@�.eZdZ	dd�Zdd�Zdd�Zdd�Zd	S)
�_HqxcoderenginecCs ||_d|_d|_td|_dS)Nr0r)�ofpr%�hqxdata�LINELEN�linelen�rr<r
r
rrbsz_Hqxcoderengine.__init__cCs�|j||_t|j�}|dd}|jd|�}|j|d�|_|s$dSt��|jt�|�|_Wd�n1s;wY|�d�dS)N�r)r%�lenr9r=�binascii�b2a_hqx�_flush)rr%ZdatalenZtodor
r
rr1hs
�z_Hqxcoderengine.writecCs�d}|t|j�|jkr-||j}|j�|j||�d�t|_|}|t|j�|jks|j|d�|_|rB|j�|jd�dSdS)Nr�
s:
)rBr=r?r<r1r>)rZforce�firstZlastr
r
rrEts
��z_Hqxcoderengine._flushcCs\|jr t��|jt�|j�|_Wd�n1swY|�d�|j��|`dS)Nr)r%r9r=rCrDrEr<r2rr
r
rr2s�

z_Hqxcoderengine.closeN)rrr	rr1rEr2r
r
r
rr;_sr;c@�&eZdZ	dd�Zdd�Zdd�ZdS)�_RlecoderenginecC�||_d|_dSr/)r<r%r@r
r
rr��
z_Rlecoderengine.__init__cCsf|j||_t|j�tkrdSt��t�|j�}Wd�n1s#wY|j�|�d|_dSr/)r%rB�REASONABLY_LARGEr9rC�rlecode_hqxr<r1)rr%�rledatar
r
rr1�s�
z_Rlecoderengine.writecCsV|jr"t��t�|j�}Wd�n1swY|j�|�|j��|`dSr+)r%r9rCrMr<r1r2)rrNr
r
rr2�s�
z_Rlecoderengine.closeN)rrr	rr1r2r
r
r
rrI�s
	rIc@�LeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�BinHexc
Cs�|\}}}}d}t|t�r|}t�|d�}d}z*|�d�t|�}	t|	�|_d|_|dur0t	�}||_
||_|�||�t
|_WdS|rK|���)NF�wbTs0(This file must be converted with BinHex 4.0)

:r)�
isinstance�strrrr1r;rIr<�crcr�dlen�rlen�
_writeinfo�_DID_HEADER�stater2)
rZname_finfo_dlen_rlenr<r"r#rUrVZclose_on_errorZofnameZhqxerr
r
rr�s*


zBinHex.__init__cCs�t|�}|dkrtd��t|g�|�d�d}|j|j}}t|t�r)|�d�}t|t�r3|�d�}||}t�	d|j
�}t�	d|j|j�}	||||	}
|�
|
�|��dS)N�?zFilename too longzlatin-1��>hz>ii)rBr�bytes�encoderrrRrS�struct�packrrUrV�_write�	_writecrc)rr"r#�nl�d�tpZcrZd2Zd3Zd4�infor
r
rrW�s




zBinHex._writeinfocCs t�||j�|_|j�|�dSr+)rC�crc_hqxrTr<r1�rr%r
r
rra�sz
BinHex._writecCs4|jdkrd}nd}|j�t�||j��d|_dS)Nrr\z>H)rTr<r1r_r`)rZfmtr
r
rrb�s


zBinHex._writecrccCs0|jtkr	td��|jt|�|_|�|�dS)NzWriting data at the wrong time)rYrXrrUrBrarhr
r
rr1�s
zBinHex.writecCs,|jdkr
td|jf��|��t|_dS)NrzIncorrect data size, diff=%r)rUrrVrb�	_DID_DATArYrr
r
r�
close_data�s

zBinHex.close_datacCsB|jtkr	|��|jtkrtd��|jt|�|_|�|�dS)Nz'Writing resource data at the wrong time)rYrirjrrVrBrarhr
r
r�
write_rsrc�s

zBinHex.write_rsrccCs�|jdurdSz2|jtkr|��|jtkrtd��|jdkr'td|jf��|��Wd|_|j}|`|��dSd|_|j}|`|��w)NzClose at the wrong timerz$Incorrect resource-datasize, diff=%r)rYrirjrrVrbr<r2r@r
r
rr2�s$




�
zBinHex.closeN)rrr	rrWrarbr1rjrkr2r
r
r
rrP�s
rPcCs�	t|�}t||�}t�|d��}	|�d�}|sn|�|�q|��Wd�n1s.wYt|d�}	|�d�}|sAn|�|�q9|�	�|�	�dS)NrT��)
r(rPrrrr1rjr)rkr2)�inp�outr#r<�ifprdr
r
rr�s&


�
�


�rc@rH)�_HqxdecoderenginecCrJ)Nr)ro�eof�rror
r
rrrKz_Hqxdecoderengine.__init__cCs�	d}|}|dkrm|jr|S|ddd}|j�|�}	zt��t�|�\}|_Wd�n1s4wYWntjyDYnw|j�d�}|sQtd��||}q||}|t|�}|si|jsitd��|dks	|S)	Nr0rrrA�TrzPremature EOF on binhex file)	rqrorr9rCZa2b_hqxZ
IncompleterrB)rZtotalwtdZdecdata�wtdr%Z
decdatacur�newdatar
r
rrs6
���
�z_Hqxdecoderengine.readcC�|j��dSr+�ror2rr
r
rr2:�z_Hqxdecoderengine.closeN)rrr	rrr2r
r
r
rrps
!rpc@r:)
�_RledecoderenginecCs||_d|_d|_d|_dS)Nr0r)ro�
pre_buffer�post_bufferrqrrr
r
rr@s
z_Rledecoderengine.__init__cCsD|t|j�kr|�|t|j��|jd|�}|j|d�|_|Sr+)rBr{�_fill)rrt�rvr
r
rrFs
z_Rledecoderengine.readcCs@|j|j�|d�|_|jjr2t��|jt�|j�|_Wd�n1s(wYd|_dSt|j�}|jdd�t	dt	krI|d}n,|jdd�t	krW|d}n|jdd�t	dkrg|d}n|jdd�t	krqn|d	}t��|jt�|jd|��|_Wd�n1s�wY|j|d�|_dS)
Nrsr0���r[rA���r���r)
rzrorrqr9r{rCZ
rledecode_hqxrB�RUNCHAR)rrtZmarkr
r
rr|Ms2
��




��z_Rledecoderengine._fillcCrvr+rwrr
r
rr2rrxz_Rledecoderengine.closeN)rrr	rrr|r2r
r
r
rry=s%ryc@rO)�HexBincCsht|t�rt�|d�}	|�d�}|std��|dkrq|dkr!nqt|�}t|�|_d|_	|�
�dS)NrTrzNo binhex data foundrF�:r)rRrSrrrrrpryrorT�_readheader)rroZchZhqxifpr
r
rrvs

�
zHexBin.__init__cCs |j�|�}t�||j�|_|Sr+)rorrCrgrT)rrBr%r
r
r�_read�szHexBin._readcCsNt�d|j�d��dd@}|jd@|_||jkr"td|j|f��d|_dS)Nr\rri��zCRC error, computed %x, read %x)r_�unpackrorrTr)rZfilecrcr
r
r�	_checkcrc�s
�
zHexBin._checkcrccCs�|�d�}|�t|��}|�d�}|��|dd�}|dd�}t�d|dd��d}t�d|dd	��d|_t�d|d	d��d|_||_t�|_||j_	||j_
||j_t|_
dS)
Nr���	r\�rz>l�)r��ordr�r_r�rUrV�FNamerrrrrXrY)rrBZfname�rest�typeZcreator�flagsr
r
rr��s


zHexBin._readheadercGst|jtkr	td��|r|d}t||j�}n|j}d}t|�|kr2||�|t|��}t|�|ks!|j||_|S)NzRead data at wrong timerr0)rYrXr�minrUrBr�)r�nr}r
r
rr�s
�zHexBin.readcCs6|jtkr	td��|jr|�|j�}|��t|_dS)Nzclose_data at wrong time)rYrXrrUr�r�ri�rZdummyr
r
rrj�s

zHexBin.close_datacGsZ|jtkr	|��|jtkrtd��|r|d}t||j�}n|j}|j||_|�|�S)Nz Read resource data at wrong timer)rYrXrjrirr�rVr�)rr�r
r
r�	read_rsrc�s


zHexBin.read_rsrccCsR|jdurdSz|jr|�|j�}|��Wd|_|j��dSd|_|j��wr+)rYrVr�r�ror2r�r
r
rr2�s

�zHexBin.closeN)rrr	rr�r�r�rrjr�r2r
r
r
rr�us

r�cCs�	t|�}|j}|s
|j}t�|d��}	|�d�}|sn|�|�qWd�n1s-wY|��|�d�}|rZt	|d�}|�|�	|�d�}|sPn|�|�qH|�
�|�
�dS)NrQTrl)r�rr�rrrr1rjr�r)r2)rmrnror#r<rdr
r
rr�s2

��




�r)rC�
contextlibrrr_r5�warnr8�__all__�	ExceptionrrXrirLr>r�rr(r)�contextmanagerr9r;rIrPrrpryr�rr
r
r
r�<module>s<�

(^+8h

?>