AlkantarClanX12

Your IP : 18.220.206.141


Current Path : /proc/self/root/opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python39/lib64/python3.9/__pycache__/_pyio.cpython-39.opt-2.pyc

a

R�f�l�@svddlZddlZddlZddlZddlZddlZddlmZej	dvrTddl
mZndZddl
Z
ddl
mZmZmZmZhd�Zeed�r�e�ej�e�ej�dZeZeed	�p�ejjZeZd5d
d�Zdd�Zz
e
jZWne �y�eZYn0Gdd�d�Z!Gdd�d�Z"z
e
j#Z#Wn&e �yBGdd�de$e%�Z#Yn0Gdd�dej&d�Z'e
j'�(e'�Gdd�de'�Z)e
j)�(e)�ddl*m+Z+e)�(e+�Gdd�de'�Z,e
j,�(e,�Gdd �d e,�Z-Gd!d"�d"e,�Z.Gd#d$�d$e-�Z/Gd%d&�d&e-�Z0Gd'd(�d(e,�Z1Gd)d*�d*e0e/�Z2Gd+d,�d,e)�Z+Gd-d.�d.e'�Z3e
j3�(e3�Gd/d0�d0ej4�Z5Gd1d2�d2e3�Z6Gd3d4�d4e6�Z7dS)6�N)�
allocate_lock>�cygwinZwin32)�setmode)�__all__�SEEK_SET�SEEK_CUR�SEEK_END>r���	SEEK_HOLEi Zgettotalrefcount�r���Tc	Cs�t|t�st�|�}t|tttf�s0td|��t|t�sFtd|��t|t�s\td|��|durzt|t�sztd|��|dur�t|t�s�td|��t|�}|td�s�t|�t|�kr�t	d|��d|v}	d|v}
d	|v}d
|v}d|v}
d|v}d
|v}d|v�rD|	�s"|�s"|�s"|
�r*t	d��ddl
}|�dtd�d}
|�rX|�rXt	d��|	|
||dk�rvt	d��|	�s�|
�s�|�s�|�s�t	d��|�r�|du�r�t	d��|�r�|du�r�t	d��|�r�|du�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}Wnttf�y�Yn0|dk�r�|}|dk�r�t	d ��|dk�r|�r|WSt	d!��|
�rt||�}n<|	�s0|�s0|�r<t||�}n|
�rNt||�}nt	d"|��|}|�rj|WSt|||||�}|}||_|WS|���Yn0dS)#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 deprecatedr
Tz'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�)�openerFr
zinvalid 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)�filer3�	buffering�encoding�errors�newline�closefdrZmodesZcreatingZreadingZwritingZ	appendingZupdating�textZbinaryr#�raw�result�line_bufferingZbs�buffer�r@�*/opt/alt/python39/lib64/python3.9/_pyio.py�open+s�{




�������



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

)rB�__doc__)�self�obj�typr@r@rA�__get__s��zDocDescriptor.__get__)N)�__name__�
__module__�__qualname__rKr@r@r@rArFsrFc@seZdZe�Zdd�ZdS)�OpenWrappercOst|i|��S�N)rB)�cls�args�kwargsr@r@rA�__new__.szOpenWrapper.__new__N)rLrMrNrFrGrTr@r@r@rArO$srOc@seZdZdS)�UnsupportedOperationN)rLrMrNr@r@r@rArU7srUc@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)rU�	__class__rL)rH�namer@r@rA�_unsupported]s
�zIOBase._unsupportedrcCs|�d�dS)N�seek�rY�rH�pos�whencer@r@rArZdszIOBase.seekcCs|�dd�S�Nrr	)rZ�rHr@r@rA�telltszIOBase.tellNcCs|�d�dS�N�truncater[�rHr]r@r@rArcxszIOBase.truncatecCs|��dSrP��_checkClosedr`r@r@rA�flush�szIOBase.flushFcCs&|js"z|��Wd|_nd|_0dS)NT)�_IOBase__closedrgr`r@r@rAr4�s
zIOBase.closecCsTz
|j}WntyYdS0|r(dStr6|��nz|��WnYn0dSrP)�closedr.�_IOBASE_EMITS_UNRAISABLEr4)rHrir@r@rA�__del__�s

