AlkantarClanX12

Your IP : 18.220.112.210


Current Path : /lib64/python3.8/__pycache__/
Upload File :
Current File : //lib64/python3.8/__pycache__/_pyio.cpython-38.opt-2.pyc

U

e5d�k�@sxddlZddlZddlZddlZddlZddlZddlmZej	dkrTddl
mZndZddl
Z
ddl
mZmZmZmZdddhZeed�r�e�ej�e�ej�d	ZeZeed
�p�ejjZd6dd�Zdd�Zz
e
jZWnek
�r�eZYnXGdd�d�Z Gdd�d�Z!z
e
j"Z"Wn(ek
�rDGdd�de#e$�Z"YnXGdd�dej%d�Z&e
j&�'e&�Gdd�de&�Z(e
j(�'e(�ddl)m*Z*e(�'e*�Gdd�de&�Z+e
j+�'e+�Gd d!�d!e+�Z,Gd"d#�d#e+�Z-Gd$d%�d%e,�Z.Gd&d'�d'e,�Z/Gd(d)�d)e+�Z0Gd*d+�d+e/e.�Z1Gd,d-�d-e(�Z*Gd.d/�d/e&�Z2e
j2�'e2�Gd0d1�d1ej3�Z4Gd2d3�d3e2�Z5Gd4d5�d5e5�Z6dS)7�N)�
allocate_lock>�win32�cygwin)�setmode)�__all__�SEEK_SET�SEEK_CUR�SEEK_END���	SEEK_HOLEi Zgettotalrefcount�r���Tc	Cs�t|t�st�|�}t|tttf�s0td|��t|t�sFtd|��t|t�s\td|��|dk	rzt|t�sztd|��|dk	r�t|t�s�td|��t|�}|td�s�t|�t|�kr�t	d|��d|k}	d|k}
d	|k}d
|k}d|k}
d|k}d
|k}d|k�rD|	�s"|�s"|�s"|
�r*t	d��ddl
}|�dtd�d}
|�rX|�rXt	d��|	|
||dk�rvt	d��|	�s�|
�s�|�s�|�s�t	d��|�r�|dk	�r�t	d��|�r�|dk	�r�t	d��|�r�|dk	�r�t	d��|�r|dk�rddl
}|�dt
d�t||	�rd�pd|
�r"d�p$d|�r2d	�p4d|�rBd
�pDd|
�rRd�pTd||d�}|}�z$d}|dk�s�|dk�r�|���r�d}d}|dk�r�t}zt�|���j}Wnttfk
�r�YnX|dk�r�|}|dk�r�t	d ��|dk�r|�r|WSt	d!��|
�r t||�}n<|	�s2|�s2|�r>t||�}n|
�rPt||�}nt	d"|��|}|�rl|WSt|||||�}|}||_|WS|���YnXdS)#Nzinvalid file: %rzinvalid mode: %rzinvalid buffering: %r�invalid encoding: %r�invalid errors: %rzaxrwb+tU�xr
�w�a�+�t�b�Uz4mode U cannot be combined with 'x', 'w', 'a', or '+'rz'U' mode is deprecatedrTz'can't have text and binary mode at oncer
z)can't have read/write/append mode at oncez/must have exactly one of read/write/append modez-binary mode doesn't take an encoding argumentz+binary mode doesn't take an errors argumentz+binary mode doesn't take a newline argumentzaline buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used�)�openerFrzinvalid buffering sizezcan't have unbuffered text I/Ozunknown mode: %r)�
isinstance�int�os�fspath�str�bytes�	TypeError�set�len�
ValueError�warnings�warn�DeprecationWarning�RuntimeWarning�FileIO�isatty�DEFAULT_BUFFER_SIZE�fstat�fileno�
st_blksize�OSError�AttributeError�BufferedRandom�BufferedWriter�BufferedReader�
TextIOWrapper�mode�close)�filer4�	buffering�encoding�errors�newline�closefdrZmodesZcreatingZreadingZwritingZ	appendingZupdating�textZbinaryr$�raw�result�line_bufferingZbs�buffer�rA�/usr/lib64/python3.8/_pyio.py�open)s�{




�������



rCcCs ddl}|�dtd�t|d�S)Nrz(_pyio.open_code() may not be using hooksr�rb)r$r%r'rC)�pathr$rArArB�_open_code_with_warnings�rFc@seZdZddd�ZdS)�
DocDescriptorNcCs
dtjS)Nz\open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True)

)rC�__doc__)�self�obj�typrArArB�__get__s��zDocDescriptor.__get__)N)�__name__�
__module__�__qualname__rLrArArArBrGsrGc@seZdZe�Zdd�ZdS)�OpenWrappercOs
t||�S�N)rC)�cls�args�kwargsrArArB�__new__,szOpenWrapper.__new__N)rMrNrOrGrHrUrArArArBrP"srPc@seZdZdS)�UnsupportedOperationN)rMrNrOrArArArBrV5srVc@s�eZdZdd�Zd5dd�Zdd�Zd6d	d
�Zdd�Zd
Zdd�Z	dd�Z
dd�Zd7dd�Zdd�Z
d8dd�Zdd�Zd9dd�Zedd��Zd:d d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd;d+d,�Zd-d.�Zd/d0�Zd<d1d2�Zd3d4�ZdS)=�IOBasecCstd|jj|f��dS)Nz%s.%s() not supported)rV�	__class__rM)rI�namerArArB�_unsupported\s
�zIOBase._unsupportedrcCs|�d�dS)N�seek�rZ�rI�pos�whencerArArBr[cszIOBase.seekcCs|�dd�S�Nrr
)r[�rIrArArB�tellsszIOBase.tellNcCs|�d�dS�N�truncater\�rIr^rArArBrdwszIOBase.truncatecCs|��dSrQ��_checkClosedrarArArB�flush�szIOBase.flushFcCs |jsz|��W5d|_XdS)NT)�_IOBase__closedrhrarArArBr5�szIOBase.closecCsVz
|j}Wntk
r YdSX|r*dStr8|��nz|��WnYnXdSrQ)�closedr/�_IOBASE_EMITS_UNRAISABLEr5)rIrjrArArB�__del__�s

