Your IP : 3.17.181.181


Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/binhex.cpython-39.opt-2.pyc

a

R�f�9�@sddlZddlZddlZddlZddlZddlZejdedd�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/python39/lib64/python3.9/binhex.pyr%sr�i��@��c@seZdZdd�ZdS)�FInfocCsd|_d|_d|_dS)Nz????r)�Type�Creator�Flags��selfr
r
r�__init__6szFInfo.__init__N)rrr	rr
r
r
rr5srcCs�t�}t�|d��<}|�d�}d|vr,d|_|�dd�|��}Wd�n1sT0Ytj�	|�\}}|�
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)
�openrsrccGsdS�Nr
�r�argsr
r
rrIszopenrsrc.__init__cGsdS�N�r
r+r
r
rrLsz
openrsrc.readcGsdSr*r
r+r
r
r�writeOszopenrsrc.writecCsdSr*r
rr
r
r�closeRszopenrsrc.closeN)rrr	rrr/r0r
r
r
rr)Hsr)ccs@t���$t�ddt�dVWd�n1s20YdS)N�ignore�)�warnings�catch_warnings�filterwarnings�DeprecationWarningr
r
r
r�_ignore_deprecation_warningXs
r7c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_HqxcoderenginecCs ||_d|_d|_td|_dS)Nr.r)�ofpr%�hqxdata�LINELEN�linelen�rr9r
r
rrbsz_Hqxcoderengine.__init__cCs�|j||_t|j�}|dd}|jd|�}|j|d�|_|sHdSt��"|jt�|�|_Wd�n1sv0Y|�d�dS)N�r)r%�lenr7r:�binascii�b2a_hqx�_flush)rr%ZdatalenZtodor
r
rr/hs
0z_Hqxcoderengine.writecCsrd}|t|j�|jkrH||j}|j�|j||�d�t|_|}q|j|d�|_|rn|j�|jd�dS)Nr�
s:
)r?r:r<r9r/r;)rZforce�firstZlastr
r
rrBts
z_Hqxcoderengine._flushcCs\|jr@t��$|jt�|j�|_Wd�n1s60Y|�d�|j��|`dS)Nr)r%r7r:r@rArBr9r0rr
r
rr0s2

z_Hqxcoderengine.closeN)rrr	rr/rBr0r
r
r
rr8_sr8c@s$eZdZdd�Zdd�Zdd�ZdS)�_RlecoderenginecCs||_d|_dSr-)r9r%r=r
r
rr�sz_Rlecoderengine.__init__cCsf|j||_t|j�tkrdSt��t�|j�}Wd�n1sF0Y|j�|�d|_dSr-)r%r?�REASONABLY_LARGEr7r@�rlecode_hqxr9r/)rr%�rledatar
r
rr/�s*z_Rlecoderengine.writecCsV|jrDt��t�|j�}Wd�n1s.0Y|j�|�|j��|`dSr*)r%r7r@rGr9r/r0)rrHr
r
rr0�s*
z_Rlecoderengine.closeN)rrr	rr/r0r
r
r
rrE�s	rEc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�BinHexc
Cs�|\}}}}d}t|t�r.|}t�|d�}d}zR|�d�t|�}	t|	�|_d|_|dur`t	�}||_
||_|�||�t
|_Wn|r�|���Yn0dS)NF�wbTs0(This file must be converted with BinHex 4.0)

:r)�
isinstance�strrrr/r8rEr9�crcr�dlen�rlen�
_writeinfo�_DID_HEADER�stater0)
rZname_finfo_dlen_rlenr9r"r#rNrOZclose_on_errorZofnameZhqxerr
r
rr�s*



zBinHex.__init__cCs�t|�}|dkrtd��t|g�|�d�d}|j|j}}t|t�rR|�d�}t|t�rf|�d�}||}t�	d|j
�}t�	d|j|j�}	||||	}
|�
|
�|��dS)N�?zFilename too longzlatin-1��>hz>ii)r?r�bytes�encoderrrKrL�struct�packrrNrO�_write�	_writecrc)rr"r#�nl�d�tpZcrZd2Zd3Zd4�infor
r
rrP�s




zBinHex._writeinfocCs t�||j�|_|j�|�dSr*)r@�crc_hqxrMr9r/�rr%r
r
rrZ�sz
BinHex._writecCs4|jdkrd}nd}|j�t�||j��d|_dS)NrrUz>H)rMr9r/rXrY)rZfmtr
r
rr[�s

zBinHex._writecrccCs0|jtkrtd��|jt|�|_|�|�dS)NzWriting data at the wrong time)rRrQrrNr?rZrar
r
rr/�s
zBinHex.writecCs,|jdkrtd|jf��|��t|_dS)NrzIncorrect data size, diff=%r)rNrrOr[�	_DID_DATArRrr
r
r�
close_data�s
zBinHex.close_datacCsB|jtkr|��|jtkr$td��|jt|�|_|�|�dS)Nz'Writing resource data at the wrong time)rRrbrcrrOr?rZrar
r
r�
write_rsrc�s

zBinHex.write_rsrccCs�|jdurdSzb|jtkr"|��|jtkr4td��|jdkrNtd|jf��|��Wd|_|j}|`|��nd|_|j}|`|��0dS)NzClose at the wrong timerz$Incorrect resource-datasize, diff=%r)rRrbrcrrOr[r9r0r=r
r
rr0�s$





�zBinHex.closeN)rrr	rrPrZr[r/rcrdr0r
r
r
rrI�s
rIcCs�t|�}t||�}t�|d��4}|�d�}|s0q<|�|�q |��Wd�n1sX0Yt|d�}|�d�}|s|q�|�|�ql|�	�|�	�dS)Nr��)
r(rIrrrr/rcr)rdr0)�inp�outr#r9�ifpr]r
r
rr�s

&

rc@s$eZdZdd�Zdd�Zdd�ZdS)�_HqxdecoderenginecCs||_d|_dS)Nr)rh�eof�rrhr
r
rrsz_Hqxdecoderengine.__init__cCs�d}|}|dkr�|jr|S|ddd}|j�|�}z>t�� t�|�\}|_Wd�n1sd0YWq�Wntjy�Yn0|j�d�}|s�td��||}q6||}|t|�}|s|jstd��q|S)Nr.rrr>�rzPremature EOF on binhex file)	rjrhrr7r@Za2b_hqxZ
Incompleterr?)rZtotalwtdZdecdata�wtdr%Z
decdatacur�newdatar
r
rrs*
.


z_Hqxdecoderengine.readcCs|j��dSr*�rhr0rr
r
rr0:sz_Hqxdecoderengine.closeN)rrr	rrr0r
r
r
rris!ric@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_RledecoderenginecCs||_d|_d|_d|_dS)Nr.r)rh�
pre_buffer�post_bufferrjrkr
r
rr@sz_Rledecoderengine.__init__cCsD|t|j�kr"|�|t|j��|jd|�}|j|d�|_|Sr*)r?rr�_fill)rrm�rvr
r
rrFs
z_Rledecoderengine.readcCsB|j|j�|d�|_|jjrdt��$|jt�|j�|_Wd�n1sP0Yd|_dSt|j�}|jdd�t	dt	kr�|d}nX|jdd�t	kr�|d}n<|jdd�t	dkr�|d}n|jdd�t	kr�n|d	}t��,|jt�|jd|��|_Wd�n1�s$0Y|j|d�|_dS)
Nrlr.���rTr>���r���r)
rqrhrrjr7rrr@Z
rledecode_hqxr?�RUNCHAR)rrmZmarkr
r
rrsMs.
�$



�&z_Rledecoderengine._fillcCs|j��dSr*rorr
r
rr0rsz_Rledecoderengine.closeN)rrr	rrrsr0r
r
r
rrp=s%rpc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�HexBincCsft|t�rt�|d�}|�d�}|s,td��|dkr6q|dkrqBqt|�}t|�|_d|_	|�
�dS)NrrzNo binhex data foundrC�:r)rKrLrrrrrirprhrM�_readheader)rrhZchZhqxifpr
r
rrvs


zHexBin.__init__cCs |j�|�}t�||j�|_|Sr*)rhrr@r`rM)rr?r%r
r
r�_read�szHexBin._readcCsNt�d|j�d��dd@}|jd@|_||jkrDtd|j|f��d|_dS)NrUrri��zCRC error, computed %x, read %x)rX�unpackrhrrMr)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���	rU�rz>l�)r|�ordr~rXr}rNrO�FNamerrrrrQrR)rr?Zfname�rest�typeZcreator�flagsr
r
rr{�s

zHexBin._readheadercGsj|jtkrtd��|r,|d}t||j�}n|j}d}t|�|krZ||�|t|��}q6|j||_|S)NzRead data at wrong timerr.)rRrQr�minrNr?r|)r�nrtr
r
rr�s
zHexBin.readcCs6|jtkrtd��|jr$|�|j�}|��t|_dS)Nzclose_data at wrong time)rRrQrrNr|r~rb�rZdummyr
r
rrc�s
zHexBin.close_datacGsZ|jtkr|��|jtkr$td��|r>|d}t||j�}n|j}|j||_|�|�S)Nz Read resource data at wrong timer)rRrQrcrbrr�rOr|)rr�r
r
r�	read_rsrc�s

zHexBin.read_rsrccCsT|jdurdSz.|jr"|�|j�}|��Wd|_|j��nd|_|j��0dSr*)rRrOr�r~rhr0r�r
r
rr0�s

�zHexBin.closeN)rrr	rr|r~r{rrcr�r0r
r
r
rryus

rycCs�t|�}|j}|s|j}t�|d��,}|�d�}|s6qB|�|�q&Wd�n1sV0Y|��|�d�}|r�t	|d�}|�|�|�d�}|s�q�|�|�q�|�
�|�
�dS)NrJre)ryrr�rrrr/rcr�r)r0)rfrgrhr#r9r]r
r
rr�s$
*



r)r@�
contextlibrrrXr3�warnr6�__all__�	ExceptionrrQrbrFr;rxrr(r)�contextmanagerr7r8rErIrrirpryrr
r
r
r�<module>s8�

(^+8h

?>