zIOBase.__del__cCsdS�NFr@r`r@r@rA�seekable�szIOBase.seekablecCs |��st|durdn|��dS)NzFile or stream is not seekable.)rmrU�rH�msgr@r@rA�_checkSeekable�s��zIOBase._checkSeekablecCsdSrlr@r`r@r@rA�readable�szIOBase.readablecCs |��st|durdn|��dS)NzFile or stream is not readable.)rqrUrnr@r@rA�_checkReadable�s��zIOBase._checkReadablecCsdSrlr@r`r@r@rA�writable�szIOBase.writablecCs |��st|durdn|��dS)NzFile or stream is not writable.)rsrUrnr@r@rA�_checkWritable�s��zIOBase._checkWritablecCs|jSrP)rhr`r@r@rAri�sz
IOBase.closedcCs|jrt|durdn|��dS�N�I/O operation on closed file.�rir"rnr@r@rArf�s��zIOBase._checkClosedcCs|��|SrPrer`r@r@rA�	__enter__�szIOBase.__enter__cGs|��dSrP)r4)rHrRr@r@rA�__exit__�szIOBase.__exit__cCs|�d�dS)Nr+r[r`r@r@rAr+�sz
IOBase.filenocCs|��dSrlrer`r@r@rAr(sz
IOBase.isattyr
cs�t�d�r��fdd�}ndd�}�dur0d�n2z
�j}Wn tyZt��d���Yn0|��t�}�dks|t|��kr���|��}|s�q�||7}|�d�rhq�qht|�S)	N�peekcs>��d�}|sdS|�d�dp&t|�}�dkr:t|��}|S)Nr	�
r)rz�findr!�min)Z	readahead�n�rH�sizer@rA�
nreadaheads

z#IOBase.readline.<locals>.nreadaheadcSsdS�Nr	r@r@r@r@rAr�!sr
� is not an integerrr{)	�hasattr�	__index__r.r�	bytearrayr!�read�endswithr)rHr�r��
size_index�resrr@rrA�readlines&
	

zIOBase.readlinecCs|��|SrPrer`r@r@rA�__iter__6szIOBase.__iter__cCs|��}|st�|SrP)r��
StopIteration�rH�liner@r@rA�__next__:szIOBase.__next__cCsP|dus|dkrt|�Sd}g}|D]&}|�|�|t|�7}||kr$qLq$|S�Nr)�list�appendr!)rH�hintr~�linesr�r@r@rA�	readlines@s
zIOBase.readlinescCs |��|D]}|�|�qdSrP)rf�write)rHr�r�r@r@rA�
writelinesRszIOBase.writelines)r)N)N)N)N)N)r
)N)rLrMrNrYrZrarcrgrhr4rkrmrprqrrrsrt�propertyrirfrxryr+r(r�r�r�r�r�r@r@r@rArV;s4"







	

*
rV)�	metaclassc@s.eZdZddd�Zdd�Zdd�Zdd	�Zd
S)�	RawIOBaser
cCsP|durd}|dkr|��St|���}|�|�}|dur>dS||d�=t|�S)Nr
r)�readallr�r��readintor)rHr�rr~r@r@rAr�ms

zRawIOBase.readcCs4t�}|�t�}|sq ||7}q|r,t|�S|SdSrP)r�r�r)r)rHr��datar@r@rAr�~s

zRawIOBase.readallcCs|�d�dS)Nr�r[�rHrr@r@rAr��szRawIOBase.readintocCs|�d�dS�Nr�r[r�r@r@rAr��szRawIOBase.writeN)r
)rLrMrNr�r�r�r�r@r@r@rAr�_s
r�)r'c@sHeZdZddd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�BufferedIOBaser
cCs|�d�dS�Nr�r[rr@r@rAr��szBufferedIOBase.readcCs|�d�dS)N�read1r[rr@r@rAr��szBufferedIOBase.read1cCs|j|dd�S)NF�r���	_readintor�r@r@rAr��szBufferedIOBase.readintocCs|j|dd�S)NTr�r�r�r@r@rA�	readinto1�s	zBufferedIOBase.readinto1cCsVt|t�st|�}|�d�}|r0|�t|��}n|�t|��}t|�}||d|�<|S�N�B)r�
memoryview�castr�r!r�)rHrr�r�r~r@r@rAr��s

zBufferedIOBase._readintocCs|�d�dSr�r[r�r@r@rAr��s	zBufferedIOBase.writecCs|�d�dS�N�detachr[r`r@r@rAr��szBufferedIOBase.detachN)r
)r
)
rLrMrNr�r�r�r�r�r�r�r@r@r@rAr��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
||_dSrP��_raw�rHr<r@r@rA�__init__sz_BufferedIOMixin.__init__rcCs"|j�||�}|dkrtd��|S)Nrz#seek() returned an invalid position)r<rZr-)rHr]r^Znew_positionr@r@rArZsz_BufferedIOMixin.seekcCs|j��}|dkrtd��|S)Nrz#tell() returned an invalid position)r<rar-rdr@r@rAras
z_BufferedIOMixin.tellNcCs4|��|��|��|dur(|��}|j�|�SrP)rfrtrgrar<rcrdr@r@rArc%sz_BufferedIOMixin.truncatecCs|jrtd��|j��dS)N�flush on closed file)rir"r<rgr`r@r@rArg6sz_BufferedIOMixin.flushcCs8|jdur4|js4z|��W|j��n|j��0dSrP)r<rirgr4r`r@r@rAr4;s
z_BufferedIOMixin.closecCs*|jdurtd��|��|j}d|_|S)Nzraw stream already detached)r<r"rgr�r�r@r@rAr�Cs
z_BufferedIOMixin.detachcCs
|j��SrP)r<rmr`r@r@rArmMsz_BufferedIOMixin.seekablecCs|jSrPr�r`r@r@rAr<Psz_BufferedIOMixin.rawcCs|jjSrP)r<rir`r@r@rAriTsz_BufferedIOMixin.closedcCs|jjSrP)r<rXr`r@r@rArXXsz_BufferedIOMixin.namecCs|jjSrP)r<r3r`r@r@rAr3\sz_BufferedIOMixin.modecCstd|jj�d���dS�Nzcannot pickle z object�rrWrLr`r@r@rA�__getstate__`sz_BufferedIOMixin.__getstate__cCsL|jj}|jj}z
|j}Wnty8d�||�YS0d�|||�SdS)Nz<{}.{}>z<{}.{} name={!r}>)rWrMrNrXr.�format)rH�modnameZclsnamerXr@r@rA�__repr__cs
z_BufferedIOMixin.__repr__cCs
|j��SrP)r<r+r`r@r@rAr+osz_BufferedIOMixin.filenocCs
|j��SrP)r<r(r`r@r@rAr(rsz_BufferedIOMixin.isatty)r)N)rLrMrNr�rZrarcrgr4r�rmr�r<rirXr3r�r�r+r(r@r@r@rAr�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�}|dur||7}||_d|_dSr�)r��_buffer�_pos)rHZ
initial_bytes�bufr@r@rAr�~s
zBytesIO.__init__cCs|jrtd��|j��S)Nz__getstate__ on closed file)rir"�__dict__�copyr`r@r@rAr��szBytesIO.__getstate__cCs|jrtd��t|j�S)Nzgetvalue on closed file)rir"rr�r`r@r@rA�getvalue�szBytesIO.getvaluecCs|jrtd��t|j�S)Nzgetbuffer on closed file)rir"r�r�r`r@r@rA�	getbuffer�szBytesIO.getbuffercs"|jdur|j��t���dSrP)r��clear�superr4r`�rWr@rAr4�s

