Your IP : 3.145.44.46


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

o

6��f:@�@s�	ddlZddlZddlZddlmZgd�Zdad$ddddd�dd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZGdd�d�Zddd�dd�Zd%dd �Zd!d"�Zed#kree�dSdS)&�N)�GenericAlias)�input�close�nextfile�filename�lineno�
filelineno�fileno�isfirstline�isstdin�	FileInput�hook_compressed�hook_encodedF��r��mode�openhook�encoding�errorsc	Cs.	tr
tjr
td��t|||||||d�atS)Nzinput() already activer)�_state�_file�RuntimeErrorr)�files�inplace�backuprrrr�r�0/opt/alt/python310/lib64/python3.10/fileinput.pyrNs
�rcCs	t}da|r
|��dSdS�N)rr)�staterrrr]s�rcC�	tstd��t��S�Nzno active input())rrrrrrrres	rcCr r!)rrrrrrrrs�rcCr r!)rrrrrrrr|�rcCr r!)rrrrrrrr�r#rcCr r!)rrr	rrrrr	�r"r	cCr r!)rrr
rrrrr
�r"r
cCr r!)rrrrrrrr�r"rc@s�eZdZ	d(ddddd�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NFrrrc	CsPt|t�r	|f}n!t|tj�rt�|�f}n|dur!tjdd�}|s&d}nt|�}||_||_	||_
d|_d|_d|_
d|_d|_d|_d|_d|_||_||_tjjrld|vrl|durl|durlddl}|�dtd�|dvrttd	��d
|vr�ddl}|�dtd�||_d
|vr�|�dd
�nd
|_|r�|r�td��t|�s�td��||_ dS)N�)�-rF�bz"'encoding' argument not specified.�)rZrU�U�rbz=FileInput opening mode must be one of 'r', 'rU', 'U' and 'rb'r(z'U' mode is deprecatedr�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�	_encoding�_errors�flags�warn_default_encoding�warnings�warn�EncodingWarning�
ValueError�DeprecationWarning�_mode�replace�_write_mode�callable�	_openhook)	�selfrrrrrrrrArrr�__init__�sV
��
zFileInput.__init__cC�|��dSr�r�rKrrr�__del__��zFileInput.__del__cCsz
|��Wd|_dSd|_w)Nr)rr3rOrrrr�s
zFileInput.closecC�|SrrrOrrr�	__enter__��zFileInput.__enter__cCrMrrN)rK�type�value�	tracebackrrr�__exit__�rQzFileInput.__exit__cCrRrrrOrrr�__iter__�rTzFileInput.__iter__cCs4	|��}|r|jd7_|S|jst�|��q�NTr$)�	_readliner:r�
StopIterationr�rK�linerrr�__next__���zFileInput.__next__cCsNddl}|jdtdd�||��krtd��z|��WSty&td��w)NrzTSupport for indexing FileInput objects is deprecated. Use iterator protocol instead.r')�
stacklevelzaccessing lines out of orderzend of input reached)rArBrErrr_r\�
IndexError)rK�irArrr�__getitem__	s�
�zFileInput.__getitem__cCs�|j}d|_|r|t_|j}d|_zm|r|��W|j}d|_z|`Wn	ty,Ynwz+|r7|js7|��W|j	}d|_	|rT|j
sTzt�|�Wn	t
ySYnwd|_dS|j	}d|_	|r{|j
s{z
t�|�Wd|_wt
yzYd|_wwd|_w|j}d|_z|`Wn	ty�Ynwz0|r�|js�|��W|j	}d|_	|r�|j
s�z
t�|�Wd|_wt
y�Yd|_wwd|_w|j	}d|_	|r�|j
s�z
t�|�Wd|_wt
y�Yd|_wwd|_w)NF)r6r0�stdoutr7rrr[�AttributeErrorr;r<r5r-�unlink�OSError)rKZ
savestdout�output�fileZbackupfilenamerrrrs���
�

�
����
�
���
��zFileInput.nextfilecCs4	|��}|r|jd7_|S|js|S|��qrZ)r[r:rrr]rrr�readline6r`zFileInput.readlinec	CsP|jsd|jvr
dSdS|jd|_|jdd�|_|��|_d|_d|_d|_d|_d|jvr6|j	p4d}nd}|jdkrWd	|_d|jvrOt
tjd
tj�|_ntj|_d|_n�|j
r�t�|j�|jpcd|_zt�|j�Wn	tywYnwt�|j|j�t|j|j||jd
�|_zt�|j���j}Wnty�t|j|j||jd
�|_Yn;wtjtjBtjB}ttd�r�|tjO}t�|j||�}tj ||j||jd
�|_z	t�!|j|�Wn	ty�Ynwtj"|_#|jt_"n/|j$�r|j	du�r|�$|j|j�|_n|j$|j|j|j	|jd
�|_nt|j|j||jd
�|_|jj%|_&|�&�S)Nr&�rrr$F�localer%z<stdin>�bufferTz.bak�rr�O_BINARY)'r3rFr8rr9r:rr;r<r=�getattrr0�stdinr4r-r/r5rgrh�rename�openr>�fstatr	�st_moderHr7�O_CREAT�O_WRONLY�O_TRUNC�hasattrrp�fdopen�chmodrer6rJrkr[)rKrZpermr�fdrrrr[As|




��
�
��


��

�
zFileInput._readlinecC�|jSr)r8rOrrrr��zFileInput.filenamecCs|j|jSr)r9r:rOrrrr�rQzFileInput.linenocCr~r�r:rOrrrr�rzFileInput.filelinenocCs,|jrz|j��WStyYdSwdS)N���)rr	rDrOrrrr	�s�zFileInput.filenocCs
|jdkS)Nr$r�rOrrrr
�s
zFileInput.isfirstlinecCr~r)r;rOrrrr�rzFileInput.isstdin�NFr)�__name__�
__module__�__qualname__rLrPrrSrXrYr_rdrrkr[rrrr	r
r�classmethodr�__class_getitem__rrrrr�s,�4I	rrocCs�|dur
d|vr
d}tj�|�d}|dkr!ddl}|�||�}n|dkr0ddl}|�||�}nt||||d�Sd|vrDtj|||d�}|S)Nr&rmr$z.gzrz.bz2ro)	r-�path�splitext�gziprt�bz2ZBZ2File�io�
TextIOWrapper)rrrrZextr��streamr�rrrr
�sr
cs��fdd�}|S)Ncst||��d�S)Nro)rt)rrrorrr�szhook_encoded.<locals>.openhookr)rrrrrorr�srcCs�ddl}d}d}|�tjdd�d�\}}|D]\}}|dkr!d}|dkr'|}qt|||d�D]1}|d	d�d
kr?|dd	�}|d	d�dkrM|dd	�}tdt�t�t�t�rZd
p[d|f�q/tdt�t�t�f�dS)NrFr$zib:z-iTz-b)rrr��
�
z%d: %s[%d]%s %s�*rz
%d: %s[%d])	�getoptr0r1r�printrrrr
)r�rrZopts�args�o�ar^rrr�_test�s�
�r��__main__r�r)r�r0r-�typesr�__all__rrrrrrrr	r
rrr
rr�r�rrrr�<module>s2C�	

			{

�

?>