Hacked By AnonymousFox

Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/_pyio.cpython-35.opt-2.pyc



���]�W�@s[ddlZddlZddlZddlZddlZddlZddlZyddlmZ	Wn"e
k
r�ddlmZ	YnXejddhkr�ddl
mZndZddlZddlmZmZmZmZdddhZeed	�r'ejej�ejej�d
dZeZdddddd
ddd�ZGdd�d�ZGdd�d�Zy
ejZWn+e k
r�Gdd�de!e"�ZYnXGdd�ddej#�Z$ej$j%e$�Gdd�de$�Z&ej&j%e&�ddl'm(Z(e&j%e(�Gdd�de$�Z)ej)j%e)�Gdd�de)�Z*Gd d!�d!e)�Z+Gd"d#�d#e*�Z,Gd$d%�d%e*�Z-Gd&d'�d'e)�Z.Gd(d)�d)e-e,�Z/Gd*d+�d+e&�Z(Gd,d-�d-e$�Z0ej0j%e0�Gd.d/�d/ej1�Z2Gd0d1�d1e0�Z3Gd2d3�d3e3�Z4dS)4�N)�
allocate_lock�win32�cygwin)�setmode)�__all__�SEEK_SET�SEEK_CUR�SEEK_END���	SEEK_HOLE�i�rTcCsSt|tttf�s(td|��t|t�sGtd|��t|t�sftd|��|dk	r�t|t�r�td|��|dk	r�t|t�r�td|��t|�}|td�s�t|�t|�krtd|��d|k}	d|k}
d	|k}d
|k}d|k}
d|k}d
|k}d|kr�|	st|st|r�td��ddl}|j	dt
d�d}
|r�|r�td��|	|
||dkr�td��|	p�|
p�|p�|std��|r#|dk	r#td��|rA|dk	rAtd��|r_|dk	r_td��t||	rqdptd|
r�dp�d|r�d	p�d|r�d
p�d|
r�dp�d|d|�}|}ynd}|dks�|dkr|j�rd!}d}|dkr]t
}ytj|j��j}Wnttfk
rJYnX|dkr]|}|dkrutd��|dkr�|r�|Std��|
r�t||�}nL|	s�|s�|r�t||�}n(|
r�t||�}ntd |��|}|r|St|||||�}|}||_|SWn|j��YnXdS)"Nzinvalid file: %rzinvalid mode: %rzinvalid buffering: %rzinvalid encoding: %rzinvalid errors: %rzaxrwb+tU�xr�w�a�+�t�b�Uz$can't use U and writing mode at oncerz'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 argument��openerFzinvalid buffering sizezcan't have unbuffered text I/Ozunknown mode: %r���)�
isinstance�str�bytes�int�	TypeError�set�len�
ValueError�warnings�warn�DeprecationWarning�FileIO�isatty�DEFAULT_BUFFER_SIZE�os�fstat�fileno�
st_blksize�OSError�AttributeError�BufferedRandom�BufferedWriter�BufferedReader�
TextIOWrapper�mode�close)�filer1�	buffering�encoding�errors�newline�closefdrZmodesZcreating�reading�writingZ	appendingZupdating�text�binaryr!�raw�result�line_buffering�bs�buffer�rB�*/opt/alt/python35/lib64/python3.5/_pyio.py�open)s�{(	
?$	
rDc@seZdZdd�ZdS)�
DocDescriptorcCsdtjS)Nz\open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True)

)rD�__doc__)�self�obj�typrBrBrC�__get__�szDocDescriptor.__get__N)�__name__�
__module__�__qualname__rJrBrBrBrCrE�srEc@s%eZdZe�Zdd�ZdS)�OpenWrappercOs
t||�S)N)rD)�cls�args�kwargsrBrBrC�__new__szOpenWrapper.__new__N)rKrLrMrErFrRrBrBrBrCrNs	rNc@seZdZdS)�UnsupportedOperationN)rKrLrMrBrBrBrCrSsrSc@sTeZdZdd�Zddd�Zdd�Zdd	d
�Zdd�Zd
Zdd�Z	dd�Z
dd�Zddd�Zdd�Z
ddd�Zdd�Zddd�Zedd��Zdd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd5d+d,�Zd-d.�Zd/d0�Zdd1d2�Zd3d4�ZdS)6�IOBasecCs td|jj|f��dS)Nz%s.%s() not supported)rS�	__class__rK)rG�namerBrBrC�_unsupported?szIOBase._unsupportedrcCs|jd�dS)N�seek)rW)rG�pos�whencerBrBrCrXFszIOBase.seekcCs|jdd�S)Nrr
)rX)rGrBrBrC�tellVszIOBase.tellNcCs|jd�dS)N�truncate)rW)rGrYrBrBrCr\ZszIOBase.truncatecCs|j�dS)N)�_checkClosed)rGrBrBrC�flushdszIOBase.flushFcCs(|js$z|j�Wdd|_XdS)NT)�_IOBase__closedr^)rGrBrBrCr2ns	zIOBase.closec	Csy|j�WnYnXdS)N)r2)rGrBrBrC�__del__yszIOBase.__del__cCsdS)NFrB)rGrBrBrC�seekable�szIOBase.seekablecCs.|j�s*t|dkr!dn|��dS)NzFile or stream is not seekable.)rarS)rG�msgrBrBrC�_checkSeekable�szIOBase._checkSeekablecCsdS)NFrB)rGrBrBrC�readable�szIOBase.readablecCs.|j�s*t|dkr!dn|��dS)NzFile or stream is not readable.)rdrS)rGrbrBrBrC�_checkReadable�szIOBase._checkReadablecCsdS)NFrB)rGrBrBrC�writable�szIOBase.writablecCs.|j�s*t|dkr!dn|��dS)NzFile or stream is not writable.)rfrS)rGrbrBrBrC�_checkWritable�szIOBase._checkWritablecCs|jS)N)r_)rGrBrBrC�closed�sz
IOBase.closedcCs+|jr't|dkrdn|��dS)NzI/O operation on closed file.)rhr )rGrbrBrBrCr]�s	zIOBase._checkClosedcCs|j�|S)N)r])rGrBrBrC�	__enter__�s
zIOBase.__enter__cGs|j�dS)N)r2)rGrPrBrBrC�__exit__�szIOBase.__exit__cCs|jd�dS)Nr))rW)rGrBrBrCr)�sz
IOBase.filenocCs|j�dS)NF)r])rGrBrBrCr%�s
z
IOBase.isattyr
cs�t�d�r'��fdd�}ndd�}�dkrHd	�nt�t�sctd��t�}xU�dks�t|��kr��j|��}|s�P||7}|jd�roPqoWt|�S)
N�peekcsW�jd�}|sdS|jd�dp5t|�}�dkrSt|��}|S)Nr
s
r)rk�findr�min)Z	readahead�n)rG�sizerBrC�
nreadahead�sz#IOBase.readline.<locals>.nreadaheadcSsdS)Nr
rBrBrBrBrCrp�sr
zsize must be an integerrs
r)	�hasattrrrr�	bytearrayr�read�endswithr)rGrorp�resrrB)rGrorC�readline�s 			!
zIOBase.readlinecCs|j�|S)N)r])rGrBrBrC�__iter__s
zIOBase.__iter__cCs|j�}|st�|S)N)rv�
StopIteration)rG�linerBrBrC�__next__
szIOBase.__next__cCsm|dks|dkr"t|�Sd}g}x8|D]0}|j|�|t|�7}||kr5Pq5W|S)Nr)�list�appendr)rGZhintrn�linesryrBrBrC�	readliness