z
BytesIO.closer
cCs�|jrtd��|durd}n2z
|j}Wn tyFt|�d���Yn0|�}|dkr`t|j�}t|j�|jkrtdStt|j�|j|�}|j|j|�}||_t	|�S)N�read from closed filer
r�r�)
rir"r�r.rr!r�r�r}r)rHr�r�Znewposrr@r@rAr��s"

zBytesIO.readcCs
|�|�SrP)r�rr@r@rAr��sz
BytesIO.read1cCs�|jrtd��t|t�r td��t|��}|j}Wd�n1sD0Y|dkrZdS|j}|t|j	�kr�d|t|j	�}|j	|7_	||j	|||�<|j|7_|S)N�write to closed file� can't write str to binary streamr�)
rir"rrrr��nbytesr�r!r�)rHrZviewr~r]Zpaddingr@r@rAr��s

$z
BytesIO.writercCs�|jrtd��z
|j}Wn ty8t|�d���Yn0|�}|dkrf|dkr^td|f��||_nD|dkr�td|j|�|_n(|dkr�tdt|j�|�|_ntd��|jS)Nzseek on closed filer�r�negative seek position %rr	r
zunsupported whence value)	rir"r�r.rr��maxr!r�)rHr]r^�	pos_indexr@r@rArZ�s"
zBytesIO.seekcCs|jrtd��|jS)N�tell on closed file)rir"r�r`r@r@rAra�szBytesIO.tellcCsv|jrtd��|dur|j}nHz
|j}Wn tyHt|�d���Yn0|�}|dkrftd|f��|j|d�=|S)Nztruncate on closed filer�rznegative truncate position %r)rir"r�r�r.rr�)rHr]r�r@r@rArc�s
zBytesIO.truncatecCs|jrtd��dS�NrvTrwr`r@r@rArq�szBytesIO.readablecCs|jrtd��dSr�rwr`r@r@rArs�szBytesIO.writablecCs|jrtd��dSr�rwr`r@r@rArm�szBytesIO.seekable)N)r
)r
)r)N)rLrMrNr�r�r�r�r�r4r�r�r�rZrarcrqrsrm�
__classcell__r@r@r�rAr�vs




r�c@steZdZefdd�Zdd�Zdd�Zddd	�Zdd
d�Zdd
d�Z	ddd�Z
ddd�Zdd�Zdd�Z
ddd�ZdS) r1cCsF|��std��t�||�|dkr,td��||_|��t�|_dS)Nz "raw" argument must be readable.r�invalid buffer size)	rqr-r�r�r"�buffer_size�_reset_read_buf�Lock�
_read_lock�rHr<r�r@r@rAr�szBufferedReader.__init__cCs
|j��SrP)r<rqr`r@r@rArqszBufferedReader.readablecCsd|_d|_dS)Nr�r)�	_read_buf�	_read_posr`r@r@rAr� szBufferedReader._reset_read_bufNcCsL|dur|dkrtd��|j�|�|�Wd�S1s>0YdS)Nr
zinvalid number of bytes to read)r"r��_read_unlockedrr@r@rAr�$szBufferedReader.readcCs�d}d}|j}|j}|dus$|dkr�|��t|jd�rj|j��}|durZ||d�pXdS||d�|S||d�g}d}|j��}||vr�|}q�|t|�7}|�|�q|d�	|�p�|St|�|}	||	kr�|j|7_||||�S||d�g}t
|j|�}
|	|k�rH|j�|
�}||v�r.|}�qH|	t|�7}	|�|��qt||	�}d�	|�}||d�|_d|_|�r�|d|�S|S)Nr�)r�Nr
r�r)
r�r�r�r�r<r�r�r!r��joinr�r�r})rHr~Z
nodata_valZempty_valuesr�r]�chunkZchunksZcurrent_size�availZwanted�outr@r@rAr�1sL





zBufferedReader._read_unlockedrcCs4|j�|�|�Wd�S1s&0YdSrP)r��_peek_unlockedrr@r@rArzeszBufferedReader.peekcCsrt||j�}t|j�|j}||ks,|dkrb|j|}|j�|�}|rb|j|jd�||_d|_|j|jd�Sr�)r}r�r!r�r�r<r�)rHr~ZwantZhaveZto_readZcurrentr@r@rAr�os
zBufferedReader._peek_unlockedr
cCsj|dkr|j}|dkrdS|j�6|�d�|�t|t|j�|j��Wd�S1s\0YdS)Nrr�r	)r�r�r�r�r}r!r�r�rr@r@rAr�zs
�zBufferedReader.read1cCs 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�q6Wd�n1�s0Y|S)Nrr�r	)
rr�r�r�r�r!r}r�r�r�r<r�r�)rHr�r��writtenr�r~r@r@rAr��s6


�

$zBufferedReader._readintocCst�|�t|j�|jSrP)r�rar!r�r�r`r@r@rAra�szBufferedReader.tellcCsp|tvrtd��|j�F|dkr4|t|j�|j8}t�|||�}|��|Wd�S1sb0YdS)N�invalid whence valuer	)	�valid_seek_flagsr"r�r!r�r�r�rZr�r\r@r@rArZ�szBufferedReader.seek)N)N)r)r)r
)r)rLrMrNr)r�rqr�r�r�rzr�r�r�rarZr@r@r@rAr1s


