AlkantarClanX12

Your IP : 18.118.28.217


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

3

��f�m�@s>dddddddddd	d
ddg
Zd
dlZd
dlZd
dlZd
dlZd
dl	Z
d
dlZd
dl
mZd
dlZyd
dlZWnek
r�d
dlZYnXejZejejBejBZeed�r�eejOZeZeed�r�eejOZeed�r�ejZndZdZ e�Z!eed��rej"Z#need��rej$Z#ndd�Z#dd�Z%dd�Z&dd�Z'Gdd�d�Z(d d!�Z)d"d#�Z*da+d$d%�Z,d&d'�Z-d(d)�Z.d*d+�Z/d,d�Z0d-d�Z1da2d.d
�Z3d/d�Z4dCd1d�Z5dDd2d�Z6d3e dfd4d�Z7Gd5d6�d6�Z8Gd7d8�d8�Z9dFd<d�Z:ej;d=k�sej<j=d>k�re:Z>need?�a?dHd@d�Z>GdAd�d�Z@GdBd�deA�ZBdS)I�NamedTemporaryFile�
TemporaryFile�SpooledTemporaryFile�TemporaryDirectory�mkstemp�mkdtemp�mktemp�TMP_MAX�
gettempprefix�tempdir�
gettempdir�gettempprefixb�gettempdirb�N)�Random�
O_NOFOLLOW�O_BINARYi'Ztmp�lstat�statcCstj|tj�}tj|�dS)N)�_os�open�O_RDONLY�close)�fn�fd�r� /usr/lib64/python3.6/tempfile.py�_statTsrcCs*yt|�Wntk
r dSXdSdS)NFT)r�OSError)rrrr�_existsXs
rcGs`d}xJ|D]B}|dkrq
t|t�r8|tkr2td��t}q
|tkrHtd��t}q
W|dkr\tS|S)Nz1Can't mix bytes and non-bytes in path components.)�
isinstance�bytes�str�	TypeError)�argsZreturn_type�argrrr�_infer_return_typeas

r%cCsdt|||�}|dkr|�}|dkr:|tkr0t}n
tjt�}|dkrX|tkrRt�}nt�}||||fS)N)r%r!�templater�fsencoderr
)�prefix�suffix�dir�output_typerrr�_sanitize_paramsvs
r,c@s,eZdZdZedd��Zdd�Zdd�ZdS)	�_RandomNameSequenceZ%abcdefghijklmnopqrstuvwxyz0123456789_cCs,tj�}|t|dd�kr&t�|_||_|jS)N�_rng_pid)r�getpid�getattr�_RandomZ_rngr.)�selfZcur_pidrrr�rng�s
z_RandomNameSequence.rngcCs|S)Nr)r2rrr�__iter__�sz_RandomNameSequence.__iter__cs0|j�|jj���fdd�td�D�}dj|�S)Ncsg|]}����qSrr)�.0Zdummy)�c�chooserr�
<listcomp>�sz0_RandomNameSequence.__next__.<locals>.<listcomp>��)�
charactersr3Zchoice�range�join)r2Zlettersr)r6r7r�__next__�sz_RandomNameSequence.__next__N)�__name__�
__module__�__qualname__r;�propertyr3r4r>rrrrr-�sr-cCs�g}x$dD]}tj|�}|r
|j|�q
Wtjdkr\|jtjjd�tjjd�ddd	d
g�n|jddd
g�y|jtj��Wn$t	t
fk
r�|jtj�YnX|S)N�TMPDIR�TEMP�TMP�ntz~\AppData\Local\Tempz%SYSTEMROOT%\Tempzc:\tempzc:\tmpz\tempz\tmpz/tmpz/var/tmpz/usr/tmp)rCrDrE)r�getenv�append�name�extend�path�
expanduser�
expandvars�getcwd�AttributeErrorr�curdir)�dirlistZenvname�dirnamerrr�_candidate_tempdir_list�s



rScCs4t�}t�}�x|D�]}|tjkr0tjj|�}x�td�D]�}t|�}tjj||�}y\tj	|t
d�}z<z*tj	|ddd��}|jd�WdQRXWdtj
|�XWdtj|�X|Stk
r�Yq:tk
�rtjdkr�tjj|�r�tj|tj�r�w:PYq:tk
�rPYq:Xq:WqWttjd|��dS)	N�di��wbF)�closefdsblatrFz)No usable temporary directory found in %s)r-rSrrPrK�abspathr<�nextr=r�_bin_openflags�_io�writer�unlink�FileExistsError�PermissionErrorrI�isdir�access�W_OKr�FileNotFoundError�_errno�ENOENT)ZnamerrQr*�seqrI�filenamer�fprrr�_get_default_tempdir�s:	
rhc
Cs2tdkr.tj�ztdkr t�aWdtj�XtS)N)�_name_sequence�
_once_lock�acquirer-�releaserrrr�_get_candidate_names�s

rmc
Cs�t�}|tkrttj|�}x�tt�D]�}t|�}tjj	||||�}ytj
||d�}	WnRtk
rnw$Yn>tk
r�tj
dkr�tjj|�r�tj|tj�r�w$n�YnX|	tjj|�fSWttjd��dS)Ni�rFz#No usable temporary file name found)rmr �maprr'r<rrXrKr=rr]r^rIr_r`rarWrc�EEXIST)
r*ZpreZsuf�flagsr+�namesrerI�filerrrr�_mkstemp_inner�s$rscGsJ|tjkr ||f|�ddi�n&tjdks8tjj|�rF||f|��dS)N�follow_symlinksFrF)r�supports_follow_symlinksrIrK�islink)�funcrKr#rrr�_dont_follow_symlinkss
rxcCs>y
tj}Wntk
rYnXt||d�ttj|d�dS)Nri�)r�chflagsrOrx�chmod)rKryrrr�_resetpermss
r{cCstS)N)r&rrrrr	*scCstjt��S)N)rr'r	rrrrr.sc
Cs2tdkr.tj�ztdkr t�aWdtj�XtS)N)r
rjrkrhrlrrrrr4s

