Hacked By AnonymousFox

Current Path : /opt/alt/python36/lib64/python3.6/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/__pycache__/_pyio.cpython-36.opt-2.pyc

3

��2a!X�@s^ddlZddlZddlZddlZddlZddlZyddlmZWn e	k
r`ddl
mZYnXejd4krzddlm
ZndZddlZddlmZmZmZmZdddhZeed	�r�ejej�ejej�d5ZeZd7dd�ZGdd�d�ZGdd�d�Zy
ejZWn(ek
�r*Gdd�de e!�ZYnXGdd�dej"d�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#�Z/ej/j$e/�Gd.d/�d/ej0�Z1Gd0d1�d1e/�Z2Gd2d3�d3e2�Z3dS)8�N)�
allocate_lock�win32�cygwin)�setmode)�__all__�SEEK_SET�SEEK_CUR�SEEK_END���	SEEK_HOLE�i�rTcCs~t|t�stj|�}t|tttf�s0td|��t|t�sFtd|��t|t�s\td|��|dk	r|t|t�r|td|��|dk	r�t|t�r�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�rH|	�s&|�s&|�s&|
�r.t	d��ddl
}|jdtd�d}
|�r\|�r\t	d��|	|
||dk�rzt	d��|	�p�|
�p�|�p�|�s�t	d��|�r�|dk	�r�t	d��|�r�|dk	�r�t	d��|�r�|dk	�r�t	d��t
||	�r�d�p�d|
�rd�pd|�rd	�pd|�r d
�p"d|
�r0d�p2d||d�}|}�yd}|dk�sh|dk�rp|j��rpd!}d}|dk�r�t}ytj|j��j}Wnttfk
�r�YnX|dk�r�|}|dk�r�t	d��|dk�r�|�r�|St	d��|
�r�t||�}n<|	�s|�s|�rt||�}n|
�r,t||�}nt	d |��|}|�rF|St|||||�}|}||_|S|j��YnXdS)"Nzinvalid file: %rzinvalid mode: %rzinvalid buffering: %rzinvalid encoding: %rzinvalid 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 argument�)�openerFzinvalid buffering sizezcan't have unbuffered text I/Ozunknown mode: %r���)�
isinstance�int�os�fspath�str�bytes�	TypeError�set�len�
ValueError�warnings�warn�DeprecationWarning�FileIO�isatty�DEFAULT_BUFFER_SIZE�fstat�fileno�
st_blksize�OSError�AttributeError�BufferedRandom�BufferedWriter�BufferedReader�
TextIOWrapper�mode�close)�filer2�	buffering�encoding�errors�newline�closefdrZmodesZcreatingZreadingZwritingZ	appendingZupdating�textZbinaryr#�raw�result�line_buffering�bs�buffer�r@�*/opt/alt/python36/lib64/python3.6/_pyio.py�open(s�{




>




rBc@seZdZdd�ZdS)�
DocDescriptorcCs
dtjS)Nz\open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True)

)rB�__doc__)�self�obj�typr@r@rA�__get__�szDocDescriptor.__get__N)�__name__�
__module__�__qualname__rHr@r@r@rArC�srCc@seZdZe�Zdd�ZdS)�OpenWrappercOs
t||�S)N)rB)�cls�args�kwargsr@r@rA�__new__szOpenWrapper.__new__N)rIrJrKrCrDrPr@r@r@rArLsrLc@seZdZdS)�UnsupportedOperationN)rIrJrKr@r@r@rArQsrQc@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)rQ�	__class__rI)rE�namer@r@rA�_unsupported@szIOBase._unsupportedrcCs|jd�dS)N�seek)rU)rE�pos�whencer@r@rArVGszIOBase.seekcCs|jdd�S)Nrr
)rV)rEr@r@rA�tellWszIOBase.tellNcCs|jd�dS)N�truncate)rU)rErWr@r@rArZ[szIOBase.truncatecCs|j�dS)N)�_checkClosed)rEr@r@rA�flusheszIOBase.flushFcCs |jsz|j�Wdd|_XdS)NT)�_IOBase__closedr\)rEr@r@rAr3oszIOBase.closec	Csy|j�WnYnXdS)N)r3)rEr@r@rA�__del__zszIOBase.__del__cCsdS)NFr@)rEr@r@rA�seekable�szIOBase.seekablecCs |j�st|dkrdn|��dS)NzFile or stream is not seekable.)r_rQ)rE�msgr@r@rA�_checkSeekable�szIOBase._checkSeekablecCsdS)NFr@)rEr@r@rA�readable�szIOBase.readablecCs |j�st|dkrdn|��dS)NzFile or stream is not readable.)rbrQ)rEr`r@r@rA�_checkReadable�szIOBase._checkReadablecCsdS)NFr@)rEr@r@rA�writable�szIOBase.writablecCs |j�st|dkrdn|��dS)NzFile or stream is not writable.)rdrQ)rEr`r@r@rA�_checkWritable�szIOBase._checkWritablecCs|jS)N)r])rEr@r@rA�closed�sz
IOBase.closedcCs|jrt|dkrdn|��dS)NzI/O operation on closed file.)rfr")rEr`r@r@rAr[�szIOBase._checkClosedcCs|j�|S)N)r[)rEr@r@rA�	__enter__�szIOBase.__enter__cGs|j�dS)N)r3)rErNr@r@rA�__exit__�szIOBase.__exit__cCs|jd�dS)Nr*)rU)rEr@r@rAr*�sz
IOBase.filenocCs|j�dS)NF)r[)rEr@r@rAr'�sz
IOBase.isattyr
cs�t�d�r��fdd�}ndd�}�dkr0d	�nt�t�sBtd��t�}x>�dks^t|��kr��j|��}|spP||7}|jd�rJPqJWt|�S)
N�peekcs>�jd�}|sdS|jd�dp&t|�}�dkr:t|��}|S)Nr
�
r)ri�findr!�min)Z	readahead�n)rE�sizer@rA�
nreadahead�s