zIOBase.readlinescCs,|j�x|D]}|j|�qWdS)N)r]�write)rGr}ryrBrBrC�
writelines"s

zIOBase.writelinesr)rKrLrMrWrXr[r\r^r_r2r`rarcrdrerfrg�propertyrhr]rirjr)r%rvrwrzr~r�rBrBrBrCrTs2$
	
%rT�	metaclassc@sCeZdZddd�Zdd�Zdd�Zdd	�Zd
S)�	RawIOBaser
cCsp|dkrd}|dkr(|j�St|j��}|j|�}|dkrYdS||d�=t|�S)Nr
rr)�readallrr�	__index__�readintor)rGrorrnrBrBrCrs8s

zRawIOBase.readcCsHt�}x$|jt�}|s"P||7}qW|r@t|�S|SdS)N)rrrsr&r)rGru�datarBrBrCr�Is	
zRawIOBase.readallcCs|jd�dS)Nr�)rW)rGrrBrBrCr�WszRawIOBase.readintocCs|jd�dS)Nr)rW)rGrrBrBrCr_szRawIOBase.writeNr)rKrLrMrsr�r�rrBrBrBrCr�*sr�)r$c@sjeZdZddd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�BufferedIOBaseNcCs|jd�dS)Nrs)rW)rGrorBrBrCrs}szBufferedIOBase.readcCs|jd�dS)N�read1)rW)rGrorBrBrCr��szBufferedIOBase.read1cCs|j|dd�S)Nr�F)�	_readinto)rGrrBrBrCr��szBufferedIOBase.readintocCs|j|dd�S)Nr�T)r�)rGrrBrBrC�	readinto1�s	zBufferedIOBase.readinto1cCs}t|t�st|�}|jd�}|rH|jt|��}n|jt|��}t|�}||d|�<|S)N�B)r�
memoryview�castr�rrs)rGrr�r�rnrBrBrCr��szBufferedIOBase._readintocCs|jd�dS)Nr)rW)rGrrBrBrCr�s	zBufferedIOBase.writecCs|jd�dS)N�detach)rW)rGrBrBrCr��szBufferedIOBase.detach)
rKrLrMrsr�r�r�r�rr�rBrBrBrCr�lsr�c@s�eZdZdd�Zddd�Zdd�Zdd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
edd��Zedd��Z
edd��Zedd��Zdd�Zdd�Zdd �Zd!d"�ZdS)#�_BufferedIOMixincCs
||_dS)N)�_raw)rGr=rBrBrC�__init__�sz_BufferedIOMixin.__init__rcCs1|jj||�}|dkr-td��|S)Nrz#seek() returned an invalid position)r=rXr+)rGrYrZZnew_positionrBrBrCrX�sz_BufferedIOMixin.seekcCs+|jj�}|dkr'td��|S)Nrz#tell() returned an invalid position)r=r[r+)rGrYrBrBrCr[�sz_BufferedIOMixin.tellNcCs2|j�|dkr"|j�}|jj|�S)N)r^r[r=r\)rGrYrBrBrCr\�s
z_BufferedIOMixin.truncatecCs&|jrtd��|jj�dS)Nzflush of closed file)rhr r=r^)rGrBrBrCr^�s	z_BufferedIOMixin.flushc
Cs<|jdk	r8|jr8z|j�Wd|jj�XdS)N)r=rhr^r2)rGrBrBrCr2sz_BufferedIOMixin.closecCs;|jdkrtd��|j�|j}d|_|S)Nzraw stream already detached)r=r r^r�)rGr=rBrBrCr�s
		z_BufferedIOMixin.detachcCs
|jj�S)N)r=ra)rGrBrBrCrasz_BufferedIOMixin.seekablecCs|jS)N)r�)rGrBrBrCr=sz_BufferedIOMixin.rawcCs
|jjS)N)r=rh)rGrBrBrCrhsz_BufferedIOMixin.closedcCs
|jjS)N)r=rV)rGrBrBrCrV sz_BufferedIOMixin.namecCs
|jjS)N)r=r1)rGrBrBrCr1$sz_BufferedIOMixin.modecCstdj|jj���dS)Nz can not serialize a '{0}' object)r�formatrUrK)rGrBrBrC�__getstate__(s	z_BufferedIOMixin.__getstate__cCsa|jj}|jj}y
|j}Wn"tk
rIdj||�SYnXdj|||�SdS)Nz<{}.{}>z<{}.{} name={!r}>)rUrLrMrV�	Exceptionr�)rG�modnameZclsnamerVrBrBrC�__repr__,s

z_BufferedIOMixin.__repr__cCs
|jj�S)N)r=r))rGrBrBrCr)8sz_BufferedIOMixin.filenocCs
|jj�S)N)r=r%)rGrBrBrCr%;sz_BufferedIOMixin.isatty)rKrLrMr�rXr[r\r^r2r�rar�r=rhrVr1r�r�r)r%rBrBrBrCr��s 	
r�cs�eZdZddd�Zdd�Zdd�Zdd	�Z�fd
d�Zddd
�Zdd�Z	dd�Z
ddd�Zdd�Zddd�Z
dd�Zdd�Zdd�Z�S)�BytesIONcCs5t�}|dk	r||7}||_d|_dS)Nr)rr�_buffer�_pos)rGZ
initial_bytes�bufrBrBrCr�Cs
	
	zBytesIO.__init__cCs"|jrtd��|jj�S)Nz__getstate__ on closed file)rhr �__dict__�copy)rGrBrBrCr�Js	zBytesIO.__getstate__cCs"|jrtd��t|j�S)Nzgetvalue on closed file)rhr rr�)rGrBrBrC�getvalueOs	zBytesIO.getvaluecCs"|jrtd��t|j�S)Nzgetbuffer on closed file)rhr r�r�)rGrBrBrC�	getbufferVs	zBytesIO.getbuffercs|jj�t�j�dS)N)r��clear�superr2)rG)rUrBrCr2]s
z
BytesIO.closecCs�|jrtd��|dkr'd}|dkrBt|j�}t|j�|jkr^dStt|j�|j|�}|j|j|�}||_t|�S)Nzread from closed filer
r�r)rhr rr�r�rmr)rGroZnewposrrBrBrCrsas		zBytesIO.readcCs
|j|�S)N)rs)rGrorBrBrCr�osz
BytesIO.read1cCs�|jrtd��t|t�r0td��t|��}|j}WdQRX|dkr_dS|j}|t|j	�kr�d|t|j	�}|j	|7_	||j	|||�<|j|7_|S)Nzwrite to closed filez can't write str to binary streamrs)
rhr rrrr��nbytesr�rr�)rGr�viewrnrYZpaddingrBrBrCrts		z
BytesIO.writercCs�|jrtd��y|jWn4tk
rV}ztd�|�WYdd}~XnX|dkr�|dkr�td|f��||_nb|dkr�td|j|�|_n:|dkr�tdt|j�|�|_ntd��|jS)Nzseek on closed filezan integer is requiredrznegative seek position %rr
rzunsupported whence value)	rhr r�r,rr��maxrr�)rGrYrZ�errrBrBrCrX�s 	""zBytesIO.seekcCs|jrtd��|jS)Nztell on closed file)rhr r�)rGrBrBrCr[�s	zBytesIO.tellcCs�|jrtd��|dkr-|j}nay|jWn4tk
rn}ztd�|�WYdd}~XnX|dkr�td|f��|j|d�=|S)Nztruncate on closed filezan integer is requiredrznegative truncate position %r)rhr r�r�r,rr�)rGrYr�rBrBrCr\�s	"zBytesIO.truncatecCs|jrtd��dS)NzI/O operation on closed file.T)rhr )rGrBrBrCrd�s	zBytesIO.readablecCs|jrtd��dS)NzI/O operation on closed file.T)rhr )rGrBrBrCrf�s	zBytesIO.writablecCs|jrtd��dS)NzI/O operation on closed file.T)rhr )rGrBrBrCra�s	zBytesIO.seekable)rKrLrMr�r�r�r�r2rsr�rrXr[r\rdrfrarBrB)rUrCr�?sr�c@s�eZdZedd�Zdd�Zdd�Zddd	�Zdd
d�Zdd
d�Z	ddd�Z
dd�Zdd�Zdd�Z
ddd�ZdS)r/cCsc|j�std��tj||�|dkr@td��||_|j�t�|_dS)Nz "raw" argument must be readable.rzinvalid buffer size)	rdr+r�r�r �buffer_size�_reset_read_buf�Lock�
_read_lock)rGr=r�rBrBrCr��s	
zBufferedReader.__init__cCs
|jj�S)N)r=rd)rGrBrBrCrd�szBufferedReader.readablecCsd|_d|_dS)Nr�r)�	_read_buf�	_read_pos)rGrBrBrCr��s	zBufferedReader._reset_read_bufNc	CsF|dk	r$|dkr$td��|j�|j|�SWdQRXdS)Nr
zinvalid number of bytes to readr)r r��_read_unlocked)rGrorBrBrCrs�s
zBufferedReader.readcCsd}d}|j}|j}|dks6|dkr|j�t|jd�r�|jj�}|dkr�||d�p�dS||d�|S||d�g}d}xC|jj�}||kr�|}P|t|�7}|j|�q�Wdj	|�p|St|�|}	||	krB|j|7_||||�S||d�g}t
|j|�}
xR|	|kr�|jj|
�}||kr�|}P|	t|�7}	|j|�qjWt||	�}dj	|�}||d�|_d|_|r
|d|�S|S)Nr�r
r�r)r�Nr)
r�r�r�rqr=r�rsrr|�joinr�r�rm)rGrnZ
nodata_valZempty_valuesr�rY�chunk�chunksZcurrent_size�availZwanted�outrBrBrCr��sN		
	zBufferedReader._read_unlockedrc	Cs"|j�|j|�SWdQRXdS)N)r��_peek_unlocked)rGrorBrBrCrks
zBufferedReader.peekcCs�t||j�}t|j�|j}||ks@|dkr�|j|}|jj|�}|r�|j|jd�||_d|_|j|jd�S)Nr)rmr�rr�r�r=rs)rGrnZwantZhaveZto_read�currentrBrBrCr�(s
	zBufferedReader._peek_unlockedcCsp|dkrtd��|dkr(dS|j�8|jd�|jt|t|j�|j��SWdQRXdS)Nrz(number of bytes to read must be positiver�r
)r r�r�r�rmrr�r�)rGrorBrBrCr�3s

zBufferedReader.read1cCset|t�st|�}|jdkr.dS|jd�}d}|j�x
|t|�krYtt|j�|jt|��}|r�|j|j|j|�||||�<|j|7_||7}|t|�kr�Pt|�||j	kr-|j
j||d��}|s P||7}n|o6|sI|jd�sIP|rP|rPPqPWWdQRX|S)Nrr�r
)
rr�r�r�r�rrmr�r�r�r=r�r�)rGr�r��writtenr�rnrBrBrCr�Es4
%+

zBufferedReader._readintocCs!tj|�t|j�|jS)N)r�r[rr�r�)rGrBrBrCr[sszBufferedReader.tellcCsv|tkrtd��|j�N|dkrH|t|j�|j8}tj|||�}|j�|SWdQRXdS)Nzinvalid whence valuer
)	�valid_seek_flagsr r�rr�r�r�rXr�)rGrYrZrBrBrCrXvs

zBufferedReader.seek)rKrLrMr&r�rdr�rsr�rkr�r�r�r[rXrBrBrBrCr/�s

4
.r/c@syeZdZedd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�Z	dd�Z
ddd�ZdS)r.cCse|j�std��tj||�|dkr@td��||_t�|_t�|_	dS)Nz "raw" argument must be writable.rzinvalid buffer size)
rfr+r�r�r r�rr�
_write_bufr��_write_lock)rGr=r�rBrBrCr��s	zBufferedWriter.__init__cCs
|jj�S)N)r=rf)rGrBrBrCrf�szBufferedWriter.writablecCsT|jrtd��t|t�r0td��|j�t|j�|jkr\|j	�t|j�}|jj
|�t|j�|}t|j�|jkrEy|j	�Wn�tk
rD}znt|j�|jkr2t|j�|j}||8}|jd|j�|_t|j|j
|��WYdd}~XnX|SWdQRXdS)Nzwrite to closed filez can't write str to binary stream)rhr rrrr�rr�r��_flush_unlocked�extend�BlockingIOError�errno�strerror)rGrZbeforer��eZoveragerBrBrCr�s(	


+zBufferedWriter.writeNc	CsJ|j�:|j�|dkr/|jj�}|jj|�SWdQRXdS)N)r�r�r=r[r\)rGrYrBrBrCr\�s


zBufferedWriter.truncatec	Cs|j�|j�WdQRXdS)N)r�r�)rGrBrBrCr^�s
zBufferedWriter.flushcCs�|jrtd��x�|jr�y|jj|j�}Wntk
rZtd��YnX|dkr|ttjdd��|t	|j�ks�|dkr�t
d��|jd|�=qWdS)Nzflush of closed filezHself.raw should implement RawIOBase: it should not raise BlockingIOErrorz)write could not complete without blockingrz*write() returned incorrect number of bytes)rhr r�r=rr��RuntimeErrorr��EAGAINrr+)rGrnrBrBrCr��s	
!zBufferedWriter._flush_unlockedcCstj|�t|j�S)N)r�r[rr�)rGrBrBrCr[�szBufferedWriter.tellrcCsJ|tkrtd��|j�"|j�tj|||�SWdQRXdS)Nzinvalid whence value)r�r r�r�r�rX)rGrYrZrBrBrCrX�s


zBufferedWriter.seek)rKrLrMr&r�rfrr\r^r�r[rXrBrBrBrCr.�s	r.c@s�eZdZedd�Zddd�Zdd�Zdd	�Zd
dd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zedd��ZdS)�BufferedRWPaircCsX|j�std��|j�s0td��t||�|_t||�|_dS)Nz#"reader" argument must be readable.z#"writer" argument must be writable.)rdr+rfr/�readerr.�writer)rGr�r�r�rBrBrCr��szBufferedRWPair.__init__NcCs"|dkrd}|jj|�S)Nr
r)r�rs)rGrorBrBrCrs�szBufferedRWPair.readcCs|jj|�S)N)r�r�)rGrrBrBrCr��szBufferedRWPair.readintocCs|jj|�S)N)r�r)rGrrBrBrCrszBufferedRWPair.writercCs|jj|�S)N)r�rk)rGrorBrBrCrkszBufferedRWPair.peekcCs|jj|�S)N)r�r�)rGrorBrBrCr�szBufferedRWPair.read1cCs|jj|�S)N)r�r�)rGrrBrBrCr�	szBufferedRWPair.readinto1cCs
|jj�S)N)r�rd)rGrBrBrCrdszBufferedRWPair.readablecCs
|jj�S)N)r�rf)rGrBrBrCrfszBufferedRWPair.writablecCs
|jj�S)N)r�r^)rGrBrBrCr^szBufferedRWPair.flushc
Cs&z|jj�Wd|jj�XdS)N)r�r2r�)rGrBrBrCr2szBufferedRWPair.closecCs|jj�p|jj�S)N)r�r%r�)rGrBrBrCr%szBufferedRWPair.isattycCs
|jjS)N)r�rh)rGrBrBrCrhszBufferedRWPair.closed)rKrLrMr&r�rsr�rrkr�r�rdrfr^r2r%r�rhrBrBrBrCr��sr�c@s�eZdZedd�Zddd�Zdd�Zdd	d
�Zddd�Zd
d�Z	ddd�Z
dd�Zdd�Zdd�Z
dS)r-cCs4|j�tj|||�tj|||�dS)N)rcr/r�r.)rGr=r�rBrBrCr�,s
zBufferedRandom.__init__rcCs�|tkrtd��|j�|jr_|j�(|jj|jt|j�d�WdQRX|jj||�}|j�|j	�WdQRX|dkr�t
d��|S)Nzinvalid whence valuer
rz seek() returned invalid position)r�r r^r�r�r=rXr�rr�r+)rGrYrZrBrBrCrX1s
	
*
zBufferedRandom.seekcCs'|jrtj|�Stj|�SdS)N)r�r.r[r/)rGrBrBrCr[Bs	
zBufferedRandom.tellNcCs(|dkr|j�}tj||�S)N)r[r.r\)rGrYrBrBrCr\HszBufferedRandom.truncatecCs,|dkrd}|j�tj||�S)Nr
r)r^r/rs)rGrorBrBrCrsNs
zBufferedRandom.readcCs|j�tj||�S)N)r^r/r�)rGrrBrBrCr�Ts
zBufferedRandom.readintocCs|j�tj||�S)N)r^r/rk)rGrorBrBrCrkXs
zBufferedRandom.peekcCs|j�tj||�S)N)r^r/r�)rGrorBrBrCr�\s
zBufferedRandom.read1cCs|j�tj||�S)N)r^r/r�)rGrrBrBrCr�`s
zBufferedRandom.readinto1cCsW|jrG|j�2|jj|jt|j�d�|j�WdQRXtj||�S)Nr
)	r�r�r=rXr�rr�r.r)rGrrBrBrCrds
	