zIOBase.__del__cCsdS�NFrArarArArB�seekable�szIOBase.seekablecCs |��st|dkrdn|��dS)NzFile or stream is not seekable.)rnrV�rI�msgrArArB�_checkSeekable�s��zIOBase._checkSeekablecCsdSrmrArarArArB�readable�szIOBase.readablecCs |��st|dkrdn|��dS)NzFile or stream is not readable.)rrrVrorArArB�_checkReadable�s��zIOBase._checkReadablecCsdSrmrArarArArB�writable�szIOBase.writablecCs |��st|dkrdn|��dS)NzFile or stream is not writable.)rtrVrorArArB�_checkWritable�s��zIOBase._checkWritablecCs|jSrQ)rirarArArBrj�sz
IOBase.closedcCs|jrt|dkrdn|��dS�N�I/O operation on closed file.�rjr#rorArArBrg�s��zIOBase._checkClosedcCs|��|SrQrfrarArArB�	__enter__�szIOBase.__enter__cGs|��dSrQ)r5)rIrSrArArB�__exit__�szIOBase.__exit__cCs|�d�dS)Nr,r\rarArArBr,�sz
IOBase.filenocCs|��dSrmrfrarArArBr)sz
IOBase.isattyrcs�t�d�r��fdd�}ndd�}�dkr0d�n4z
�j}Wn"tk
r\t��d���YnX|��t�}�dks~t|��kr���|��}|s�q�||7}|�d�rjq�qjt|�S)	N�peekcs>��d�}|sdS|�d�dp&t|�}�dkr:t|��}|S)Nr
�
r)r{�findr"�min)Z	readahead�n�rI�sizerArB�
nreadaheads

z#IOBase.readline.<locals>.nreadaheadcSsdS�Nr
rArArArArBr� sr� is not an integerrr|)	�hasattr�	__index__r/r �	bytearrayr"�read�endswithr)rIr�r��
size_index�resrrAr�rB�readlines&
	

zIOBase.readlinecCs|��|SrQrfrarArArB�__iter__5szIOBase.__iter__cCs|��}|st�|SrQ)r��
StopIteration�rI�linerArArB�__next__9szIOBase.__next__cCsP|dks|dkrt|�Sd}g}|D]&}|�|�|t|�7}||kr$qLq$|S�Nr)�list�appendr")rIZhintr�linesr�rArArB�	readlines?s
zIOBase.readlinescCs |��|D]}|�|�qdSrQ)rg�write)rIr�r�rArArB�
writelinesQszIOBase.writelines)r)N)N)N)N)N)r)N)rMrNrOrZr[rbrdrhrir5rlrnrqrrrsrtru�propertyrjrgryrzr,r)r�r�r�r�r�rArArArBrW9s4#







	

*
rW)�	metaclassc@s.eZdZddd�Zdd�Zdd�Zdd	�Zd
S)�	RawIOBasercCsP|dkrd}|dkr|��St|���}|�|�}|dkr>dS||d�=t|�S)Nrr)�readallr�r��readintor)rIr�rrrArArBr�ls

zRawIOBase.readcCs4t�}|�t�}|sq ||7}q|r,t|�S|SdSrQ)r�r�r*r)rIr��datarArArBr�}s

zRawIOBase.readallcCs|�d�dS)Nr�r\�rIrrArArBr��szRawIOBase.readintocCs|�d�dS�Nr�r\r�rArArBr��szRawIOBase.writeN)r)rMrNrOr�r�r�r�rArArArBr�^s
r�)r(c@sHeZdZddd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�BufferedIOBasercCs|�d�dS�Nr�r\r�rArArBr��szBufferedIOBase.readcCs|�d�dS)N�read1r\r�rArArBr��szBufferedIOBase.read1cCs|j|dd�S)NF�r���	_readintor�rArArBr��szBufferedIOBase.readintocCs|j|dd�S)NTr�r�r�rArArB�	readinto1�s	zBufferedIOBase.readinto1cCsVt|t�st|�}|�d�}|r0|�t|��}n|�t|��}t|�}||d|�<|S�N�B)r�
memoryview�castr�r"r�)rIrr�r�rrArArBr��s

zBufferedIOBase._readintocCs|�d�dSr�r\r�rArArBr��s	zBufferedIOBase.writecCs|�d�dS�N�detachr\rarArArBr��szBufferedIOBase.detachN)r)r)
rMrNrOr�r�r�r�r�r�r�rArArArBr��s