4



.r1c@s\eZdZefdd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�Z	dd�Z
ddd�Zdd�ZdS)r0cCsF|��std��t�||�|dkr,td��||_t�|_t�|_	dS)Nz "raw" argument must be writable.rr�)
rsr-r�r�r"r�r��
_write_bufr��_write_lockr�r@r@rAr��szBufferedWriter.__init__cCs
|j��SrP)r<rsr`r@r@rArs�szBufferedWriter.writablecCst|t�rtd��|j��|jr(td��t|j�|jkr@|�	�t|j�}|j�
|�t|j�|}t|j�|jkr�z|�	�Wnnty�}zVt|j�|jkr�t|j�|j}||8}|jd|j�|_t|j|j
|��WYd}~n
d}~00|Wd�S1�s
0YdS)Nr�r�)rrrr�rir"r!r�r��_flush_unlocked�extend�BlockingIOError�errno�strerror)rHrZbeforer��eZoverager@r@rAr��s(

&zBufferedWriter.writeNcCsP|j�6|��|dur"|j��}|j�|�Wd�S1sB0YdSrP)r�r�r<rarcrdr@r@rArc�s

zBufferedWriter.truncatecCs2|j�|��Wd�n1s$0YdSrP)r�r�r`r@r@rArgszBufferedWriter.flushcCs�|jrtd��|jr�z|j�|j�}Wnty@td��Yn0|durXttjdd��|t	|j�ksn|dkrvt
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)rir"r�r<r�r��RuntimeErrorr�ZEAGAINr!r-�rHr~r@r@rAr�s�zBufferedWriter._flush_unlockedcCst�|�t|j�SrP)r�rar!r�r`r@r@rAraszBufferedWriter.tellrcCsP|tvrtd��|j�&|��t�|||�Wd�S1sB0YdS)Nr�)r�r"r�r�r�rZr\r@r@rArZs
zBufferedWriter.seekcCs�|j�0|jdus|jr(Wd�dSWd�n1s<0Yz<|��W|j�|j��Wd�q�1sx0Yn2|j�|j��Wd�n1s�0Y0dSrP)r�r<rirgr4r`r@r@rAr4 s.
*�zBufferedWriter.close)N)r)
rLrMrNr)r�rsr�rcrgr�rarZr4r@r@r@rAr0�s	

r0c@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.)rqr-rsr1�readerr0�writer)rHr�r�r�r@r@rAr�@szBufferedRWPair.__init__r
cCs|durd}|j�|�S�Nr
)r�r�rr@r@rAr�NszBufferedRWPair.readcCs|j�|�SrP)r�r�r�r@r@rAr�SszBufferedRWPair.readintocCs|j�|�SrP)r�r�r�r@r@rAr�VszBufferedRWPair.writercCs|j�|�SrP)r�rzrr@r@rArzYszBufferedRWPair.peekcCs|j�|�SrP)r�r�rr@r@rAr�\szBufferedRWPair.read1cCs|j�|�SrP)r�r�r�r@r@rAr�_szBufferedRWPair.readinto1cCs
|j��SrP)r�rqr`r@r@rArqbszBufferedRWPair.readablecCs
|j��SrP)r�rsr`r@r@rArseszBufferedRWPair.writablecCs
|j��SrP)r�rgr`r@r@rArghszBufferedRWPair.flushcCs*z|j��W|j��n|j��0dSrP)r�r4r�r`r@r@rAr4kszBufferedRWPair.closecCs|j��p|j��SrP)r�r(r�r`r@r@rAr(qszBufferedRWPair.isattycCs|jjSrP)r�rir`r@r@rAritszBufferedRWPair.closedN)r
)r)r
)rLrMrNr)r�r�r�r�rzr�r�rqrsrgr4r(r�rir@r@r@rAr�0s


r�c@sjeZdZefdd�Zddd�Zdd�Zdd	d
�Zddd�Zd
d�Z	ddd�Z
ddd�Zdd�Zdd�Z
dS)r/cCs(|��t�|||�t�|||�dSrP)rpr1r�r0r�r@r@rAr��szBufferedRandom.__init__rcCs�|tvrtd��|��|jr^|j�*|j�|jt|j�d�Wd�n1sT0Y|j�||�}|j�|�	�Wd�n1s�0Y|dkr�t
d��|S)Nr�r	rz seek() returned invalid position)r�r"rgr�r�r<rZr�r!r�r-r\r@r@rArZ�s8&zBufferedRandom.seekcCs|jrt�|�St�|�SdSrP)r�r0rar1r`r@r@rAra�s
zBufferedRandom.tellNcCs|dur|��}t�||�SrP)rar0rcrdr@r@rArc�szBufferedRandom.truncatecCs |durd}|��t�||�Sr�)rgr1r�rr@r@rAr��szBufferedRandom.readcCs|��t�||�SrP)rgr1r�r�r@r@rAr��szBufferedRandom.readintocCs|��t�||�SrP)rgr1rzrr@r@rArz�szBufferedRandom.peekr
cCs|��t�||�SrP)rgr1r�rr@r@rAr��szBufferedRandom.read1cCs|��t�||�SrP)rgr1r�r�r@r@rAr��szBufferedRandom.readinto1cCsZ|jrN|j�2|j�|jt|j�d�|��Wd�n1sD0Yt�||�Sr�)	r�r�r<rZr�r!r�r0r�r�r@r@rAr��s
&zBufferedRandom.write)r)N)N)r)r
)rLrMrNr)r�rZrarcr�r�rzr�r�r�r@r@r@rAr/ys	