#zBufferedRandom.write)rKrLrMr&r�rXr[r\rsr�rkr�r�rrBrBrBrCr-#s	r-cs]eZdZd0ZdZdZdZdZdZdZ	ddddd�Z
dd	�Zd
d�Zdd
�Z
dd�Zddd�Zddd�Zdd�Zdd�Zdd�Zedd�Zdd�Zddd�Z�fd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zed,d-��Zed.d/��Z �S)1r$r
FNTrc
Cs|jdkr9z|jr+tj|j�Wdd|_Xt|t�rTtd��t|t�r�|}|dkr�td��nd}t|t	�s�td|f��t
|�t
d�ks�td|f��tdd�|D��dks|jd	�dkrtd
��d|krHd|_
d|_tjtjB}ntd
|krfd|_d}nVd|kr�d|_tjtjB}n.d|kr�d|_d|_tjtjB}d	|kr�d|_d|_|jr�|jr�|tjO}n&|jr|tjO}n
|tjO}|ttdd�O}ttdd�pYttdd�}||O}d}yp|dkr|s�td��|dkr�tj||d�}nB|||�}t|t�s�td��|dkr�td��|}|stj|d�||_tj|�}	y7tj|	j�r]t t!j"tj#t!j"�|��Wnt$k
rrYnXt|	dd�|_%|j%dkr�t&|_%t'r�t'|tj(�||_)|jr�tj*|dt+�Wn$|dk	r�tj|��YnX||_dS)Nrr
z$integer argument expected, got floatznegative file descriptorzinvalid mode: %szxrwab+css|]}|dkVqdS)ZrwaxNrB)�.0�crBrBrC�	<genexpr>�sz"FileIO.__init__.<locals>.<genexpr>rzKMust have exactly one of create/read/write/append mode and at most one plusrTrrr�O_BINARYZO_NOINHERIT�	O_CLOEXECz'Cannot use closefd=False with file namei�zexpected integer from openerzNegative file descriptorFr*rr),�_fd�_closefdr'r2r�floatrrr rr�sum�count�_created�	_writable�O_EXCL�O_CREAT�	_readable�O_TRUNC�
_appending�O_APPEND�O_RDWR�O_RDONLY�O_WRONLY�getattrrDr+�set_inheritabler(�stat�S_ISDIR�st_mode�IsADirectoryErrorr�ZEISDIRr�r,�_blksizer&�_setmoder�rV�lseekr	)
rGr3r1r8r�fd�flagsZnoinherit_flagZowned_fdZfdfstatrBrBrCr�vs�
	