r�c@s�eZdZdd�Zd#dd�Zdd�Zd$d	d
�Zdd�Zd
d�Zdd�Z	dd�Z
edd��Zedd��Z
edd��Zedd��Zdd�Zdd�Zdd �Zd!d"�ZdS)%�_BufferedIOMixincCs
||_dSrQ��_raw�rIr=rArArB�__init__sz_BufferedIOMixin.__init__rcCs"|j�||�}|dkrtd��|S)Nrz#seek() returned an invalid position)r=r[r.)rIr^r_Znew_positionrArArBr[sz_BufferedIOMixin.seekcCs|j��}|dkrtd��|S)Nrz#tell() returned an invalid position)r=rbr.rerArArBrbs
z_BufferedIOMixin.tellNcCs$|��|dkr|��}|j�|�SrQ)rhrbr=rdrerArArBrd$sz_BufferedIOMixin.truncatecCs|jrtd��|j��dS)N�flush on closed file)rjr#r=rhrarArArBrh2sz_BufferedIOMixin.flushcCs.|jdk	r*|js*z|��W5|j��XdSrQ)r=rjr5rhrarArArBr57sz_BufferedIOMixin.closecCs*|jdkrtd��|��|j}d|_|S)Nzraw stream already detached)r=r#rhr�r�rArArBr�?s
z_BufferedIOMixin.detachcCs
|j��SrQ)r=rnrarArArBrnIsz_BufferedIOMixin.seekablecCs|jSrQr�rarArArBr=Lsz_BufferedIOMixin.rawcCs|jjSrQ)r=rjrarArArBrjPsz_BufferedIOMixin.closedcCs|jjSrQ)r=rYrarArArBrYTsz_BufferedIOMixin.namecCs|jjSrQ)r=r4rarArArBr4Xsz_BufferedIOMixin.modecCstd|jj�d���dS�Nzcannot pickle z object�r rXrMrarArArB�__getstate__\sz_BufferedIOMixin.__getstate__cCsN|jj}|jj}z
|j}Wn tk
r:d�||�YSXd�|||�SdS)Nz<{}.{}>z<{}.{} name={!r}>)rXrNrOrYr/�format)rI�modnameZclsnamerYrArArB�__repr___s
z_BufferedIOMixin.__repr__cCs
|j��SrQ)r=r,rarArArBr,ksz_BufferedIOMixin.filenocCs
|j��SrQ)r=r)rarArArBr)nsz_BufferedIOMixin.isatty)r)N)rMrNrOr�r[rbrdrhr5r�rnr�r=rjrYr4r�r�r,r)rArArArBr�
s(	






r�cs�eZdZdZd dd�Zdd�Zdd�Zdd	�Z�fd
d�Zd!d
d�Z	d"dd�Z
dd�Zd#dd�Zdd�Z
d$dd�Zdd�Zdd�Zdd�Z�ZS)%�BytesIONcCs&t�}|dk	r||7}||_d|_dSr�)r��_buffer�_pos)rIZ
initial_bytes�bufrArArBr�zs
zBytesIO.__init__cCs|jrtd��|j��S)Nz__getstate__ on closed file)rjr#�__dict__�copyrarArArBr��szBytesIO.__getstate__cCs|jrtd��t|j�S)Nzgetvalue on closed file)rjr#rr�rarArArB�getvalue�szBytesIO.getvaluecCs|jrtd��t|j�S)Nzgetbuffer on closed file)rjr#r�r�rarArArB�	getbuffer�szBytesIO.getbuffercs"|jdk	r|j��t���dSrQ)r��clear�superr5ra�rXrArBr5�s

z
BytesIO.closercCs�|jrtd��|dkrd}n4z
|j}Wn"tk
rHt|�d���YnX|�}|dkrbt|j�}t|j�|jkrvdStt|j�|j|�}|j|j|�}||_t	|�S)N�read from closed filerr�r�)
rjr#r�r/r r"r�r�r~r)rIr�r�ZnewposrrArArBr��s"

zBytesIO.readcCs
|�|�SrQ)r�r�rArArBr��sz
BytesIO.read1c	Cs�|jrtd��t|t�r td��t|��}|j}W5QRX|dkrFdS|j}|t|j	�krzd|t|j	�}|j	|7_	||j	|||�<|j|7_|S)N�write to closed file� can't write str to binary streamr�)
rjr#rrr r��nbytesr�r"r�)rIrZviewrr^ZpaddingrArArBr��s