z#IOBase.readline.<locals>.nreadaheadcSsdS)Nr
r@r@r@r@rAro�sr
zsize must be an integerrrjr)	�hasattrrrr�	bytearrayr!�read�endswithr)rErnro�resrr@)rErnrA�readline�s 
	

zIOBase.readlinecCs|j�|S)N)r[)rEr@r@rA�__iter__szIOBase.__iter__cCs|j�}|st�|S)N)ru�
StopIteration)rE�liner@r@rA�__next__szIOBase.__next__cCsR|dks|dkrt|�Sd}g}x,|D]$}|j|�|t|�7}||kr&Pq&W|S)Nr)�list�appendr!)rEZhintrm�linesrxr@r@rA�	readliness

zIOBase.readlinescCs$|j�x|D]}|j|�qWdS)N)r[�write)rEr|rxr@r@rA�
writelines#s
zIOBase.writelines)r)N)N)N)N)Nr)r)N)rIrJrKrUrVrYrZr\r]r3r^r_rarbrcrdre�propertyrfr[rgrhr*r'rurvryr}rr@r@r@rArRs2$






	

%
rR)�	metaclassc@s.eZdZddd�Zdd�Zdd�Zdd	�Zd
S)
�	RawIOBaser
cCsP|dkrd}|dkr|j�St|j��}|j|�}|dkr>dS||d�=t|�S)Nr
rr)�readallrq�	__index__�readintor)rErnrrmr@r@rArr9s

