Your IP : 18.191.238.6


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

a

R�f�9�@s�ddlZddlZddlmZgd�Zdad#ddd�dd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZGdd�d�Zdd�Zd$dd�Zd d!�Zed"kr�e�dS)%�N)�GenericAlias)�input�close�nextfile�filename�lineno�
filelineno�fileno�isfirstline�isstdin�	FileInput�hook_compressed�hook_encodedF��r��mode�openhookcCs(trtjrtd��t|||||d�atS)Nzinput() already activer)�_state�_file�RuntimeErrorr)�files�inplace�backuprr�r�./opt/alt/python39/lib64/python3.9/fileinput.pyrTs
rcCst}da|r|��dS�N)rr)�staterrrrasrcCststd��t��S�Nzno active input())rrrrrrrris
rcCststd��t��Sr)rrrrrrrrwsrcCststd��t��Sr)rrrrrrrr�srcCststd��t��Sr)rrrrrrrr�srcCststd��t��Sr)rrr	rrrrr	�sr	cCststd��t��Sr)rrr
rrrrr
�sr
cCststd��t��Sr)rrrrrrrr�src@s�eZdZd(ddd�dd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zee�ZdS))rNFrrrcCst|t�r|f}nBt|tj�r,t�|�f}n(|durBtjdd�}|sLd}nt|�}||_||_	||_
d|_d|_d|_
d|_d|_d|_d|_d|_|dvr�td��d|vr�ddl}|�dtd	�||_d|vr�|�d
d�nd|_|�r|r�td��t|��std
��||_dS)N�)�-rF)rZrU�U�rbz=FileInput opening mode must be one of 'r', 'rU', 'U' and 'rb'r!z'U' mode is deprecated�r�wz4FileInput cannot use an opening hook in inplace modez#FileInput openhook must be callable)�
isinstance�str�os�PathLike�fspath�sys�argv�tuple�_files�_inplace�_backup�_savestdout�_output�	_filename�_startlineno�_filelinenor�_isstdin�_backupfilename�
ValueError�warnings�warn�DeprecationWarning�_mode�replace�_write_mode�callable�	_openhook)�selfrrrrrr8rrr�__init__�sF
�
zFileInput.__init__cCs|��dSr�r�r@rrr�__del__�szFileInput.__del__cCs z|��Wd|_nd|_0dS)Nr)rr-rCrrrr�s
zFileInput.closecCs|SrrrCrrr�	__enter__�szFileInput.__enter__cCs|��dSrrB)r@�type�value�	tracebackrrr�__exit__�szFileInput.__exit__cCs|SrrrCrrr�__iter__�szFileInput.__iter__cCs6|��}|r|jd7_|S|js(t�|��qdS�Nr)�	_readliner4r�
StopIterationr�r@�linerrr�__next__�szFileInput.__next__cCsVddl}|jdtdd�||��kr,td��z
|��WStyPtd��Yn0dS)NrzTSupport for indexing FileInput objects is deprecated. Use iterator protocol instead.r#)�
stacklevelzaccessing lines out of orderzend of input reached)r8r9r:rrrPrM�
IndexError)r@�ir8rrr�__getitem__s�
zFileInput.__getitem__cCs�|j}d|_|r|t_|j}d|_z�|r0|��W|j}d|_z|`WntyXYn0zT|rn|jsn|��W|j	}d|_	|r�|j
s�zt�|�Wnt
y�Yn0d|_n@|j	}d|_	|r�|j
s�zt�|�Wnt
y�Yn0d|_0n�|j}d|_z|`Wnt�yYn0z^|�r4|j�s4|��W|j	}d|_	|�rt|j
�stzt�|�Wnt
�yrYn0d|_nF|j	}d|_	|�r�|j
�s�zt�|�Wnt
�y�Yn0d|_00dS)NF)r0r*�stdoutr1rrrL�AttributeErrorr5r6r/r'�unlink�OSError)r@Z
savestdout�output�fileZbackupfilenamerrrrsf



�

�
�zFileInput.nextfilecCs6|��}|r|jd7_|S|js(|S|��qdSrK)rLr4rrrNrrr�readline/szFileInput.readlinecCs�|jsd|jvrdSdS|jd|_|jdd�|_|��|_d|_d|_d|_d|_|jdkr�d|_d|jvr�t	t
jd	t
j�|_nt
j|_d
|_�nN|j�r�t
�|j�|jp�d|_zt
�|j�Wnty�Yn0t
�|j|j�t|j|j�|_zt
�|j���j}Wn$t�y4t|j|j�|_Ynr0t
jt
jBt
jB}tt
d��r^|t
jO}t
�|j||�}t
�||j�|_zt
�|j|�Wnt�y�Yn0t
j |_!|jt
_ n,|j"�r�|�"|j|j�|_nt|j|j�|_|jj#|_$|�$�S)
N�b�rrrFr z<stdin>�bufferTz.bak�O_BINARY)%r-r;r2rr3r4rr5r6�getattrr*�stdinr.r'r)r/rWrX�rename�open�fstatr	�st_moder=r1�O_CREAT�O_WRONLY�O_TRUNC�hasattrr_�fdopen�chmodrUr0r?r[rL)r@Zpermr�fdrrrrL:s\




�


zFileInput._readlinecCs|jSr)r2rCrrrrsszFileInput.filenamecCs|j|jSr)r3r4rCrrrrvszFileInput.linenocCs|jSr�r4rCrrrryszFileInput.filelinenocCs2|jr*z|j��WSty&YdS0ndSdS)N���)rr	r7rCrrrr	|s
zFileInput.filenocCs
|jdkSrKrmrCrrrr
�szFileInput.isfirstlinecCs|jSr)r5rCrrrr�szFileInput.isstdin)NFr)�__name__�
__module__�__qualname__rArDrrErIrJrPrTrr[rLrrrr	r
r�classmethodr�__class_getitem__rrrrr�s(
�)9	rcCsVtj�|�d}|dkr,ddl}|�||�S|dkrHddl}|�||�St||�SdS)Nrz.gzrz.bz2)r'�path�splitext�gziprc�bz2ZBZ2File)rrZextrvrwrrrr
�sr
cs��fdd�}|S)Ncst||��d�S)N��encoding�errors)rc)rrrxrrr�szhook_encoded.<locals>.openhookr)ryrzrrrxrr�srcCs�ddl}d}d}|�tjdd�d�\}}|D] \}}|dkrBd}|dkr.|}q.t|||d�D]b}|d	d�d
kr~|dd	�}|d	d�dkr�|dd	�}tdt�t�t�t�r�d
p�d|f�q^tdt�t�t�f�dS)NrFrzib:z-iTz-b)rrrn�
�
z%d: %s[%d]%s %s�*rz
%d: %s[%d])	�getoptr*r+r�printrrrr
)r~rrZopts�args�o�arOrrr�_test�s�
r��__main__)NFr)N)r*r'�typesr�__all__rrrrrrrr	r
rrr
rr�rorrrr�<module>Ks&
	

			`


?>