z
BytesIO.writercCs�|jrtd��z
|j}Wn"tk
r:t|�d���YnX|�}|dkrh|dkr`td|f��||_nD|dkr�td|j|�|_n(|dkr�tdt|j�|�|_ntd��|jS)Nzseek on closed filer�r�negative seek position %rr
rzunsupported whence value)	rjr#r�r/r r��maxr"r�)rIr^r_�	pos_indexrArArBr[�s"
zBytesIO.seekcCs|jrtd��|jS)N�tell on closed file)rjr#r�rarArArBrb�szBytesIO.tellcCsx|jrtd��|dkr|j}nJz
|j}Wn"tk
rJt|�d���YnX|�}|dkrhtd|f��|j|d�=|S)Nztruncate on closed filer�rznegative truncate position %r)rjr#r�r�r/r r�)rIr^r�rArArBrd�s
zBytesIO.truncatecCs|jrtd��dS�NrwTrxrarArArBrr�szBytesIO.readablecCs|jrtd��dSr�rxrarArArBrt�szBytesIO.writablecCs|jrtd��dSr�rxrarArArBrn�szBytesIO.seekable)N)r)r)r)N)rMrNrOr�r�r�r�r�r5r�r�r�r[rbrdrrrtrn�
__classcell__rArAr�rBr�rs




r�c@steZdZefdd�Zdd�Zdd�Zddd	�Zdd
d�Zdd
d�Z	ddd�Z
ddd�Zdd�Zdd�Z
ddd�ZdS) r2cCsF|��std��t�||�|dkr,td��||_|��t�|_dS)Nz "raw" argument must be readable.r�invalid buffer size)	rrr.r�r�r#�buffer_size�_reset_read_buf�Lock�
_read_lock�rIr=r�rArArBr�szBufferedReader.__init__cCs
|j��SrQ)r=rrrarArArBrrszBufferedReader.readablecCsd|_d|_dS)Nr�r)�	_read_buf�	_read_posrarArArBr�szBufferedReader._reset_read_bufNc
Cs@|dk	r|dkrtd��|j�|�|�W5QR�SQRXdS)Nrzinvalid number of bytes to read)r#r��_read_unlockedr�rArArBr� szBufferedReader.readcCs�d}d}|j}|j}|dks$|dkr�|��t|jd�rj|j��}|dkrZ||d�pXdS||d�|S||d�g}d}|j��}||kr�|}q�|t|�7}|�|�q|d�	|�p�|St|�|}	||	kr�|j|7_||||�S||d�g}t
|j|�}
|	|k�rH|j�|
�}||k�r.|}�qH|	t|�7}	|�|��qt||	�}d�	|�}||d�|_d|_|�r�|d|�S|S)Nr�)r�Nrr�r)
r�r�r�r�r=r�r�r"r��joinr�r�r~)rIrZ
nodata_valZempty_valuesr�r^�chunkZchunksZcurrent_size�availZwanted�outrArArBr�-sL





zBufferedReader._read_unlockedrc
Cs(|j�|�|�W5QR�SQRXdSrQ)r��_peek_unlockedr�rArArBr{aszBufferedReader.peekcCsrt||j�}t|j�|j}||ks,|dkrb|j|}|j�|�}|rb|j|jd�||_d|_|j|jd�Sr�)r~r�r"r�r�r=r�)rIrZwantZhaveZto_readZcurrentrArArBr�ks
zBufferedReader._peek_unlockedrc
Cs^|dkr|j}|dkrdS|j�4|�d�|�t|t|j�|j��W5QR�SQRXdS)Nrr�r
)r�r�r�r�r~r"r�r�r�rArArBr�vs
�zBufferedReader.read1c	Cs
t|t�st|�}|jdkr dS|�d�}d}|j��|t|�kr�tt|j�|jt|��}|r�|j|j|j|�||||�<|j|7_||7}|t|�kr�q�t|�||j	kr�|j
�||d��}|s�q�||7}n|r�|s�|�d�s�q�|r6|r6q�q6W5QRX|S)Nrr�r
)
rr�r�r�r�r"r~r�r�r�r=r�r�)rIr�r��writtenr�rrArArBr��s6


�

zBufferedReader._readintocCst�|�t|j�|jSrQ)r�rbr"r�r�rarArArBrb�szBufferedReader.tellc
Csd|tkrtd��|j�D|dkr4|t|j�|j8}t�|||�}|��|W5QR�SQRXdS)N�invalid whence valuer
)	�valid_seek_flagsr#r�r"r�r�r�r[r�r]rArArBr[�szBufferedReader.seek)N)N)r)r)r)r)rMrNrOr*r�rrr�r�r�r{r�r�r�rbr[rArArArBr2s


4



.r2c@s\eZdZefdd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�Z	dd�Z
ddd�Zdd�ZdS)r1cCsF|��std��t�||�|dkr,td��||_t�|_t�|_	dS)Nz "raw" argument must be writable.rr�)
rtr.r�r�r#r�r��
_write_bufr��_write_lockr�rArArBr��szBufferedWriter.__init__cCs
|j��SrQ)r=rtrarArArBrt�szBufferedWriter.writablecCst|t�rtd��|j��|jr(td��t|j�|jkr@|�	�t|j�}|j�
|�t|j�|}t|j�|jkr�z|�	�Wnltk
r�}zNt|j�|jkr�t|j�|j}||8}|jd|j�|_t|j|j
|��W5d}~XYnX|W5QR�SQRXdS)Nr�r�)rrr r�rjr#r"r�r��_flush_unlocked�extend�BlockingIOError�errno�strerror)rIrZbeforer��eZoveragerArArBr��s(

"zBufferedWriter.writeNc
CsD|j�4|��|dkr"|j��}|j�|�W5QR�SQRXdSrQ)r�r�r=rbrdrerArArBrd�s

zBufferedWriter.truncatec	Cs|j�|��W5QRXdSrQ)r�r�rarArArBrh�szBufferedWriter.flushcCs�|jrtd��|jr�z|j�|j�}Wntk
rBtd��YnX|dkrZttjdd��|t	|j�ksp|dkrxt
d��|jd|�=qdS)Nr�zHself.raw should implement RawIOBase: it should not raise BlockingIOErrorz)write could not complete without blockingrz*write() returned incorrect number of bytes)rjr#r�r=r�r��RuntimeErrorr�ZEAGAINr"r.�rIrrArArBr�s �zBufferedWriter._flush_unlockedcCst�|�t|j�SrQ)r�rbr"r�rarArArBrbszBufferedWriter.tellrc
CsD|tkrtd��|j�$|��t�|||�W5QR�SQRXdS)Nr�)r�r#r�r�r�r[r]rArArBr[s
zBufferedWriter.seekcCs`|j�$|jdks|jr&W5QR�dSW5QRXz|��W5|j�|j��W5QRXXdSrQ)r�r=rjr5rhrarArArBr5szBufferedWriter.close)N)r)
rMrNrOr*r�rtr�rdrhr�rbr[r5rArArArBr1�s	

r1c@s�eZdZefdd�Zddd�Zdd�Zdd	�Zddd�Zd d
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zedd��ZdS)!�BufferedRWPaircCs<|��std��|��s td��t||�|_t||�|_dS)Nz#"reader" argument must be readable.z#"writer" argument must be writable.)rrr.rtr2�readerr1�writer)rIr�r�r�rArArBr�<szBufferedRWPair.__init__rcCs|dkrd}|j�|�S�Nr)r�r�r�rArArBr�JszBufferedRWPair.readcCs|j�|�SrQ)r�r�r�rArArBr�OszBufferedRWPair.readintocCs|j�|�SrQ)r�r�r�rArArBr�RszBufferedRWPair.writercCs|j�|�SrQ)r�r{r�rArArBr{UszBufferedRWPair.peekcCs|j�|�SrQ)r�r�r�rArArBr�XszBufferedRWPair.read1cCs|j�|�SrQ)r�r�r�rArArBr�[szBufferedRWPair.readinto1cCs
|j��SrQ)r�rrrarArArBrr^szBufferedRWPair.readablecCs
|j��SrQ)r�rtrarArArBrtaszBufferedRWPair.writablecCs
|j��SrQ)r�rhrarArArBrhdszBufferedRWPair.flushcCs z|j��W5|j��XdSrQ)r�r5r�rarArArBr5gszBufferedRWPair.closecCs|j��p|j��SrQ)r�r)r�rarArArBr)mszBufferedRWPair.isattycCs|jjSrQ)r�rjrarArArBrjpszBufferedRWPair.closedN)r)r)r)rMrNrOr*r�r�r�r�r{r�r�rrrtrhr5r)r�rjrArArArBr�,s