zRawIOBase.readcCs8t�}x|jt�}|sP||7}qW|r0t|�S|SdS)N)rqrrr(r)rErt�datar@r@rAr�Js
zRawIOBase.readallcCs|jd�dS)Nr�)rU)rErr@r@rAr�XszRawIOBase.readintocCs|jd�dS)Nr~)rU)rErr@r@rAr~`szRawIOBase.writeNr)r)rIrJrKrrr�r�r~r@r@r@rAr�+s
r�)r&c@sHeZdZddd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�BufferedIOBaseNcCs|jd�dS)Nrr)rU)rErnr@r@rArr~szBufferedIOBase.readcCs|jd�dS)N�read1)rU)rErnr@r@rAr��szBufferedIOBase.read1cCs|j|dd�S)NF)r�)�	_readinto)rErr@r@rAr��szBufferedIOBase.readintocCs|j|dd�S)NT)r�)r�)rErr@r@rA�	readinto1�s	zBufferedIOBase.readinto1cCsVt|t�st|�}|jd�}|r0|jt|��}n|jt|��}t|�}||d|�<|S)N�B)r�
memoryview�castr�r!rr)rErr�r�rmr@r@rAr��s

zBufferedIOBase._readintocCs|jd�dS)Nr~)rU)rErr@r@rAr~�s	zBufferedIOBase.writecCs|jd�dS)N�detach)rU)rEr@r@rAr��szBufferedIOBase.detach)N)N)
rIrJrKrrr�r�r�r�r~r�r@r@r@rAr�ms

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
||_dS)N)�_raw)rEr;r@r@rA�__init__�sz_BufferedIOMixin.__init__rcCs"|jj||�}|dkrtd��|S)Nrz#seek() returned an invalid position)r;rVr,)rErWrXZnew_positionr@r@rArV�sz_BufferedIOMixin.seekcCs|jj�}|dkrtd��|S)Nrz#tell() returned an invalid position)r;rYr,)rErWr@r@rArY�s
z_BufferedIOMixin.tellNcCs$|j�|dkr|j�}|jj|�S)N)r\rYr;rZ)rErWr@r@rArZ�sz_BufferedIOMixin.truncatecCs|jrtd��|jj�dS)Nzflush of closed file)rfr"r;r\)rEr@r@rAr\�sz_BufferedIOMixin.flushc
Cs0|jdk	r,|jr,z|j�Wd|jj�XdS)N)r;rfr\r3)rEr@r@rAr3sz_BufferedIOMixin.closecCs*|jdkrtd��|j�|j}d|_|S)Nzraw stream already detached)r;r"r\r�)rEr;r@r@rAr�s
z_BufferedIOMixin.detachcCs
|jj�S)N)r;r_)rEr@r@rAr_sz_BufferedIOMixin.seekablecCs|jS)N)r�)rEr@r@rAr;sz_BufferedIOMixin.rawcCs|jjS)N)r;rf)rEr@r@rArfsz_BufferedIOMixin.closedcCs|jjS)N)r;rT)rEr@r@rArT!sz_BufferedIOMixin.namecCs|jjS)N)r;r2)rEr@r@rAr2%sz_BufferedIOMixin.modecCstdj|jj���dS)Nz can not serialize a '{0}' object)r�formatrSrI)rEr@r@rA�__getstate__)sz_BufferedIOMixin.__getstate__cCsJ|jj}|jj}y
|j}Wntk
r6dj||�SXdj|||�SdS)Nz<{}.{}>z<{}.{} name={!r}>)rSrJrKrT�	Exceptionr�)rE�modnameZclsnamerTr@r@rA�__repr__-s
z_BufferedIOMixin.__repr__cCs
|jj�S)N)r;r*)rEr@r@rAr*9sz_BufferedIOMixin.filenocCs
|jj�S)N)r;r')rEr@r@rAr'<sz_BufferedIOMixin.isatty)r)N)rIrJrKr�rVrYrZr\r3r�r_r�r;rfrTr2r�r�r*r'r@r@r@rAr��s 	


r�cs�eZdZddd�Zdd�Zdd�Zdd	�Z�fd
d�Zd dd
�Zdd�Z	dd�Z
d!dd�Zdd�Zd"dd�Z
dd�Zdd�Zdd�Z�ZS)#�BytesIONcCs&t�}|dk	r||7}||_d|_dS)Nr)rq�_buffer�_pos)rEZ
initial_bytes�bufr@r@rAr�Ds
zBytesIO.__init__cCs|jrtd��|jj�S)Nz__getstate__ on closed file)rfr"�__dict__�copy)rEr@r@rAr�KszBytesIO.__getstate__cCs|jrtd��t|j�S)Nzgetvalue on closed file)rfr"rr�)rEr@r@rA�getvaluePszBytesIO.getvaluecCs|jrtd��t|j�S)Nzgetbuffer on closed file)rfr"r�r�)rEr@r@rA�	getbufferWszBytesIO.getbuffercs|jj�t�j�dS)N)r��clear�superr3)rE)rSr@rAr3^s
z
BytesIO.closecCst|jrtd��|dkrd}|dkr,t|j�}t|j�|jkr@dStt|j�|j|�}|j|j|�}||_t|�S)Nzread from closed filer
r�r)rfr"r!r�r�rlr)rErnZnewposrr@r@rArrbs
zBytesIO.readcCs
|j|�S)N)rr)rErnr@r@rAr�psz
BytesIO.read1cCs�|jrtd��t|t�r td��t|��}|j}WdQRX|dkrFdS|j}|t|j	�krzd|t|j	�}|j	|7_	||j	|||�<|j|7_|S)Nzwrite to closed filez can't write str to binary streamr�)
rfr"rrrr��nbytesr�r!r�)rErZviewrmrWZpaddingr@r@rAr~us

z
BytesIO.writercCs�|jrtd��y
|jWn,tk
rD}ztd�|�WYdd}~XnX|dkrl|dkrdtd|f��||_nD|dkr�td|j|�|_n(|dkr�tdt|j�|�|_ntd��|jS)Nzseek on closed filezan integer is requiredrznegative seek position %rr
rzunsupported whence value)	rfr"r�r-rr��maxr!r�)rErWrX�errr@r@rArV�s 
zBytesIO.seekcCs|jrtd��|jS)Nztell on closed file)rfr"r�)rEr@r@rArY�szBytesIO.tellcCs||jrtd��|dkr|j}nNy
|jWn,tk
rT}ztd�|�WYdd}~XnX|dkrltd|f��|j|d�=|S)Nztruncate on closed filezan integer is requiredrznegative truncate position %r)rfr"r�r�r-rr�)rErWr�r@r@rArZ�s
zBytesIO.truncatecCs|jrtd��dS)NzI/O operation on closed file.T)rfr")rEr@r@rArb�szBytesIO.readablecCs|jrtd��dS)NzI/O operation on closed file.T)rfr")rEr@r@rArd�szBytesIO.writablecCs|jrtd��dS)NzI/O operation on closed file.T)rfr")rEr@r@rAr_�szBytesIO.seekable)N)N)r)N)rIrJrKr�r�r�r�r3rrr�r~rVrYrZrbrdr_�
__classcell__r@r@)rSrAr�@s



r�c@sreZdZefdd�Zdd�Zdd�Zddd	�Zdd
d�Zdd
d�Z	ddd�Z
dd�Zdd�Zdd�Z
ddd�ZdS)r0cCsF|j�std��tj||�|dkr,td��||_|j�t�|_dS)Nz "raw" argument must be readable.rzinvalid buffer size)	rbr,r�r�r"�buffer_size�_reset_read_buf�Lock�
_read_lock)rEr;r�r@r@rAr��szBufferedReader.__init__cCs
|jj�S)N)r;rb)rEr@r@rArb�szBufferedReader.readablecCsd|_d|_dS)Nr�r)�	_read_buf�	_read_pos)rEr@r@rAr��szBufferedReader._reset_read_bufNc	Cs4|dk	r|dkrtd��|j�|j|�SQRXdS)Nr
zinvalid number of bytes to readr)r"r��_read_unlocked)rErnr@r@rArr�szBufferedReader.readcCs�d}d}|j}|j}|dks$|dkr�|j�t|jd�rj|jj�}|dkrZ||d�pXdS||d�|S||d�g}d}x2|jj�}||kr�|}P|t|�7}|j|�q~Wdj	|�p�|St|�|}	||	kr�|j|7_||||�S||d�g}t
|j|�}
xB|	|k�rL|jj|
�}||k�r2|}P|	t|�7}	|j|��qWt||	�}dj	|�}||d�|_d|_|�r�|d|�S|S)Nr�r
r�r)r�Nr)
r�r�r�rpr;r�rrr!r{�joinr�r�rl)rErmZ
nodata_valZempty_valuesr�rW�chunk�chunksZcurrent_size�availZwanted�outr@r@rAr��sN




zBufferedReader._read_unlockedrc	Cs|j�|j|�SQRXdS)N)r��_peek_unlocked)rErnr@r@rAriszBufferedReader.peekcCsrt||j�}t|j�|j}||ks,|dkrb|j|}|jj|�}|rb|j|jd�||_d|_|j|jd�S)Nr)rlr�r!r�r�r;rr)rErmZwantZhaveZto_readZcurrentr@r@rAr�)s
zBufferedReader._peek_unlockedcCsT|dkrtd��|dkrdS|j�(|jd�|jt|t|j�|j��SQRXdS)Nrz(number of bytes to read must be positiver�r
)r"r�r�r�rlr!r�r�)rErnr@r@rAr�4s
zBufferedReader.read1cCst|t�st|�}|jdkr dS|jd�}d}|j��x�|t|�k�rtt|j�|jt|��}|r�|j|j|j|�||||�<|j|7_||7}|t|�kr�Pt|�||j	kr�|j
j||d��}|s�P||7}n|o�|s�|jd�s�P|r8|r8Pq8WWdQRX|S)Nrr�r
)
rr�r�r�r�r!rlr�r�r�r;r�r�)rEr�r��writtenr�rmr@r@rAr�Fs4


"

zBufferedReader._readintocCstj|�t|j�|jS)N)r�rYr!r�r�)rEr@r@rArYtszBufferedReader.tellcCsX|tkrtd��|j�8|dkr4|t|j�|j8}tj|||�}|j�|SQRXdS)Nzinvalid whence valuer
)	�valid_seek_flagsr"r�r!r�r�r�rVr�)rErWrXr@r@rArVwszBufferedReader.seek)N)N)r)r)r)rIrJrKr(r�rbr�rrr�rir�r�r�rYrVr@r@r@rAr0�s


4


.r0c@sTeZdZefdd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�Z	dd�Z
ddd�ZdS)r/cCsF|j�std��tj||�|dkr,td��||_t�|_t�|_	dS)Nz "raw" argument must be writable.rzinvalid buffer size)
rdr,r�r�r"r�rq�
_write_bufr��_write_lock)rEr;r�r@r@rAr��szBufferedWriter.__init__cCs
|jj�S)N)r;rd)rEr@r@rArd�szBufferedWriter.writablecCs�|jrtd��t|t�r td��|j��t|j�|jkr@|j	�t|j�}|jj
|�t|j�|}t|j�|jkr�y|j	�Wnltk
r�}zPt|j�|jkr�t|j�|j}||8}|jd|j�|_t|j|j
|��WYdd}~XnX|SQRXdS)Nzwrite to closed filez can't write str to binary stream)rfr"rrrr�r!r�r��_flush_unlocked�extend�BlockingIOError�errno�strerror)rErZbeforer��eZoverager@r@rAr~�s(

"zBufferedWriter.writeNc	Cs8|j�(|j�|dkr"|jj�}|jj|�SQRXdS)N)r�r�r;rYrZ)rErWr@r@rArZ�s

zBufferedWriter.truncatec	Cs|j�|j�WdQRXdS)N)r�r�)rEr@r@rAr\�szBufferedWriter.flushcCs�|jrtd��xz|jr�y|jj|j�}Wntk
rDtd��YnX|dkr\ttjdd��|t	|j�ksr|dkrzt
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)rfr"r�r;r~r��RuntimeErrorr�ZEAGAINr!r,)rErmr@r@rAr��szBufferedWriter._flush_unlockedcCstj|�t|j�S)N)r�rYr!r�)rEr@r@rArY�szBufferedWriter.tellrcCs8|tkrtd��|j�|j�tj|||�SQRXdS)Nzinvalid whence value)r�r"r�r�r�rV)rErWrXr@r@rArV�s
zBufferedWriter.seek)N)r)rIrJrKr(r�rdr~rZr\r�rYrVr@r@r@rAr/�s	
r/c@s�eZdZefdd�Zddd�Zdd�Zdd	�Zddd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zedd��ZdS)�BufferedRWPaircCs<|j�std��|j�s td��t||�|_t||�|_dS)Nz#"reader" argument must be readable.z#"writer" argument must be writable.)rbr,rdr0�readerr/�writer)rEr�r�r�r@r@rAr��szBufferedRWPair.__init__NcCs|dkrd}|jj|�S)Nr
r)r�rr)rErnr@r@rArr�szBufferedRWPair.readcCs|jj|�S)N)r�r�)rErr@r@rAr��szBufferedRWPair.readintocCs|jj|�S)N)r�r~)rErr@r@rAr~szBufferedRWPair.writercCs|jj|�S)N)r�ri)rErnr@r@rAriszBufferedRWPair.peekcCs|jj|�S)N)r�r�)rErnr@r@rAr�szBufferedRWPair.read1cCs|jj|�S)N)r�r�)rErr@r@rAr�
szBufferedRWPair.readinto1cCs
|jj�S)N)r�rb)rEr@r@rArb
szBufferedRWPair.readablecCs
|jj�S)N)r�rd)rEr@r@rArdszBufferedRWPair.writablecCs
|jj�S)N)r�r\)rEr@r@rAr\szBufferedRWPair.flushc
Cs z|jj�Wd|jj�XdS)N)r�r3r�)rEr@r@rAr3szBufferedRWPair.closecCs|jj�p|jj�S)N)r�r'r�)rEr@r@rAr'szBufferedRWPair.isattycCs|jjS)N)r�rf)rEr@r@rArfszBufferedRWPair.closed)N)r)rIrJrKr(r�rrr�r~rir�r�rbrdr\r3r'r�rfr@r@r@rAr��s

r�c@sheZdZefdd�Zddd�Zdd�Zdd	d
�Zddd�Zd
d�Z	ddd�Z
dd�Zdd�Zdd�Z
dS)r.cCs(|j�tj|||�tj|||�dS)N)rar0r�r/)rEr;r�r@r@rAr�-szBufferedRandom.__init__rcCs�|tkrtd��|j�|jrJ|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;rVr�r!r�r,)rErWrXr@r@rArV2s$zBufferedRandom.seekcCs|jrtj|�Stj|�SdS)N)r�r/rYr0)rEr@r@rArYCs
zBufferedRandom.tellNcCs|dkr|j�}tj||�S)N)rYr/rZ)rErWr@r@rArZIszBufferedRandom.truncatecCs |dkrd}|j�tj||�S)Nr
r)r\r0rr)rErnr@r@rArrOszBufferedRandom.readcCs|j�tj||�S)N)r\r0r�)rErr@r@rAr�UszBufferedRandom.readintocCs|j�tj||�S)N)r\r0ri)rErnr@r@rAriYszBufferedRandom.peekcCs|j�tj||�S)N)r\r0r�)rErnr@r@rAr�]szBufferedRandom.read1cCs|j�tj||�S)N)r\r0r�)rErr@r@rAr�aszBufferedRandom.readinto1cCsF|jr:|j�(|jj|jt|j�d�|j�WdQRXtj||�S)Nr
)	r�r�r;rVr�r!r�r/r~)rErr@r@rAr~es
zBufferedRandom.write)r)N)N)r)rIrJrKr(r�rVrYrZrrr�rir�r�r~r@r@r@rAr.$s	



r.cs�eZdZd0ZdZdZdZdZdZdZ	d1dd�Z
dd	�Zd
d�Zdd
�Z
dd�Zd2dd�Zd3dd�Zdd�Zdd�Zdd�Zefdd�Zdd�Zd4dd�Z�fd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zed,d-��Zed.d/��Z �Z!S)5r&r
FNTrc
Cs
|jdkr*z|jrtj|j�Wdd|_Xt|t�r<td��t|t�r\|}|dkr`td��nd}t|t	�sxtd|f��t
|�t
d�ks�td|f��tdd�|D��dks�|jd	�dkr�td
��d|kr�d|_
d|_tjtjB}nVd
|k�r�d|_d}n@d|k�rd|_tjtjB}n"d|k�r:d|_d|_tjtjB}d	|k�rPd|_d|_|j�rl|j�rl|tjO}n|j�r�|tjO}n
|tjO}|ttdd�O}ttdd��p�ttdd�}||O}d}�y|dk�r<|�s�td��|dk�r�tj||d�}n0|||�}t|t��std��|dk�r&td��|}|�s<tj|d�||_tj|�}	y(tj|	j��rrt t!j"tj#t!j"�|��Wnt$k
�r�YnXt|	dd�|_%|j%dk�r�t&|_%t'�r�t'|tj(�||_)|j�r�tj*|dt+�Wn"|dk	�r�tj|��YnX||_dS)Nrr
z$integer argument expected, got floatznegative file descriptorzinvalid mode: %szxrwab+css|]}|dkVqdS)ZrwaxNr@)�.0�cr@r@rA�	<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�_closefdrr3r�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�rT�lseekr	)
rEr4r2r9r�fd�flagsZnoinherit_flagZowned_fdZfdfstatr@r@rAr�ws�




$











zFileIO.__init__cCsD|jdkr@|jr@|jr@ddl}|jd|ftd|d�|j�dS)Nrzunclosed file %rr)�
stacklevel�source)r�r�rfr#r$�ResourceWarningr3)rEr#r@r@rAr^�s

zFileIO.__del__cCstd|jj��dS)Nzcannot serialize '%s' object)rrSrI)rEr@r@rAr��szFileIO.__getstate__c
Csld|jj|jjf}|jr"d|Sy
|j}Wn&tk
rRd||j|j|jfSXd|||j|jfSdS)Nz%s.%sz
<%s [closed]>z<%s fd=%d mode=%r closefd=%r>z<%s name=%r mode=%r closefd=%r>)	rSrJrKrfrTr-r�r2r�)rE�
class_namerTr@r@rAr��s
zFileIO.__repr__cCs|jstd��dS)NzFile not open for reading)r�rQ)rEr@r@rArcszFileIO._checkReadablecCs|jstd��dS)NzFile not open for writing)r�rQ)rEr`r@r@rAreszFileIO._checkWritablecCsP|j�|j�|dks |dkr(|j�Sytj|j|�Stk
rJdSXdS)Nr)r[rcr�rrrr�r�)rErnr@r@rArrszFileIO.readcCs�|j�|j�t}y6tj|jdt�}tj|j�j}||krH||d}Wnt	k
r^YnXt
�}xnt|�|kr�t|�}|t|t�7}|t|�}ytj
|j|�}Wntk
r�|r�PdSX|s�P||7}qhWt|�S)Nrr
)r[rcr(rr�r�rr)�st_sizer,rqr!r�rrr�r)rE�bufsizerW�endr<rmr�r@r@rAr�s4zFileIO.readallcCs4t|�jd�}|jt|��}t|�}||d|�<|S)Nr�)r�r�rrr!)rEr�mr�rmr@r@rAr�?s
zFileIO.readintocCs8|j�|j�ytj|j|�Stk
r2dSXdS)N)r[rerr~r�r�)rErr@r@rAr~GszFileIO.writecCs*t|t�rtd��|j�tj|j||�S)Nzan integer is required)rr�rr[rr�r�)rErWrXr@r@rArVUs
zFileIO.seekcCs|j�tj|jdt�S)Nr)r[rr�r�r)rEr@r@rArYeszFileIO.tellcCs2|j�|j�|dkr |j�}tj|j|�|S)N)r[rerYr�	ftruncater�)rErnr@r@rArZlszFileIO.truncatec
s.|js*z|jrtj|j�Wdt�j�XdS)N)rfr�rr3r�r�)rE)rSr@rAr3ys
zFileIO.closecCsF|j�|jdkr@y|j�Wntk
r8d|_YnXd|_|jS)NFT)r[�	_seekablerYr,)rEr@r@rAr_�s
zFileIO.seekablecCs|j�|jS)N)r[r�)rEr@r@rArb�szFileIO.readablecCs|j�|jS)N)r[r�)rEr@r@rArd�szFileIO.writablecCs|j�|jS)N)r[r�)rEr@r@rAr*�sz
FileIO.filenocCs|j�tj|j�S)N)r[rr'r�)rEr@r@rAr'�sz
FileIO.isattycCs|jS)N)r�)rEr@r@rAr9�szFileIO.closefdcCsJ|jr|jrdSdSn0|jr,|jr&dSdSn|jrB|jr<dSdSndSdS)Nzxb+Zxbzab+Zabzrb+�rb�wb)r�r�r�r�)rEr@r@rAr2�szFileIO.moder)rTN)N)N)N)"rIrJrKr�r�r�r�r�r�r�r�r^r�r�rcrerrr�r�r~rrVrYrZr3r_rbrdr*r'r�r9r2r�r@r@)rSrAr&ns8
u

#


r&c@s\eZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zed
d��Z	edd��Z
edd��ZdS)�
TextIOBaser
cCs|jd�dS)Nrr)rU)rErnr@r@rArr�szTextIOBase.readcCs|jd�dS)Nr~)rU)rE�sr@r@rAr~�szTextIOBase.writeNcCs|jd�dS)NrZ)rU)rErWr@r@rArZ�szTextIOBase.truncatecCs|jd�dS)Nru)rU)rEr@r@rAru�szTextIOBase.readlinecCs|jd�dS)Nr�)rU)rEr@r@rAr��szTextIOBase.detachcCsdS)Nr@)rEr@r@rAr6�szTextIOBase.encodingcCsdS)Nr@)rEr@r@rA�newlines�szTextIOBase.newlinescCsdS)Nr@)rEr@r@rAr7�szTextIOBase.errorsr)r)N)rIrJrKrrr~rZrur�r�r6r�r7r@r@r@rAr��s	


	
r�c@sPeZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
ZdZ	dZ
edd��ZdS)�IncrementalNewlineDecoder�strictcCs,tjj||d�||_||_d|_d|_dS)N)r7rF)�codecs�IncrementalDecoderr��	translate�decoder�seennl�	pendingcr)rEr�r�r7r@r@rAr�s
z"IncrementalNewlineDecoder.__init__FcCs�|jdkr|}n|jj||d�}|jr<|s.|r<d|}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�rsr�r��_LF�_CR�_CRLFr��replace)rE�inputr��outputZcrlfZcrZlfr@r@rAr�s(

"z IncrementalNewlineDecoder.decodecCs@|jdkrd}d}n|jj�\}}|dK}|jr8|dO}||fS)Nr�rr
)r��getstater�)rEr��flagr@r@rAr2s
z"IncrementalNewlineDecoder.getstatecCs8|\}}t|d@�|_|jdk	r4|jj||d?f�dS)Nr
)�boolr�r��setstate)rE�stater�rr@r@rAr=s
z"IncrementalNewlineDecoder.setstatecCs$d|_d|_|jdk	r |jj�dS)NrF)r�r�r��reset)rEr@r@rArCs
zIncrementalNewlineDecoder.resetr
r�c
Cs
d|jS)	Nr�r��
�r�r��r�r
�r�r
�r�r�r
)Nr�r�rr
rr
r)r�)rEr@r@rAr�Msz"IncrementalNewlineDecoder.newlinesN)r�)F)
rIrJrKr�r�rrrr�r�r�r�r�r@r@r@rAr�s

r�c@s:eZdZdZdEdd�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)�ZdFd*d+�Zd,d-�Zd.d/�ZdGd1d2�Zd3d4�Zd5d6�ZdHd7d8�Zd9d:�ZdId;d<�Z dJd=d>�Z!d?d@�Z"dKdAdB�Z#edCdD��Z$dS)Lr1iNFc
Cs�|dk	r&t|t�r&tdt|�f��|dkr<td|f��|dkr�ytj|j��}Wntt	fk
rnYnX|dkr�yddl
}Wntk
r�d}YnX|jd	�}t|t�s�td
|��t
j|�js�d}t||��|dkr�d}nt|t��std
|��||_||_||_||_||_|dk|_||_|dk|_|�pDtj|_d|_d|_d|_d|_d|_|j j!�|_"|_#t$|j d�|_%d|_&|j"�r�|j'��r�|j j(�}	|	dk�r�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-rQ�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�	_snapshotr?r_r��_tellingrp�
_has_read1�	_b2cratiordrY�_get_encoderr)
rEr?r6r7r8r=�
write_throughrr`�positionr@r@rAr�ws`






zTextIOWrapper.__init__cCs�dj|jj|jj�}y
|j}Wntk
r2YnX|dj|�7}y
|j}Wntk
r`YnX|dj|�7}|dj|j�S)Nz<{}.{}z name={0!r}z mode={0!r}z encoding={0!r}>)r�rSrJrKrTr�r2r6)rEr<rTr2r@r@rAr��s