r/cs�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'r
FNTrc
CsH|jdkr0z|jrt�|j�Wd|_nd|_0t|t�rBtd��t|t�rb|}|dkrftd��nd}t|t	�s~td|f��t
|�t
d�ks�td|f��tdd�|D��d	ks�|�d
�d	kr�td��d|vr�d
|_
d
|_tjtjB}nTd|vr�d
|_d}n@d|v�rd
|_tjtjB}n"d|v�r>d
|_d
|_tjtjB}d
|v�rTd
|_d
|_|j�rp|j�rp|tjO}n|j�r�|tjO}n
|tjO}|ttdd�O}ttdd��p�ttdd�}||O}d}�zT|dk�r@|�s�td��|du�r�t�||d�}n0|||�}t|t��std��|dk�r*td��|}|�s@t�|d�||_t�|�}	z(t�|	j��rvt t!j"t�#t!j"�|��Wnt$�y�Yn0t|	dd�|_%|j%d	k�r�t&|_%t'�r�t'|tj(�||_)|j�rzt�*|dt+�Wn6t�y}
z|
j!t!j,k�r�WYd}
~
n
d}
~
00Wn"|du�r6t�|��Yn0||_dS)Nrr
z$integer argument expected, got floatznegative file descriptorzinvalid mode: %szxrwab+css|]}|dvVqdS)ZrwaxNr@)�.0�cr@r@rA�	<genexpr>�r�z"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�_closefdrr4r�floatrrr"rr �sum�count�_created�	_writable�O_EXCL�O_CREAT�	_readable�O_TRUNC�
_appending�O_APPEND�O_RDWR�O_RDONLY�O_WRONLY�getattrrBr-�set_inheritabler*�stat�S_ISDIR�st_mode�IsADirectoryErrorr�ZEISDIRr�r.�_blksizer)�_setmoder�rX�lseekrZESPIPE)rHr5r3r:r�fd�flagsZnoinherit_flagZowned_fdZfdfstatr�r@r@rAr��s�




$




�




�

zFileIO.__init__cCsB|jdkr>|jr>|js>ddl}|jd|ftd|d�|��dS)Nrzunclosed file %rr
)�
stacklevel�source)r�r�rir#r$�ResourceWarningr4)rHr#r@r@rArkEs�zFileIO.__del__cCstd|jj�d���dSr�r�r`r@r@rAr�LszFileIO.__getstate__cCsnd|jj|jjf}|jr"d|Sz
|j}Wn(tyTd||j|j|jfYS0d|||j|jfSdS)Nz%s.%sz
<%s [closed]>z<%s fd=%d mode=%r closefd=%r>z<%s name=%r mode=%r closefd=%r>)	rWrMrNrirXr.r�r3r�)rH�
class_namerXr@r@rAr�Os�
�
�zFileIO.__repr__cCs|jstd��dS)NzFile not open for reading)r�rUr`r@r@rArr]szFileIO._checkReadablecCs|jstd��dS)NzFile not open for writing)r�rUrnr@r@rArtaszFileIO._checkWritablecCsR|��|��|dus |dkr(|��Szt�|j|�WStyLYdS0dSr�)rfrrr�rr�r�r�rr@r@rAr�eszFileIO.readcCs�|��|��t}z6t�|jdt�}t�|j�j}||krH||d}Wnt	y\Yn0t
�}t|�|kr�t|�}|t|t�7}|t|�}zt�
|j|�}Wnty�|r�Yq�YdS0|s�q�||7}qdt|�Sr_)rfrrr)rr
r�rr*�st_sizer-r�r!r�r�r�r)rH�bufsizer]�endr=r~r�r@r@rAr�us2
zFileIO.readallcCs4t|��d�}|�t|��}t|�}||d|�<|Sr�)r�r�r�r!)rHr�mr�r~r@r@rAr��s
zFileIO.readintocCs:|��|��zt�|j|�WSty4YdS0dSrP)rfrtrr�r�r�r�r@r@rAr��szFileIO.writecCs*t|t�rtd��|��t�|j||�S)Nzan integer is required)rr�rrfrr
r�r\r@r@rArZ�s
zFileIO.seekcCs|��t�|jdt�Sr�)rfrr
r�rr`r@r@rAra�szFileIO.tellcCs2|��|��|dur |��}t�|j|�|SrP)rfrtrar�	ftruncater�rr@r@rArc�szFileIO.truncatecs8|js4z |jrt�|j�Wt���nt���0dSrP)rir�rr4r�r�r`r�r@rAr4�s
zFileIO.closecCsD|��|jdur>z|��Wnty6d|_Yn0d|_|jS)NFT)rf�	_seekablerar-r`r@r@rArm�s
zFileIO.seekablecCs|��|jSrP)rfr�r`r@r@rArq�szFileIO.readablecCs|��|jSrP)rfr�r`r@r@rArs�szFileIO.writablecCs|��|jSrP)rfr�r`r@r@rAr+�sz
FileIO.filenocCs|��t�|j�SrP)rfrr(r�r`r@r@rAr(�sz
FileIO.isattycCs|jSrP)r�r`r@r@rAr:�szFileIO.closefdcCsJ|jr|jrdSdSn0|jr,|jr&dSdSn|jrB|jr<dSdSndSdS)Nzxb+Zxbzab+Zabzrb+rC�wb)r�r�rr�r`r@r@rAr3szFileIO.mode)rTN)N)N)N)"rLrMrNr�r�r�r�rrr�r�rkr�r�rrrtr�r�r�r�rrZrarcr4rmrqrsr+r(r�r:r3r�r@r@r�rAr'�s<
y

#



r'c@s\eZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zed
d��Z	edd��Z
edd��ZdS)�
TextIOBaser
cCs|�d�dSr�r[rr@r@rAr�"szTextIOBase.readcCs|�d�dSr�r[)rH�sr@r@rAr�,szTextIOBase.writeNcCs|�d�dSrbr[rdr@r@rArc0szTextIOBase.truncatecCs|�d�dS)Nr�r[r`r@r@rAr�4szTextIOBase.readlinecCs|�d�dSr�r[r`r@r@rAr�;szTextIOBase.detachcCsdSrPr@r`r@r@rAr7DszTextIOBase.encodingcCsdSrPr@r`r@r@rA�newlinesIszTextIOBase.newlinescCsdSrPr@r`r@r@rAr8SszTextIOBase.errors)r
)N)rLrMrNr�r�rcr�r�r�r7rr8r@r@r@rArs


	

	rc@sPeZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
ZdZ	dZ
edd��ZdS)�IncrementalNewlineDecoder�strictcCs,tjj||d�||_||_d|_d|_dS)N)r8rF)�codecs�IncrementalDecoderr��	translate�decoder�seennl�	pendingcr)rHr#r"r8r@r@rAr�ds
z"IncrementalNewlineDecoder.__init__FcCs�|jdur|}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�
Fr
T�
�
)r#�decoder%r�r�r$�_LF�_CR�_CRLFr"�replace)rH�inputr'�outputZcrlfZcrZlfr@r@rAr+ks*

�z IncrementalNewlineDecoder.decodecCs@|jdurd}d}n|j��\}}|dK}|jr8|dO}||fS)Nr�rr	)r#�getstater%)rHr��flagr@r@rAr2�s
z"IncrementalNewlineDecoder.getstatecCs8|\}}t|d@�|_|jdur4|j�||d?f�dSr�)�boolr%r#�setstate)rH�stater�r3r@r@rAr5�s
z"IncrementalNewlineDecoder.setstatecCs$d|_d|_|jdur |j��dS)NrF)r$r%r#�resetr`r@r@rAr7�s
zIncrementalNewlineDecoder.resetr	r
�cCs
d|jS)N)Nr*r()r(r*r))r*r))r(r))r(r*r))r$r`r@r@rAr�s�z"IncrementalNewlineDecoder.newlinesN)r)F)
rLrMrNr�r+r2r5r7r,r-r.r�rr@r@r@rAr]s

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)Vr2iNFc		Cs$|�|�|durrzt�|���}Wnttfy:Yn0|durrzddl}Wntyfd}Yn0|�d�}t	|t
�s�td|��t�
|�js�d}t||��|dur�d}n$t	|t
�s�td|��tr�t�|�||_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.rU�locale�ImportErrorZgetpreferredencodingrrr"r �lookup�_is_text_encoding�LookupError�
_CHECK_ERRORS�lookup_errorr��_decoded_chars�_decoded_chars_used�	_snapshotr?rmr�_tellingr��
_has_read1�
_configure)	rHr?r7r8r9r>�
write_throughr<ror@r@rAr��s@






�zTextIOWrapper.__init__cCs>|dur$t|t�s$tdt|�f��|dvr:td|f��dS)Nzillegal newline type: %r)Nrr*r(r)zillegal newline value: %r)rrr�typer")rHr9r@r@rAr:�szTextIOWrapper._check_newlinecCs�||_||_d|_d|_d|_||_|du|_||_|dk|_|pHt	j
|_||_||_
|jr�|��r�|j��}|dkr�z|���d�Wnty�Yn0dS)N�rr)�	_encoding�_errors�_encoder�_decoder�	_b2cratio�_readuniversal�_readtranslate�_readnl�_writetranslater�linesep�_writenl�_line_buffering�_write_throughrrsr?ra�_get_encoderr5r@)rHr7r8r9r>rI�positionr@r@rArHs&


zTextIOWrapper._configurecCs|d�|jj|jj�}z
|j}Wnty0Yn0|d�|�7}z
|j}Wnty\Yn0|d�|�7}|d�|j�S)Nz<{}.{}z name={0!r}z mode={0!r}z encoding={0!r}>)r�rWrMrNrXr.r3r7)rHr=rXr3r@r@rAr�'s
�

zTextIOWrapper.__repr__cCs|jSrP)rLr`r@r@rAr78szTextIOWrapper.encodingcCs|jSrP)rMr`r@r@rAr8<szTextIOWrapper.errorscCs|jSrP)rWr`r@r@rAr>@szTextIOWrapper.line_bufferingcCs|jSrP)rXr`r@r@rArIDszTextIOWrapper.write_throughcCs|jSrP)r�r`r@r@rAr?HszTextIOWrapper.buffer)r7r8r9r>rIcCs�|jdur*|dus"|dus"|tur*td��|durH|durB|j}q^d}nt|t�s^td|��|durn|j}nt|t�s�td|��|tur�|j}|�	|�|dur�|j
}|dur�|j}|��|�
|||||�dS)NzPIt is not possible to set the encoding or newline of stream after the first readrrr)rO�EllipsisrUrMrrrrLrSr:r>rIrgrH)rHr7r8r9r>rIr@r@rA�reconfigureLs>
����



�zTextIOWrapper.reconfigurecCs|jrtd��|jSru)rir"rr`r@r@rArmuszTextIOWrapper.seekablecCs
|j��SrP)r?rqr`r@r@rArqzszTextIOWrapper.readablecCs
|j��SrP)r?rsr`r@r@rArs}szTextIOWrapper.writablecCs|j��|j|_dSrP)r?rgrrFr`r@r@rArg�s
zTextIOWrapper.flushcCs8|jdur4|js4z|��W|j��n|j��0dSrP)r?rirgr4r`r@r@rAr4�s
zTextIOWrapper.closecCs|jjSrP)r?rir`r@r@rAri�szTextIOWrapper.closedcCs|jjSrP)r?rXr`r@r@rArX�szTextIOWrapper.namecCs
|j��SrP)r?r+r`r@r@rAr+�szTextIOWrapper.filenocCs
|j��SrP)r?r(r`r@r@rAr(�szTextIOWrapper.isattycCs�|jrtd��t|t�s(td|jj��t|�}|js<|j	oBd|v}|rf|jrf|j
dkrf|�d|j
�}|jpr|�
�}|�|�}|j�|�|j	r�|s�d|vr�|��|�d�d|_|jr�|j��|S)Nr�zcan't write %s to text streamr*r(r)rir"rrrrWrLr!rTrWrVr/rNrY�encoder?r�rg�_set_decoded_charsrErOr7)rHrZlengthZhaslf�encoderrr@r@rAr��s(
�


zTextIOWrapper.writecCst�|j�}||j�|_|jSrP)r �getincrementalencoderrLrMrN)rHZmake_encoderr@r@rArY�szTextIOWrapper._get_encodercCs2t�|j�}||j�}|jr(t||j�}||_|SrP)r �getincrementaldecoderrLrMrQrrRrO)rHZmake_decoderr#r@r@rA�_get_decoder�s
zTextIOWrapper._get_decodercCs||_d|_dSr�)rCrD)rH�charsr@r@rAr^�sz TextIOWrapper._set_decoded_charscCsF|j}|dur|j|d�}n|j|||�}|jt|�7_|SrP)rDrCr!)rHr~�offsetrcr@r@rA�_get_decoded_chars�sz TextIOWrapper._get_decoded_charscCs$|j|krtd��|j|8_dS)Nz"rewind decoded_chars out of bounds)rD�AssertionErrorr�r@r@rA�_rewind_decoded_chars�s
z#TextIOWrapper._rewind_decoded_charscCs�|jdurtd��|jr&|j��\}}|jr<|j�|j�}n|j�|j�}|}|j�	||�}|�
|�|r�t|�t|j�|_
nd|_
|jr�|||f|_|S)Nz
no decoderrK)rOr"rFr2rGr?r��_CHUNK_SIZEr�r+r^r!rCrPrE)rH�
dec_buffer�	dec_flags�input_chunk�eofZ
decoded_charsr@r@rA�_read_chunk�s 