r�c@sjeZdZefdd�Zddd�Zdd�Zdd	d
�Zddd�Zd
d�Z	ddd�Z
ddd�Zdd�Zdd�Z
dS)r0cCs(|��t�|||�t�|||�dSrQ)rqr2r�r1r�rArArBr�~szBufferedRandom.__init__rc	Cs�|tkrtd��|��|jrJ|j� |j�|jt|j�d�W5QRX|j�||�}|j�|�	�W5QRX|dkr�t
d��|S)Nr�r
rz seek() returned invalid position)r�r#rhr�r�r=r[r�r"r�r.r]rArArBr[�s$zBufferedRandom.seekcCs|jrt�|�St�|�SdSrQ)r�r1rbr2rarArArBrb�s
zBufferedRandom.tellNcCs|dkr|��}t�||�SrQ)rbr1rdrerArArBrd�szBufferedRandom.truncatecCs |dkrd}|��t�||�Sr�)rhr2r�r�rArArBr��szBufferedRandom.readcCs|��t�||�SrQ)rhr2r�r�rArArBr��szBufferedRandom.readintocCs|��t�||�SrQ)rhr2r{r�rArArBr{�szBufferedRandom.peekrcCs|��t�||�SrQ)rhr2r�r�rArArBr��szBufferedRandom.read1cCs|��t�||�SrQ)rhr2r�r�rArArBr��szBufferedRandom.readinto1c	CsF|jr:|j�(|j�|jt|j�d�|��W5QRXt�||�Sr�)	r�r�r=r[r�r"r�r1r�r�rArArBr��s
zBufferedRandom.write)r)N)N)r)r)rMrNrOr*r�r[rbrdr�r�r{r�r�r�rArArArBr0us	




r0cs�eZdZdZdZdZdZdZdZdZ	d0dd�Z
dd	�Zd
d�Zdd
�Z
dd�Zd1dd�Zd2dd�Zdd�Zdd�Zdd�Zefdd�Zdd�Zd3dd�Z�fd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zed,d-��Zed.d/��Z �Z!S)4r(rFNTr
c
CsB|jdkr*z|jrt�|j�W5d|_Xt|t�r<td��t|t�r\|}|dkr`td��nd}t|t	�sxtd|f��t
|�t
d�ks�td|f��tdd�|D��d	ks�|�d
�d	kr�td��d|kr�d
|_
d
|_tjtjB}nTd|kr�d
|_d}n@d|k�rd
|_tjtjB}n"d|k�r8d
|_d
|_tjtjB}d
|k�rNd
|_d
|_|j�rj|j�rj|tjO}n|j�r~|tjO}n
|tjO}|ttdd�O}ttdd��p�ttdd�}||O}d}�zT|dk�r:|�s�td��|dk�r�t�||d�}n0|||�}t|t��std��|dk�r$td��|}|�s:t�|d�||_t�|�}	z(t�|	j��rpt t!j"t�#t!j"�|��Wnt$k
�r�YnXt|	dd�|_%|j%d	k�r�t&|_%t'�r�t'|tj(�||_)|j�rzt�*|dt+�Wn4tk
�r}
z|
j!t!j,k�r�W5d}
~
XYnXWn"|dk	�r0t�|��YnX||_dS)Nrrz$integer argument expected, got floatznegative file descriptorzinvalid mode: %szxrwab+css|]}|dkVqdS)ZrwaxNrA)�.0�crArArB�	<genexpr>�sz"FileIO.__init__.<locals>.<genexpr>r
rzKMust have exactly one of create/read/write/append mode and at most one plusrTr
rr�O_BINARYZO_NOINHERIT�	O_CLOEXECz'Cannot use closefd=False with file namei�zexpected integer from openerzNegative file descriptorFr-)-�_fd�_closefdrr5r�floatr rr#rr!�sum�count�_created�	_writable�O_EXCL�O_CREAT�	_readable�O_TRUNC�
_appending�O_APPEND�O_RDWR�O_RDONLY�O_WRONLY�getattrrCr.�set_inheritabler+�stat�S_ISDIR�st_mode�IsADirectoryErrorr�ZEISDIRr�r/�_blksizer*�_setmoder�rY�lseekr	ZESPIPE)rIr6r4r;r�fd�flagsZnoinherit_flagZowned_fdZfdfstatr�rArArBr��s�




$




�





�

zFileIO.__init__cCsB|jdkr>|jr>|js>ddl}|jd|ftd|d�|��dS)Nrzunclosed file %rr)�
stacklevel�source)r�r�rjr$r%�ResourceWarningr5)rIr$rArArBrlAs�zFileIO.__del__cCstd|jj�d���dSr�r�rarArArBr�HszFileIO.__getstate__cCspd|jj|jjf}|jr"d|Sz
|j}Wn*tk
rVd||j|j|jfYSXd|||j|jfSdS)Nz%s.%sz
<%s [closed]>z<%s fd=%d mode=%r closefd=%r>z<%s name=%r mode=%r closefd=%r>)	rXrNrOrjrYr/r�r4r�)rI�
class_namerYrArArBr�Ks�
�
�zFileIO.__repr__cCs|jstd��dS)NzFile not open for reading)r�rVrarArArBrsYszFileIO._checkReadablecCs|jstd��dS)NzFile not open for writing)r�rVrorArArBru]szFileIO._checkWritablecCsT|��|��|dks |dkr(|��Szt�|j|�WStk
rNYdSXdSr�)rgrsr�rr�r�r�r�rArArBr�aszFileIO.readcCs�|��|��t}z6t�|jdt�}t�|j�j}||krH||d}Wnt	k
r^YnXt
�}t|�|kr�t|�}|t|t�7}|t|�}zt�
|j|�}Wntk
r�|r�Yq�YdSX|s�q�||7}qft|�Sr`)rgrsr*rr
r�rr+�st_sizer.r�r"r�r�r�r)rI�bufsizer^�endr>rr�rArArBr�qs2
zFileIO.readallcCs4t|��d�}|�t|��}t|�}||d|�<|Sr�)r�r�r�r")rIr�mr�rrArArBr��s
zFileIO.readintocCs<|��|��zt�|j|�WStk
r6YdSXdSrQ)rgrurr�r�r�r�rArArBr��szFileIO.writecCs*t|t�rtd��|��t�|j||�S)Nzan integer is required)rr�r rgrr
r�r]rArArBr[�s
zFileIO.seekcCs|��t�|jdt�Sr�)rgrr
r�rrarArArBrb�szFileIO.tellcCs2|��|��|dkr |��}t�|j|�|SrQ)rgrurbr�	ftruncater�r�rArArBrd�szFileIO.truncatecs.|js*z|jrt�|j�W5t���XdSrQ)rjr�r5r�rr�rar�rArBr5�s
zFileIO.closecCsF|��|jdkr@z|��Wntk
r8d|_YnXd|_|jS)NFT)rg�	_seekablerbr.rarArArBrn�s
zFileIO.seekablecCs|��|jSrQ)rgr�rarArArBrr�szFileIO.readablecCs|��|jSrQ)rgr�rarArArBrt�szFileIO.writablecCs|��|jSrQ)rgr�rarArArBr,�sz
FileIO.filenocCs|��t�|j�SrQ)rgrr)r�rarArArBr)�sz
FileIO.isattycCs|jSrQ)r�rarArArBr;�szFileIO.closefdcCsJ|jr|jrdSdSn0|jr,|jr&dSdSn|jrB|jr<dSdSndSdS)Nzxb+Zxbzab+Zabzrb+rD�wb)r�r�rr�rarArArBr4szFileIO.mode)r
TN)N)N)N)"rMrNrOr�r�r�r�rrr�r�rlr�r�rsrur�r�r�r�rr[rbrdr5rnrrrtr,r)r�r;r4r�rArAr�rBr(�s<
y