zTextIOWrapper.__repr__cCs|jS)N)r)rEr@r@rAr6�szTextIOWrapper.encodingcCs|jS)N)r)rEr@r@rAr7�szTextIOWrapper.errorscCs|jS)N)r)rEr@r@rAr=�szTextIOWrapper.line_bufferingcCs|jS)N)r�)rEr@r@rAr?�szTextIOWrapper.buffercCs|jrtd��|jS)NzI/O operation on closed file.)rfr"r�)rEr@r@rAr_�szTextIOWrapper.seekablecCs
|jj�S)N)r?rb)rEr@r@rArb�szTextIOWrapper.readablecCs
|jj�S)N)r?rd)rEr@r@rArd�szTextIOWrapper.writablecCs|jj�|j|_dS)N)r?r\r�r')rEr@r@rAr\�s
zTextIOWrapper.flushc
Cs0|jdk	r,|jr,z|j�Wd|jj�XdS)N)r?rfr\r3)rEr@r@rAr3�szTextIOWrapper.closecCs|jjS)N)r?rf)rEr@r@rArf�szTextIOWrapper.closedcCs|jjS)N)r?rT)rEr@r@rArT�szTextIOWrapper.namecCs
|jj�S)N)r?r*)rEr@r@rAr*�szTextIOWrapper.filenocCs
|jj�S)N)r?r')rEr@r@rAr'�szTextIOWrapper.isattycCs�|jrtd��t|t�s(td|jj��t|�}|js<|j	oBd|k}|rf|jrf|j
dkrf|jd|j
�}|jpr|j
�}|j|�}|jj|�|j	r�|s�d|kr�|j�|jd�d|_|jr�|jj�|S)Nzwrite to closed filezcan't write %s to text streamr�r�r)rfr"rrrrSrIr!rrr!rr"r*�encoder?r~r\�_set_decoded_charsr&r#r)rEr�ZlengthZhaslf�encoderrr@r@rAr~s&