4										

		
			
zFileIO.__init__cCsY|jdkrU|jrU|jrUddl}|jd|ftdd�|j�dS)Nrzunclosed file %r�
stacklevelr)r�r�rhr!r"�ResourceWarningr2)rGr!rBrBrCr`�s
"zFileIO.__del__cCstd|jj��dS)Nzcannot serialize '%s' object)rrUrK)rGrBrBrCr��szFileIO.__getstate__c
Cs�d|jj|jjf}|jr-d|Sy
|j}Wn/tk
rkd||j|j|jfSYnXd|||j|jfSdS)Nz%s.%sz
<%s [closed]>z<%s fd=%d mode=%r closefd=%r>z<%s name=%r mode=%r closefd=%r>)	rUrLrMrhrVr,r�r1r�)rG�
class_namerVrBrBrCr��s	

zFileIO.__repr__cCs|jstd��dS)NzFile not open for reading)r�rS)rGrBrBrCres	zFileIO._checkReadablecCs|jstd��dS)NzFile not open for writing)r�rS)rGrbrBrBrCrgs	zFileIO._checkWritablecCsj|j�|j�|dks,|dkr6|j�Sytj|j|�SWntk
redSYnXdS)Nr)r]rer�r'rsr�r�)rGrorBrBrCrss