zTextIOWrapper._read_chunkrcCs(||d>B|d>B|d>Bt|�d>BS)N�@���)r4)rHrZrj�
bytes_to_feed�need_eof�
chars_to_skipr@r@rA�_pack_cookie�s
�
�zTextIOWrapper._pack_cookiecCsJt|d�\}}t|d�\}}t|d�\}}t|d�\}}|||t|�|fS)Nl)�divmodr4)rHZbigint�restrZrjrrrsrtr@r@rA�_unpack_cookie		s
zTextIOWrapper._unpack_cookiec	CsP|jstd��|jstd��|��|j��}|j}|dusF|jdurX|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�rb|�
||
�W|�|�Sd}d}d}t|t|��D]x}|d7}|t|�|||d���7}|��\}}|�s�||k�r�||7}||8}|dd}
}}||k�r|�q"�q||t|jdd	d
��7}d	}||k�r"td��|�
||
|||�W|�|�S|�|�0dS)N�!underlying stream is not seekablez(telling position disabled by next() callzpending decoded textrr	r�r
FTr&z'can't reconstruct logical file position)rrUrFr-rgr?rarOrErCrfr!rDrur2rrPr5r+�range)rHrZr#rjZ
next_inputrtZsaved_stateZ
skip_bytesZ	skip_backr~r�d�	start_posZstart_flagsZ	bytes_fedrsZ
chars_decoded�irir@r@rAra	s�





 
�



�
�zTextIOWrapper.tellcCs$|��|dur|��}|j�|�SrP)rgrar?rcrdr@r@rArcs	szTextIOWrapper.truncatecCs*|jdurtd��|��|j}d|_|S)Nzbuffer is already detached)r?r"rgr�)rHr?r@r@rAr�y	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)
NcsFz�jp���}Wnty$Yn0|dkr:|�d�n|��dSr�)rNrYr@r5r7)rZr_r`r@rA�_reset_encoder�	sz*TextIOWrapper.seek.<locals>._reset_encoderr�ryrz#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)rir"rrUrrarrgr?rZr^rErOr7rxrbr5r�r+r!rCr-rD)rHZcookier^r~rZr|rjrrrsrtrkr@r`rArZ�	s`



�

�
zTextIOWrapper.seekcCs�|��|durd}n2z
|j}Wn ty@t|�d���Yn0|�}|jpT|��}|dkr�|��|j|j�	�dd�}|�
d�d|_|Sd}|�|�}t|�|kr�|s�|�
�}||�|t|��7}q�|SdS)Nr
r�rTr&rF)rrr�r.rrOrbrer+r?r�r^rEr!rm)rHr�r�r#r=rlr@r@rAr��	s,
�


zTextIOWrapper.readcCs(d|_|��}|s$d|_|j|_t�|Srl)rFr�rErr�r�r@r@rAr��	szTextIOWrapper.__next__c	Cs|jrtd��|durd}n2z
|j}Wn tyFt|�d���Yn0|�}|��}d}|jsh|��d}}|jr�|�	d|�}|dkr�|d}�q�nt
|�}n�|j�rD|�	d|�}|�	d|�}|dkr�|dkr�t
|�}n|d}�q�nX|dk�r|d}�q�n@||k�r|d}�q�n(||dk�r6|d}�q�n|d}�q�n(|�	|j�}|dk�rl|t
|j�}�q�|dk�r�t
|�|k�r�|}�q�|�
��r�|j�r��q��q�|j�r�||��7}qp|�d	�d|_|Sqp|dk�r�||k�r�|}|�t
|�|�|d|�S)
Nr�r
r�rr*r	r(r
r)rir"r�r.rrerOrbrRr|r!rQrSrmrCr^rErg)	rHr�r�r��startr]�endposZnlposZcrposr@r@rAr��	st







zTextIOWrapper.readlinecCs|jr|jjSdSrP)rOrr`r@r@rArN
szTextIOWrapper.newlines)NNNFF)NNNFF)N)rrFr)N)r)N)N)+rLrMrNrhr�r�r:rHr�r�r7r8r>rIr?r[r\rmrqrsrgr4rirXr+r(r�rYrbr^rergrmrurxrarcr�rZr�r�r�rr@r@r@rAr2�sl�
*�
$




�)



*�

c

K
	
]r2csNeZdZd�fdd�	Zdd�Zdd�Zed	d
��Zedd��Zd
d�Z	�Z
S)�StringIOrr*csftt|�jt�dd|d�|dur(d|_|durbt|t�sNtd�t	|�j
���|�|�|�d�dS)Nzutf-8�
surrogatepass)r7r8r9Fz*initial_value must be str or None, not {0}r)
r�r�r�r�rTrrrr�rJrLr�rZ)rHZ
initial_valuer9r�r@rAr�Z
s�
�
zStringIO.__init__c	CsX|��|jp|��}|��}|��z |j|j��dd�W|�|�S|�|�0dS)NTr&)	rgrOrbr2r7r+r?r�r5)rHr#Z	old_stater@r@rAr�j
s
�zStringIO.getvaluecCs
t�|�SrP)�objectr�r`r@r@rAr�t
szStringIO.__repr__cCsdSrPr@r`r@r@rAr8y
szStringIO.errorscCsdSrPr@r`r@r@rAr7}
szStringIO.encodingcCs|�d�dSr�r[r`r@r@rAr��
szStringIO.detach)rr*)rLrMrNr�r�r�r�r8r7r�r�r@r@r�rAr�S
s


r�)rr
NNNTN)8r�abcr r�r�sys�_threadrr��platformZmsvcrtrr�iorrrrr�r��addr�	SEEK_DATAr)r�r�dev_moderjrArBrE�	open_coder.rFrOrUr-r"�ABCMetarV�registerr��_ior'r�r�r�r1r0r�r/rr!rr2r�r@r@r@rA�<module>s�

�
[

	
#=
gkCiIJY@U&