#



r(c@s\eZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zed
d��Z	edd��Z
edd��ZdS)�
TextIOBasercCs|�d�dSr�r\r�rArArBr�szTextIOBase.readcCs|�d�dSr�r\)rI�srArArBr�(szTextIOBase.writeNcCs|�d�dSrcr\rerArArBrd,szTextIOBase.truncatecCs|�d�dS)Nr�r\rarArArBr�0szTextIOBase.readlinecCs|�d�dSr�r\rarArArBr�7szTextIOBase.detachcCsdSrQrArarArArBr8@szTextIOBase.encodingcCsdSrQrArarArArB�newlinesEszTextIOBase.newlinescCsdSrQrArarArArBr9OszTextIOBase.errors)r)N)rMrNrOr�r�rdr�r�r�r8rr9rArArArBrs


	

	rc@sPeZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
ZdZ	dZ
edd��ZdS)�IncrementalNewlineDecoder�strictcCs,tjj||d�||_||_d|_d|_dS)N)r9rF)�codecs�IncrementalDecoderr��	translate�decoder�seennl�	pendingcr)rIr#r"r9rArArBr�`s
z"IncrementalNewlineDecoder.__init__FcCs�|jdkr|}n|jj||d�}|jr<|s.|r<d|}d|_|�d�r\|s\|dd�}d|_|�d�}|�d�|}|�d�|}|j|o�|j|o�|jB|o�|jBO_|j	r�|r�|�
dd�}|r�|�
dd�}|S)N��final�
FrT�
�
)r#�decoder%r�r�r$�_LF�_CR�_CRLFr"�replace)rI�inputr'�outputZcrlfZcrZlfrArArBr+gs*

�z IncrementalNewlineDecoder.decodecCs@|jdkrd}d}n|j��\}}|dK}|jr8|dO}||fS)Nr�rr
)r#�getstater%)rIr��flagrArArBr2�s
z"IncrementalNewlineDecoder.getstatecCs8|\}}t|d@�|_|jdk	r4|j�||d?f�dSr�)�boolr%r#�setstate)rI�stater�r3rArArBr5�s
z"IncrementalNewlineDecoder.setstatecCs$d|_d|_|jdk	r |j��dS)NrF)r$r%r#�resetrarArArBr7�s
zIncrementalNewlineDecoder.resetr
r�cCs
d|jS)N)Nr*r()r(r*r))r*r))r(r))r(r*r))r$rarArArBr�s�z"IncrementalNewlineDecoder.newlinesN)r)F)
rMrNrOr�r+r2r5r7r,r-r.r�rrArArArBrYs

rc@sreZdZdZdZdNdd�Zdd�ZdOdd	�Zd
d�Ze	dd
��Z
e	dd��Ze	dd��Ze	dd��Z
e	dd��Zddeddd�dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Ze	d#d$��Ze	d%d&��Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�ZdPd3d4�Zd5d6�Zd7d8�Z dQd:d;�Z!d<d=�Z"d>d?�Z#dRd@dA�Z$dBdC�Z%dSdDdE�Z&dTdFdG�Z'dHdI�Z(dUdJdK�Z)e	dLdM��Z*dS)Vr3iNFc		Cs|�|�|dkrvzt�|���}Wnttfk
r<YnX|dkrvzddl}Wntk
rjd}YnX|�d�}t	|t
�s�td|��t�
|�js�d}t||��|dkr�d}nt	|t
�s�td|��||_d|_d|_d|_|j��|_|_t|jd	�|_|�|||||�dS)
Nr�asciiFrzG%r is not a text encoding; use codecs.open() to handle arbitrary codecsrrrr�)�_check_newliner�device_encodingr,r/rV�locale�ImportErrorZgetpreferredencodingrrr#r �lookup�_is_text_encoding�LookupErrorr��_decoded_chars�_decoded_chars_used�	_snapshotr@rnr�_tellingr��
_has_read1�
_configure)	rIr@r8r9r:r?�
write_throughr<rprArArBr��s>