zTextIOWrapper.writecCstj|j�}||j�|_|jS)N)r��getincrementalencoderrrr")rEZmake_encoderr@r@rAr*szTextIOWrapper._get_encodercCs2tj|j�}||j�}|jr(t||j�}||_|S)N)r��getincrementaldecoderrrrr�rr#)rEZmake_decoderr�r@r@rA�_get_decoders
zTextIOWrapper._get_decodercCs||_d|_dS)Nr)r$r%)rE�charsr@r@rAr.)sz TextIOWrapper._set_decoded_charscCsF|j}|dkr|j|d�}n|j|||�}|jt|�7_|S)N)r%r$r!)rErm�offsetr3r@r@rA�_get_decoded_chars.sz TextIOWrapper._get_decoded_charscCs$|j|krtd��|j|8_dS)Nz"rewind decoded_chars out of bounds)r%�AssertionError)rErmr@r@rA�_rewind_decoded_chars8s
z#TextIOWrapper._rewind_decoded_charscCs�|jdkrtd��|jr&|jj�\}}|jr<|jj|j�}n|jj|j�}|}|jj	||�}|j
|�|r�t|�t|j�|_
nd|_
|jr�|||f|_|S)Nz
no decoderg)r#r"r'rr(r?r��_CHUNK_SIZErrr�r.r!r$r)r&)rE�
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�@���)r)rEr,r:�
bytes_to_feed�need_eof�
chars_to_skipr@r@rA�_pack_cookiehszTextIOWrapper._pack_cookiecCsFt|d�\}}t|d�\}}t|d�\}}t|d�\}}|||||fS)Nr
r>llll)�divmod)rEZbigint�restr,r:rBrCrDr@r@rA�_unpack_cookiers
zTextIOWrapper._unpack_cookiecCs>|jstd��|jstd��|j�|jj�}|j}|dksF|jdkrX|j	rTt
d��|S|j\}}|t|�8}|j}|dkr�|j
||�S|j�}�z�t|j|�}d}x�|dk�r$|jd|f�t|j|d|���}	|	|k�r|j�\}
}|
�s|}||	8}P|t|
�8}d}q�||8}|d}q�Wd}|jd|f�||}|}
|dk�rZ|j
||
�Sd}d}d}x�t|t|��D]v}|d7}|t|j|||d���7}|j�\}}|�r�||k�r�||7}||8}|dd}
}}||k�rvP�qvW|t|jddd	��7}d}||k�rtd
��|j
||
|||�S|j|�XdS)Nz!underlying stream is not seekablez(telling position disabled by next() callzpending decoded textrr
r�rT)r�z'can't reconstruct logical file position)r�rQr'r,r\r?rYr#r&r$r6r!r%rErrr)rr��range)rEr,r�r:Z
next_inputrDZsaved_stateZ
skip_bytesZ	skip_backrmr�d�	start_posZstart_flagsZ	bytes_fedrCZ
chars_decoded�ir9r@r@rArYysv