zFileIO.readcCs|j�|j�t}yKtj|jdt�}tj|j�j}||krd||d}Wnt	k
ryYnXt
�}x�t|�|kr�t|�}|t|t�7}|t|�}ytj
|j|�}Wntk
r�|r�PdSYnX|sP||7}q�Wt|�S)Nrr
)r]rer&r'r�r�rr(�st_sizer+rrrr�rsr�r)rG�bufsizerY�endr>rnr�rBrBrCr�s4


	
	zFileIO.readallcCsJt|�jd�}|jt|��}t|�}||d|�<|S)Nr�)r�r�rsr)rGr�mr�rnrBrBrCr�>s
zFileIO.readintocCsH|j�|j�ytj|j|�SWntk
rCdSYnXdS)N)r]rgr'rr�r�)rGrrBrBrCrFs


zFileIO.writecCs;t|t�rtd��|j�tj|j||�S)Nzan integer is required)rr�rr]r'r�r�)rGrYrZrBrBrCrXTs
zFileIO.seekcCs |j�tj|jdt�S)Nr)r]r'r�r�r)rGrBrBrCr[ds
zFileIO.tellcCsC|j�|j�|dkr,|j�}tj|j|�|S)N)r]rgr[r'�	ftruncater�)rGrorBrBrCr\ks

zFileIO.truncatec
s;|js7z|jr%tj|j�Wdt�j�XdS)N)rhr�r'r2r�r�)rG)rUrBrCr2xs
		zFileIO.closecCsU|j�|jdkrNy|j�Wntk