�zTextIOWrapper.__init__cCs>|dk	r$t|t�s$tdt|�f��|dkr:td|f��dS)Nzillegal newline type: %r)Nrr*r(r)zillegal newline value: %r)rrr �typer#)rIr:rArArBr:�szTextIOWrapper._check_newlinecCs�||_||_d|_d|_d|_||_|dk|_||_|dk|_|pHt	j
|_||_||_
|jr�|��r�|j��}|dkr�z|���d�Wntk
r�YnXdS)N�rr)�	_encoding�_errors�_encoder�_decoder�	_b2cratio�_readuniversal�_readtranslate�_readnl�_writetranslater�linesep�_writenl�_line_buffering�_write_throughrrtr@rb�_get_encoderr5r@)rIr8r9r:r?rG�positionrArArBrF�s&


zTextIOWrapper._configurecCs�d�|jj|jj�}z
|j}Wntk
r2YnX|d�|�7}z
|j}Wntk
r`YnX|d�|�7}|d�|j�S)Nz<{}.{}z name={0!r}z mode={0!r}z encoding={0!r}>)r�rXrNrOrYr/r4r8)rIr>rYr4rArArBr�!s
�

zTextIOWrapper.__repr__cCs|jSrQ)rJrarArArBr82szTextIOWrapper.encodingcCs|jSrQ)rKrarArArBr96szTextIOWrapper.errorscCs|jSrQ)rUrarArArBr?:szTextIOWrapper.line_bufferingcCs|jSrQ)rVrarArArBrG>szTextIOWrapper.write_throughcCs|jSrQ)r�rarArArBr@BszTextIOWrapper.buffer)r8r9r:r?rGcCs�|jdk	r*|dk	s"|dk	s"|tk	r*td��|dkrH|dkrB|j}q^d}nt|t�s^td|��|dkrn|j}nt|t�s�td|��|tkr�|j}|�	|�|dkr�|j
}|dkr�|j}|��|�
|||||�dS)NzPIt is not possible to set the encoding or newline of stream after the first readrrr)rM�EllipsisrVrKrrr rJrQr:r?rGrhrF)rIr8r9r:r?rGrArArB�reconfigureFs@
����



�zTextIOWrapper.reconfigurecCs|jrtd��|jSrv)rjr#rrarArArBrnoszTextIOWrapper.seekablecCs
|j��SrQ)r@rrrarArArBrrtszTextIOWrapper.readablecCs
|j��SrQ)r@rtrarArArBrtwszTextIOWrapper.writablecCs|j��|j|_dSrQ)r@rhrrDrarArArBrhzs
zTextIOWrapper.flushcCs.|jdk	r*|js*z|��W5|j��XdSrQ)r@rjr5rhrarArArBr5~szTextIOWrapper.closecCs|jjSrQ)r@rjrarArArBrj�szTextIOWrapper.closedcCs|jjSrQ)r@rYrarArArBrY�szTextIOWrapper.namecCs
|j��SrQ)r@r,rarArArBr,�szTextIOWrapper.filenocCs
|j��SrQ)r@r)rarArArBr)�szTextIOWrapper.isattycCs�|jrtd��t|t�s(td|jj��t|�}|js<|j	oBd|k}|rf|jrf|j
dkrf|�d|j
�}|jpr|�
�}|�|�}|j�|�|j	r�|s�d|kr�|��|�d�d|_|jr�|j��|S)Nr�zcan't write %s to text streamr*r(r)rjr#rrr rXrMr"rRrUrTr/rLrW�encoder@r�rh�_set_decoded_charsrCrMr7)rIrZlengthZhaslf�encoderrrArArBr��s(
�


zTextIOWrapper.writecCst�|j�}||j�|_|jSrQ)r �getincrementalencoderrJrKrL)rIZmake_encoderrArArBrW�szTextIOWrapper._get_encodercCs2t�|j�}||j�}|jr(t||j�}||_|SrQ)r �getincrementaldecoderrJrKrOrrPrM)rIZmake_decoderr#rArArB�_get_decoder�s
zTextIOWrapper._get_decodercCs||_d|_dSr�)rArB)rI�charsrArArBr\�sz TextIOWrapper._set_decoded_charscCsF|j}|dkr|j|d�}n|j|||�}|jt|�7_|SrQ)rBrAr")rIr�offsetrarArArB�_get_decoded_chars�sz TextIOWrapper._get_decoded_charscCs$|j|krtd��|j|8_dS)Nz"rewind decoded_chars out of bounds)rB�AssertionErrorr�rArArB�_rewind_decoded_chars�s
z#TextIOWrapper._rewind_decoded_charscCs�|jdkrtd��|jr&|j��\}}|jr<|j�|j�}n|j�|j�}|}|j�	||�}|�
|�|r�t|�t|j�|_
nd|_
|jr�|||f|_|S)Nz
no decoderrI)rMr#rDr2rEr@r��_CHUNK_SIZEr�r+r\r"rArNrC)rI�
dec_buffer�	dec_flags�input_chunk�eofZ
decoded_charsrArArB�_read_chunk�s 

zTextIOWrapper._read_chunkrcCs(||d>B|d>B|d>Bt|�d>BS)N�@���)r4)rIrXrh�
bytes_to_feed�need_eof�
chars_to_skiprArArB�_pack_cookie�s
�
�zTextIOWrapper._pack_cookiecCsFt|d�\}}t|d�\}}t|d�\}}t|d�\}}|||||fS)Nl)�divmod)rIZbigint�restrXrhrprqrrrArArB�_unpack_cookie	s
zTextIOWrapper._unpack_cookiec	Cs@|jstd��|jstd��|��|j��}|j}|dksF|jdkrX|j	rTt
d��|S|j\}}|t|�8}|j}|dkr�|�
||�S|��}�z�t|j|�}d}|dk�r"|�d|f�t|�|d|���}	|	|k�r|��\}
}|
s�|}||	8}�q4|t|
�8}d}q�||8}|d}q�d}|�d|f�||}|}
|dk�rZ|�
||
�W��Sd}d}d}t|t|��D]x}|d7}|t|�|||d���7}|��\}}|�s�||k�r�||7}||8}|dd}
}}||k�rt�q�qt|t|jddd	��7}d}||k�rtd
��|�
||
|||�W�S|�|�XdS)N�!underlying stream is not seekablez(telling position disabled by next() callzpending decoded textrr
r�rTr&z'can't reconstruct logical file position)rrVrDr.rhr@rbrMrCrArdr"rBrsr2r5rrNr+�range)rIrXr#rhZ
next_inputrrZsaved_stateZ
skip_bytesZ	skip_backrr�d�	start_posZstart_flagsZ	bytes_fedrqZ
chars_decoded�irgrArArBrb
	s�








�zTextIOWrapper.tellcCs$|��|dkr|��}|j�|�SrQ)rhrbr@rdrerArArBrdm	szTextIOWrapper.truncatecCs*|jdkrtd��|��|j}d|_|S)Nzbuffer is already detached)r@r#rhr�)rIr@rArArBr�s	s
zTextIOWrapper.detachcs��fdd�}�jrtd���js(td��|tkrN|dkr@td��d}���}nZ|tkr�|dkrftd������j�	d|�}��
d�d�_�jr��j�
�||�|S|dkr�td	|f��|dkr�td
|f�������|�\}}}}}	�j�	|���
d�d�_|dk�r*�j�r*�j�
�n@�j�s>|�s>|	�rj�j�pL����_�j�d|f�|df�_|	�r��j�|�}
��
�j�|
|��||
f�_t�j�|	k�r�td��|	�_||�|S)
NcsHz�jp���}Wntk
r&YnX|dkr<|�d�n|��dSr�)rLrWr@r5r7)rXr]rarArB�_reset_encoder|	sz*TextIOWrapper.seek.<locals>._reset_encoderr�rwrz#can't do nonzero cur-relative seeksz#can't do nonzero end-relative seeksrzunsupported whence (%r)r�r�z#can't restore logical file position)rjr#rrVrrbr	rhr@r[r\rCrMr7rvr`r5r�r+r"rAr.rB)rIZcookier_r|rXrzrhrprqrrrirArarBr[{	s`