zTextIOWrapper.tellcCs$|j�|dkr|j�}|jj|�S)N)r\rYr?rZ)rErWr@r@rArZ�szTextIOWrapper.truncatecCs*|jdkrtd��|j�|j}d|_|S)Nzbuffer is already detached)r?r"r\r�)rEr?r@r@rAr��s
zTextIOWrapper.detachcs��fdd�}�jrtd���js(td��|dkrL|dkr@td��d}�j�}|dkr�|dkrdtd	���j��jjdd�}�jd
�d�_	�j
r��j
j�||�|S|dkr�td|f��|dkr�td|f���j��j|�\}}}}}	�jj|��jd
�d�_	|dk�r(�j
�r(�j
j�n@�j
�s<|�s<|	�rh�j
�pJ�j
��_
�j
jd
|f�|d
f�_	|	�r��jj|�}
�j�j
j|
|��||
f�_	t�j�|	k�r�td��|	�_||�|S)NcsHy�jp�j�}Wntk
r&YnX|dkr<|jd�n|j�dS)Nr)r"r*rrr)r,r/)rEr@rA�_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)rfr"r�rQrYr\r?rVr.r&r#rrHr2rrrr�r!r$r,r%)rEZcookierXrMr,rKr:rBrCrDr;r@)rErArV�s\