rDd|_Yn
Xd|_|jS)NFT)r]�	_seekabler[r+)rGrBrBrCra�s

	zFileIO.seekablecCs|j�|jS)N)r]r�)rGrBrBrCrd�s
zFileIO.readablecCs|j�|jS)N)r]r�)rGrBrBrCrf�s
zFileIO.writablecCs|j�|jS)N)r]r�)rGrBrBrCr)�s
z
FileIO.filenocCs|j�tj|j�S)N)r]r'r%r�)rGrBrBrCr%�s
z
FileIO.isattycCs|jS)N)r�)rGrBrBrCr8�szFileIO.closefdcCs_|jr|jrdSdSn>|jr:|jr3dSdSn!|jrW|jrPdSdSndSdS)Nzxb+�xbzab+�abzrb+�rb�wb)r�r�r�r�)rGrBrBrCr1�s						zFileIO.moder)!rKrLrMr�r�r�r�r�r�r�r�r`r�r�rergrsr�r�rrrXr[r\r2rardrfr)r%r�r8r1rBrB)rUrCr$ms8u#

r$c@s�eZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zed
d��Z	edd��Z
edd��ZdS)�
TextIOBaser
cCs|jd�dS)Nrs)rW)rGrorBrBrCrs�szTextIOBase.readcCs|jd�dS)Nr)rW)rG�srBrBrCr�szTextIOBase.writeNcCs|jd�dS)Nr\)rW)rGrYrBrBrCr\�szTextIOBase.truncatecCs|jd�dS)Nrv)rW)rGrBrBrCrv�szTextIOBase.readlinecCs|jd�dS)Nr�)rW)rGrBrBrCr��szTextIOBase.detachcCsdS)NrB)rGrBrBrCr5�szTextIOBase.encodingcCsdS)NrB)rGrBrBrC�newlines�szTextIOBase.newlinescCsdS)NrB)rGrBrBrCr6�szTextIOBase.errorsr)rKrLrMrsrr\rvr�r�r5r�r6rBrBrBrCr��s	
	
r�c@sveZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
ZdZ	dZ
edd��ZdS)�IncrementalNewlineDecoder�strictcCs>tjj|d|�||_||_d|_d|_dS)Nr6rF)�codecs�IncrementalDecoderr��	translate�decoder�seennl�	pendingcr)rGr�r�r6rBrBrCr�s
			z"IncrementalNewlineDecoder.__init__FcCs+|jdkr|}n|jj|d|�}|jrX|sE|rXd|}d|_|jd�r�|r�|dd�}d|_|jd�}|jd�|}|jd�|}|j|o�|j|o�|jB|o�|jBO_|j	r'|r|j
dd�}|r'|j
dd�}|S)	N�final�
Fr
Tz
�
r)r��decoder�rtr�r��_LF�_CR�_CRLFr��replace)rG�inputr��outputZcrlfZcrZlfrBrBrCr�s(	
		+	z IncrementalNewlineDecoder.decodecCsZ|jdkrd}d}n|jj�\}}|dK}|jrP|dO}||fS)Nr�rr
)r��getstater�)rGr��flagrBrBrCr1s	
	
z"IncrementalNewlineDecoder.getstatecCsL|\}}t|d@�|_|jdk	rH|jj||d?f�dS)Nr
)�boolr�r��setstate)rG�stater�rrBrBrCr	<sz"IncrementalNewlineDecoder.setstatecCs2d|_d|_|jdk	r.|jj�dS)NrF)r�r�r��reset)rGrBrBrCrBs		zIncrementalNewlineDecoder.resetr
r�c
Csd|jS)	Nr�r��
�r�r��r�r
�r�r
�r�r�r
)Nr�r�rr
rrr)r�)rGrBrBrCr�Lsz"IncrementalNewlineDecoder.newlinesN)
rKrLrMr�r�rr	rrrrr�r�rBrBrBrCr�sr�c@s�eZdZdZddddddd�Zdd�Zedd	��Zed
d��Zedd
��Z	edd��Z
dd�Zdd�Zdd�Z
dd�Zdd�Zedd��Zedd��Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zdd*d+�Zd,d-�Zd.d/�Zd0d0d0d0d1d2�Zd3d4�Zd5d6�Zdd7d8�Zd9d:�Zd0d;d<�Z dd=d>�Z!d?d@�Z"ddAdB�Z#edCdD��Z$dS)Er0iNFc
Cs�|dk	r5t|t�r5tdt|�f��|dkrTtd|f��|dkr�ytj|j��}Wntt	fk
r�YnX|dkr�yddl
}Wntk
r�d}YnX|jd	�}t|t�s�td
|��t
j|�js!d}t||��|dkr6d}nt|t�sUtd
|��||_||_||_||_||_|dk|_||_|dk|_|p�tj|_d|_d|_d|_d|_d|_|j j!�|_"|_#t$|j d�|_%d|_&|j"r||j'�r||j j(�}	|	dkr|y|j)�j*d�Wntk
r{YnXdS)Nzillegal newline type: %rrr�r��
zillegal newline value: %rr�asciiFzinvalid encoding: %rzG%r is not a text encoding; use codecs.open() to handle arbitrary codecsr�zinvalid errors: %rr�g)Nrr�r�r)+rrr�typer r'�device_encodingr)r,rS�locale�ImportError�getpreferredencodingr��lookup�_is_text_encoding�LookupErrorr��_line_buffering�	_encoding�_errors�_readuniversal�_readtranslate�_readnl�_writetranslate�linesep�_writenl�_encoder�_decoder�_decoded_chars�_decoded_chars_used�	_snapshotrArar��_tellingrq�
_has_read1�	_b2cratiorfr[�_get_encoderr	)
rGrAr5r6r7r?�
write_throughrrb�positionrBrBrCr�vs`
					
							
zTextIOWrapper.__init__cCs�dj|jj|jj�}y
|j}Wntk
r?YnX|dj|�7}y
|j}Wntk
rtYnX|dj|�7}|dj|j�S)Nz<{}.{}z name={0!r}z mode={0!r}z encoding={0!r}>)r�rUrLrMrVr�r1r5)rGr>rVr1rBrBrCr��s