�

�
zTextIOWrapper.seekcCs�|��|dkrd}n4z
|j}Wn"tk
rBt|�d���YnX|�}|jpV|��}|dkr�|��|j|j�	�dd�}|�
d�d|_|Sd}|�|�}t|�|kr�|s�|�
�}||�|t|��7}q�|SdS)Nrr�rTr&rF)rsr�r/r rMr`rcr+r@r�r\rCr"rk)rIr�r�r#r>rjrArArBr��	s,
�


zTextIOWrapper.readcCs(d|_|��}|s$d|_|j|_t�|Srm)rDr�rCrr�r�rArArBr��	szTextIOWrapper.__next__c	Cs
|jrtd��|dkrd}n4z
|j}Wn"tk
rHt|�d���YnX|�}|��}d}|jsj|��d}}|jr�|�	d|�}|dkr�|d}�q�nt
|�}n�|j�rF|�	d|�}|�	d|�}|dkr�|dkr�t
|�}n|d}�q�nX|dk�r|d}�q�n@||k�r|d}�q�n(||dk�r8|d}�q�n|d}�q�n(|�	|j�}|dk�rn|t
|j�}�q�|dk�r�t
|�|k�r�|}�q�|�
��r�|j�r��q��q�|j�r�||��7}qr|�d	�d|_|Sqr|dk�r�||k�r�|}|�t
|�|�|d|�S)
Nr�rr�rr*r
r(rr)rjr#r�r/r rcrMr`rPr}r"rOrQrkrAr\rCre)	rIr�r�r��startr^�endposZnlposZcrposrArArBr��	st







zTextIOWrapper.readlinecCs|jr|jjSdSrQ)rMrrarArArBrH
szTextIOWrapper.newlines)NNNFF)NNNFF)N)rrrr)N)r)N)N)+rMrNrOrfr�r�r:rFr�r�r8r9r?rGr@rYrZrnrrrtrhr5rjrYr,r)r�rWr`r\rcrerkrsrvrbrdr�r[r�r�r�rrArArArBr3�sz�
(�
$




�)



*�

c

K
	
]r3csNeZdZd�fdd�	Zdd�Zdd�Zed	d
��Zedd��Zd
d�Z	�Z
S)�StringIOrr*csftt|�jt�dd|d�|dkr(d|_|dk	rbt|t�sNtd�t	|�j
���|�|�|�d�dS)Nzutf-8�
surrogatepass)r8r9r:Fz*initial_value must be str or None, not {0}r)
r�rr�r�rRrrr r�rHrMr�r[)rIZ
initial_valuer:r�rArBr�T
s�
�
zStringIO.__init__c	CsP|��|jp|��}|��}|��z|j|j��dd�W�S|�|�XdS)NTr&)	rhrMr`r2r7r5r+r@r�)rIr#Z	old_staterArArBr�d
szStringIO.getvaluecCs
t�|�SrQ)�objectr�rarArArBr�n
szStringIO.__repr__cCsdSrQrArarArArBr9s
szStringIO.errorscCsdSrQrArarArArBr8w
szStringIO.encodingcCs|�d�dSr�r\rarArArBr�{
szStringIO.detach)rr*)rMrNrOr�r�r�r�r9r8r�r�rArAr�rBrM
s


r)r
rNNNTN)7r�abcr r�r�sys�_threadrr��platformZmsvcrtrr�iorrrr	r�r��addr�	SEEK_DATAr*r�r�dev_moderkrCrF�	open_coder/rGrPrVr.r#�ABCMetarW�registerr��_ior(r�r�r�r2r1r�r0rr!rr3rrArArArB�<module>s�


�
[

	
$=
ghCiIJY@U$