cCstjt��S)N)rr'rrrrrr
@sFcCs2t|||�\}}}}|rt}nt}t|||||�S)N)r,�_text_openflagsrYrs)r)r(r*�textr+rprrrrDs
cCs�t|||�\}}}}t�}|tkr.ttj|�}x�tt�D]�}t|�}tj	j
||||�}ytj|d�WnRtk
r�w8Yn>t
k
r�tjdkr�tj	j|�r�tj|tj�r�w8n�YnX|SWttjd��dS)Ni�rFz(No usable temporary directory name found)r,rmr rnrr'r<rrXrKr=�mkdirr]r^rIr_r`rarcro)r)r(r*r+rqrerIrrrrrrls&
r:cCs`|dkrt�}t�}x:tt�D].}t|�}tjj||||�}t|�s|SqWt	t
jd��dS)Nz"No usable temporary filename found)rrmr<rrXrrKr=rr]rcro)r)r(r*rqrerIrrrrrr�sc@sHeZdZdZdZddd�Zejdkr<ejfdd�Z	d	d
�Z
ndd�Z	dS)
�_TemporaryFileCloserNFTcCs||_||_||_dS)N)rrrI�delete)r2rrrIr�rrr�__init__�sz_TemporaryFileCloser.__init__rFcCs>|jr:|jdk	r:d|_z|jj�Wd|jr8||j�XdS)NT)�close_calledrrrr�rI)r2r\rrrr�sz_TemporaryFileCloser.closecCs|j�dS)N)r)r2rrr�__del__�sz_TemporaryFileCloser.__del__cCs|jsd|_|jj�dS)NT)r�rrr)r2rrrr�s)T)r?r@rArrr�r�rrIr\rr�rrrrr�s



rc@s>eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)�_TemporaryFileWrapperTcCs$||_||_||_t|||�|_dS)N)rrrIr�r�_closer)r2rrrIr�rrrr��sz_TemporaryFileWrapper.__init__cs^|jd}t||�}t|d�rD|�tj���fdd��}|j|_|}t|t�sZt|||�|S)Nrr�__call__cs
�||�S)Nr)r#�kwargs)rwrr�func_wrapper�sz7_TemporaryFileWrapper.__getattr__.<locals>.func_wrapper)	�__dict__r0�hasattr�
_functools�wrapsr�r�int�setattr)r2rIrr�ar�r)rwr�__getattr__�s



z!_TemporaryFileWrapper.__getattr__cCs|jj�|S)N)rr�	__enter__)r2rrrr�s
z_TemporaryFileWrapper.__enter__cCs|jj|||�}|j�|S)N)rr�__exit__r)r2�exc�value�tb�resultrrrr�sz_TemporaryFileWrapper.__exit__cCs|jj�dS)N)r�r)r2rrrrsz_TemporaryFileWrapper.closeccsx|jD]
}|VqWdS)N)rr)r2�linerrrr4sz_TemporaryFileWrapper.__iter__N)T)	r?r@rAr�r�r�r�rr4rrrrr��s
r��w+b�Tc

Cs�t|||�\}}}}t}	tjdkr0|r0|	tjO}	t||||	|�\}
}y tj|
||||d�}t|||�St	k
r�tj
|�tj|
��YnXdS)NrF)�	buffering�newline�encoding)r,rYrrIZO_TEMPORARYrsrZrr��
BaseExceptionr\r)
�moder�r�r�r)r(r*r�r+rprrIrrrrrrs




�posix�cygwin�	O_TMPFILEcCs�t|||�\}}}}t}tr�y$|tjBtj@}	tj||	d�}
Wn*tk
rXdaYnBtk
rjYn0Xyt	j|
||||d�Stj
|
��YnXt|||||�\}
}ytj|�t	j|
||||d�Stj
|
��YnXdS)Ni�F)r�r�r�)
r,rY�_O_TMPFILE_WORKSrr��O_CREATr�IsADirectoryErrorrrZrrsr\)r�r�r�r�r)r(r*r+rpZflags2rrIrrrrNs0






c@s�eZdZdZd7dd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
edd��Zedd��Z
dd�Zdd�Zdd�Zedd��Zed d!��Zed"d#��Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zed,d-��Zd.d/�Zd8d0d1�Zd2d3�Zd4d5�ZdS)9rFr�w+br�Nc		CsHd|krtj�|_ntjdd�|_||_d|_|||||||d�|_dS)N�b�
)r�F)r�r�r)r(r�r�r*)rZ�BytesIO�_file�StringIO�	_max_size�_rolled�_TemporaryFileArgs)	r2�max_sizer�r�r�r�r)r(r*rrrr��szSpooledTemporaryFile.__init__cCs,|jr
dS|j}|r(|j�|kr(|j�dS)N)r�r��tell�rollover)r2rrr�rrr�_check�s
zSpooledTemporaryFile._checkcCsN|jr
dS|j}tf|j�}|_|`|j|j��|j|j�d�d|_dS)NrT)r�r�rr�r[�getvalue�seekr�)r2rrZnewfilerrrr��szSpooledTemporaryFile.rollovercCs|jjrtd��|S)Nz%Cannot enter context with closed file)r��closed�
ValueError)r2rrrr��szSpooledTemporaryFile.__enter__cCs|jj�dS)N)r�r)r2r�r�r�rrrr��szSpooledTemporaryFile.__exit__cCs
|jj�S)N)r�r4)r2rrrr4�szSpooledTemporaryFile.__iter__cCs|jj�dS)N)r�r)r2rrrr�szSpooledTemporaryFile.closecCs|jjS)N)r�r�)r2rrrr��szSpooledTemporaryFile.closedcCs8y|jjStk
r2d|jdkr(�|jdSXdS)Nr�r�r�)r�r�rOr�)r2rrrr��szSpooledTemporaryFile.encodingcCs|j�|jj�S)N)r�r��fileno)r2rrrr��szSpooledTemporaryFile.filenocCs|jj�dS)N)r��flush)r2rrrr��szSpooledTemporaryFile.flushcCs
|jj�S)N)r��isatty)r2rrrr��szSpooledTemporaryFile.isattycCs(y|jjStk
r"|jdSXdS)Nr�)r�r�rOr�)r2rrrr��szSpooledTemporaryFile.modecCs"y|jjStk
rdSXdS)N)r�rIrO)r2rrrrI�szSpooledTemporaryFile.namecCs8y|jjStk
r2d|jdkr(�|jdSXdS)Nr�r�r�)r��newlinesrOr�)r2rrrr��szSpooledTemporaryFile.newlinescGs|jj|�S)N)r��read)r2r#rrrr��szSpooledTemporaryFile.readcGs|jj|�S)N)r��readline)r2r#rrrr��szSpooledTemporaryFile.readlinecGs|jj|�S)N)r��	readlines)r2r#rrrr��szSpooledTemporaryFile.readlinescGs|jj|�dS)N)r�r�)r2r#rrrr��szSpooledTemporaryFile.seekcCs|jjS)N)r��	softspace)r2rrrr�szSpooledTemporaryFile.softspacecCs
|jj�S)N)r�r�)r2rrrr�szSpooledTemporaryFile.tellcCs6|dkr|jj�n||jkr&|j�|jj|�dS)N)r��truncater�r�)r2�sizerrrr�s