zTextIOWrapper.seekcCs�|j�|dkrd}|jp |j�}y
|jWn,tk
rX}ztd�|�WYdd}~XnX|dkr�|j�|j|jj	�dd�}|j
d�d|_|Sd}|j|�}x6t|�|kr�|r�|j
�}||j|t|��7}q�W|SdS)	Nr
zan integer is requiredrT)r�rFr)rcr#r2r�r-rr5r�r?rrr.r&r!r=)rErnr�r�r<r<r@r@rArr5	s(



zTextIOWrapper.readcCs(d|_|j�}|s$d|_|j|_t�|S)NF)r'rur&r�rw)rErxr@r@rAryN	szTextIOWrapper.__next__cCs�|jrtd��|dkrd	}nt|t�s.td��|j�}d}|jsH|j�d}}�xR|jr�|j	d|�}|dkrz|d}Pnt
|�}n�|j�r|j	d|�}|j	d|�}|d
kr�|dkr�t
|�}n
|d}PnL|dkr�|d}Pn8||kr�|d}Pn$||dk�r|d}Pn
|d}Pn&|j	|j�}|dk�r>|t
|j�}P|dk�r\t
|�|k�r\|}Px|j
��rv|j�r^P�q^W|j�r�||j�7}qT|jd�d|_|SqTW|dk�r�||k�r�|}|jt
|�|�|d|�S)
Nzread from closed filer
zsize must be an integerrr�r�rrrrrr)rfr"rrrr5r#r2rrkr!rrr=r$r.r&r7)rErnrx�startrW�endposZnlposZcrposr@r@rAruW	sp




zTextIOWrapper.readlinecCs|jr|jjSdS)N)r#r�)rEr@r@rAr��	szTextIOWrapper.newlines)NNNFF)N)rrrr)N)r)N)N)%rIrJrKr8r�r�r�r6r7r=r?r_rbrdr\r3rfrTr*r'r~r*r2r.r5r7r=rErHrYrZr�rVrrryrur�r@r@r@rAr1ZsF
E

*
	c

K
	
Xr1csNeZdZd�fdd�	Zdd�Zdd�Zed	d
��Zedd��Zd
d�Z	�Z
S)�StringIOrr�csftt|�jt�dd|d�|dkr(d|_|dk	rbt|t�sNtdjt	|�j
���|j|�|jd�dS)Nzutf-8�
surrogatepass)r6r7r8Fz*initial_value must be str or None, not {0}r)
r�rPr�r�rrrrr�rrIr~rV)rEZ
initial_valuer8)rSr@rAr��	s

zStringIO.__init__cCsL|j�|jp|j�}|j�}|j�z|j|jj�dd�S|j|�XdS)NT)r�)	r\r#r2rrr�r?r�r)rEr�Z	old_stater@r@rAr��	szStringIO.getvaluecCs
tj|�S)N)�objectr�)rEr@r@rAr��	szStringIO.__repr__cCsdS)Nr@)rEr@r@rAr7�	szStringIO.errorscCsdS)Nr@)rEr@r@rAr6�	szStringIO.encodingcCs|jd�dS)Nr�)rU)rEr@r@rAr��	szStringIO.detach)rr�)rIrJrKr�r�r�r�r7r6r�r�r@r@)rSrArP�	s
rP>rri r)rrNNNTN)4r�abcr�r�r��sys�_threadrr�rZ
_dummy_thread�platformZmsvcrtrr��iorrrr	r�rp�addr�	SEEK_DATAr(r�rBrCrLrQr-r,r"�ABCMetarR�registerr��_ior&r�r�r�r0r/r�r.r�r�r�r1rPr@r@r@rA�<module>st



T	
=
giCZIJUAU^

Hacked By AnonymousFox1.0, Coded By AnonymousFox