zTextIOWrapper.__repr__cCs|jS)N)r)rGrBrBrCr5�szTextIOWrapper.encodingcCs|jS)N)r)rGrBrBrCr6�szTextIOWrapper.errorscCs|jS)N)r)rGrBrBrCr?�szTextIOWrapper.line_bufferingcCs|jS)N)r�)rGrBrBrCrA�szTextIOWrapper.buffercCs|jrtd��|jS)NzI/O operation on closed file.)rhr r�)rGrBrBrCra�s	zTextIOWrapper.seekablecCs
|jj�S)N)rArd)rGrBrBrCrd�szTextIOWrapper.readablecCs
|jj�S)N)rArf)rGrBrBrCrf�szTextIOWrapper.writablecCs|jj�|j|_dS)N)rAr^r�r*)rGrBrBrCr^�s
zTextIOWrapper.flushc
Cs<|jdk	r8|jr8z|j�Wd|jj�XdS)N)rArhr^r2)rGrBrBrCr2�szTextIOWrapper.closecCs
|jjS)N)rArh)rGrBrBrCrh�szTextIOWrapper.closedcCs
|jjS)N)rArV)rGrBrBrCrV�szTextIOWrapper.namecCs
|jj�S)N)rAr))rGrBrBrCr)�szTextIOWrapper.filenocCs
|jj�S)N)rAr%)rGrBrBrCr%�szTextIOWrapper.isattycCs|jrtd��t|t�s:td|jj��t|�}|jsX|j	oad|k}|r�|jr�|j
dkr�|jd|j
�}|jp�|j
�}|j|�}|jj|�|j	r�|s�d|kr�|j�d|_|jr|jj�|S)Nzwrite to closed filezcan't write %s to text streamr�r�)rhr rrrrUrKrr"rr$rr%r-�encoderArr^r)r&r)rGr��lengthZhaslf�encoderrrBrBrCrs$	
		
zTextIOWrapper.writecCs+tj|j�}||j�|_|jS)N)r��getincrementalencoderrrr%)rGZmake_encoderrBrBrCr-szTextIOWrapper._get_encodercCsItj|j�}||j�}|jr<t||j�}||_|S)N)r��getincrementaldecoderrrrr�r r&)rGZmake_decoderr�rBrBrC�_get_decoders		zTextIOWrapper._get_decodercCs||_d|_dS)Nr)r'r()rG�charsrBrBrC�_set_decoded_chars's	z TextIOWrapper._set_decoded_charscCs[|j}|dkr+|j|d�}n|j|||�}|jt|�7_|S)N)r(r'r)rGrn�offsetr6rBrBrC�_get_decoded_chars,s	z TextIOWrapper._get_decoded_charscCs.|j|krtd��|j|8_dS)Nz"rewind decoded_chars out of bounds)r(�AssertionError)rGrnrBrBrC�_rewind_decoded_chars6sz#TextIOWrapper._rewind_decoded_charscCs�|jdkrtd��|jr9|jj�\}}|jrZ|jj|j�}n|jj|j�}|}|jj	||�}|j
|�|r�t|�t|j�|_
n	d|_
|jr�|||f|_|S)Nz
no decoderg)r&r r*rr+rAr��_CHUNK_SIZErsr�r7rr'r,r))rG�
dec_buffer�	dec_flags�input_chunk�eofZ
decoded_charsrBrBrC�_read_chunk<s 		
		zTextIOWrapper._read_chunkrcCs*||d>B|d>B|d>Bt|�d>BS)N�@���)r)rGr/r>�
bytes_to_feed�need_eof�
chars_to_skiprBrBrC�_pack_cookiefszTextIOWrapper._pack_cookiecCsgt|d�\}}t|d�\}}t|d�\}}t|d�\}}|||||fS)Nr
rBllll)�divmod)rGZbigint�restr/r>rFrGrHrBrBrC�_unpack_cookieps
zTextIOWrapper._unpack_cookiecCs|jstd��|js*td��|j�|jj�}|j}|dksg|jdkr�|j	r|t
d��|S|j\}}|t|�8}|j}|dkr�|j
||�S|j�}zt|j|�}d}x�|dkr�|jd|f�t|j|d|���}	|	|kr{|j�\}
}|
sb|}||	8}P|t|
�8}d}q�||8}|d}q�Wd}|jd|f�||}|}
|dkr�|j
||
�Sd}d}d}x�t|t|��D]�}|d7}|t|j|||d���7}|j�\}}|r�||kr�||7}||8}|dd}
}}||krPqW|t|jddd	��7}d}||kr�td
��|j
||
|||�SWd|j|�XdS)Nz!underlying stream is not seekablez(telling position disabled by next() callzpending decoded textrr
r�rr�Tz'can't reconstruct logical file position)r�rSr*r+r^rAr[r&r)r'r:rr(rIrrr,r	r��range)rGr/r�r>Z
next_inputrH�saved_stateZ
skip_bytesZ	skip_backrnr�d�	start_posZstart_flagsZ	bytes_fedrGZ
chars_decoded�ir=rBrBrCr[wsv		
			
	


'

zTextIOWrapper.tellcCs2|j�|dkr"|j�}|jj|�S)N)r^r[rAr\)rGrYrBrBrCr\�s
zTextIOWrapper.truncatecCs;|jdkrtd��|j�|j}d|_|S)Nzbuffer is already detached)rAr r^r�)rGrArBrBrCr��s
		zTextIOWrapper.detachcsm�fdd�}�jr'td���js<td��|dkrr|dkr`td��d}�j�}|dkr�|dkr�td	���j��jjdd�}�jd
�d�_	�j
r��j
j�||�|S|dkrtd|f��|dkr-td|f���j��j|�\}}}}}	�jj|��jd
�d�_	|dkr��j
r��j
j�nR�j
s�|s�|	r��j
p��j
��_
�j
jd
|f�|d
f�_	|	r_�jj|�}
�j�j
j|
|��||
f�_	t�j�|	krVtd��|	�_||�|S)NcsXy�jp�j�}Wntk
r-Yn'X|dkrJ|jd�n
|j�dS)Nr)r%r-rr	r)r/r2)rGrBrC�_reset_encoder�s
z*TextIOWrapper.seek.<locals>._reset_encoderztell on closed filez!underlying stream is not seekabler
rz#can't do nonzero cur-relative seeksrz#can't do nonzero end-relative seeksrzunsupported whence (%r)znegative seek position %rr�z#can't restore logical file position)rhr r�rSr[r^rArXr7r)r&rrLr5r	rsr�rr'r+r()rGZcookierZrRr/rPr>rFrGrHr?rB)rGrCrX�s\
		

		



		
zTextIOWrapper.seekcCs(|j�|dkrd}|jp.|j�}y|jWn4tk
rr}ztd�|�WYdd}~XnX|dkr�|j�|j|jj	�dd�}|j
d�d|_|Sd}|j|�}xGt|�|kr|r|j
�}||j|t|��7}q�W|SdS)	Nr
zan integer is requiredrr�TrFr)rer&r5r�r,rr9r�rArsr7r)rrA)rGror�r�r>r@rBrBrCrs3	s(
"	
	
!zTextIOWrapper.readcCs:d|_|j�}|s6d|_|j|_t�|S)NF)r*rvr)r�rx)rGryrBrBrCrzL	s		zTextIOWrapper.__next__cCsn|jrtd��|dkr*d	}nt|t�sEtd��|j�}d}|jsj|j�d}}x�|jr�|j	d|�}|dkr�|d}Pq�t
|�}n�|jr}|j	d|�}|j	d|�}|d
kr|dkrt
|�}qz|d}Pq�|dkr7|d}Pq�||krQ|d}Pq�||dkro|d}Pq�|d}Pn2|j	|j�}|dkr�|t
|j�}P|dkr�t
|�|kr�|}Px|j
�r�|jr�Pq�W|jr
||j�7}qw|jd�d|_|SqwW|dkrI||krI|}|jt
|�|�|d|�S)
Nzread from closed filer
zsize must be an integerrr�r�rrrrrr)rhr rrrr9r&r5r rlrrr!rAr'r7r)r;)rGrory�startrY�endposZnlposZcrposrBrBrCrvU	sp			

	
	




		
	zTextIOWrapper.readlinecCs|jr|jjSdS)N)r&r�)rGrBrBrCr��	szTextIOWrapper.newlines)%rKrLrMr<r�r�r�r5r6r?rArardrfr^r2rhrVr)r%rr-r5r7r9r;rArIrLr[r\r�rXrsrzrvr�rBrBrBrCr0YsF	E
*	cK	Xr0cspeZdZdd�fdd�Zdd�Zdd�Zed	d
��Zedd��Zd
d�Z	�S)�StringIOrr�cs�tt|�jt�ddddd|�|dkr@d|_|dk	r�t|t�sytdjt	|�j
���|j|�|jd�dS)	Nr5zutf-8r6�
surrogatepassr7Fz*initial_value must be str or None, not {0}r)
r�rUr�r�r"rrrr�rrKrrX)rGZ
initial_valuer7)rUrBrCr��	s		
zStringIO.__init__cCsj|j�|jp|j�}|j�}|j�z |j|jj�dd�SWd|j|�XdS)Nr�T)	r^r&r5rrr�rAr�r	)rGr�Z	old_staterBrBrCr��	s

 zStringIO.getvaluecCs
tj|�S)N)�objectr�)rGrBrBrCr��	szStringIO.__repr__cCsdS)NrB)rGrBrBrCr6�	szStringIO.errorscCsdS)NrB)rGrBrBrCr5�	szStringIO.encodingcCs|jd�dS)Nr�)rW)rGrBrBrCr��	szStringIO.detach)
rKrLrMr�r�r�r�r6r5r�rBrB)rUrCrU�	s
rU)5r'�abcr�r��arrayr��sys�_threadrr�r�
_dummy_thread�platform�msvcrtrr��iorrrr	r�rq�addr�	SEEK_DATAr&r�rDrErNrSr,r+r �ABCMetarT�registerr��_ior$r�r�r�r/r.r�r-r�r�r�r0rUrBrBrBrC�<module>sj
"

�	

�
=
gi�ZIJ�TAU��[

Hacked By AnonymousFox1.0, Coded By AnonymousFox