zSpooledTemporaryFile.truncatecCs|j}|j|�}|j|�|S)N)r�r[r�)r2�srr�rvrrrr[s

zSpooledTemporaryFile.writecCs|j}|j|�}|j|�|S)N)r��
writelinesr�)r2�iterablerrr�rrrr�s

zSpooledTemporaryFile.writelines���)rr�r�NNNNN)N)r?r@rAr�r�r�r�r�r�r4rrBr�r�r�r�r�r�rIr�r�r�r�r�r�r�r�r[r�rrrrr�s6
		
c@sNeZdZddd�Zedd��Zedd��Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)rNcCs0t|||�|_tj||j|jdj|�d�|_dS)NzImplicitly cleaning up {!r})�warn_message)rrI�_weakref�finalize�_cleanup�format�
_finalizer)r2r)r(r*rrrr�(s
zTemporaryDirectory.__init__cs ��fdd�}tj�|d�dS)Ncs�t|dt�r|yV|�kr(ttjj|��t|�ytj|�Wn"ttfk
r`�j|�YnXWq�t	k
rxYq�Xnt|dt	�r�n�dS)Nr)
�
issubclassr^r{rrKrRr\r��_rmtreerb)rwrK�exc_info)�clsrIrr�onerror0sz+TemporaryDirectory._rmtree.<locals>.onerror)r�)�_shutilZrmtree)r�rIr�r)r�rIrr�.szTemporaryDirectory._rmtreecCs|j|�tj|t�dS)N)r��	_warnings�warn�ResourceWarning)r�rIr�rrrr�Es
zTemporaryDirectory._cleanupcCsdj|jj|j�S)Nz	<{} {!r}>)r��	__class__r?rI)r2rrr�__repr__JszTemporaryDirectory.__repr__cCs|jS)N)rI)r2rrrr�MszTemporaryDirectory.__enter__cCs|j�dS)N)�cleanup)r2r�r�r�rrrr�PszTemporaryDirectory.__exit__cCs|jj�r|j|j�dS)N)r��detachr�rI)r2rrrr�Ss
zTemporaryDirectory.cleanup)NNN)r?r@rAr��classmethodr�r�r�r�r�r�rrrrrs
)NNNF)NNNr�)r�r�NNNNNTr�)r�r�NNNNN)C�__all__�	functoolsr��warningsr��iorZ�osrZshutilr��errnorcZrandomrr1�weakrefr��_thread�ImportErrorZ
_dummy_thread�
allocate_lockZ_allocate_lock�O_RDWRr��O_EXCLr|r�rrYrrr&rjrrrrr%r,r-rSrhrirmrsrxr{r	rr
rr
rrrrr�rrI�sys�platformrr�r�objectrrrrr�<module>s�




	-
(
' +?
$

8