AlkantarClanX12

Your IP : 18.117.94.77


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



���]h�@sHdddddddddd	d
ddg
Zd
dlZd
dlZd
dlZd
dlZd
dl	Z
d
dlZd
dl
mZd
dlZyd
dlZWnek
r�d
dlZYnXejZejejBejBZeed�r�eejOZeZeed�r eejOZeed�r;ejZndZdZ e�Z!eed�rkej"Z#n'eed�r�ej$Z#ndd�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/da0d*d
�Z1d+d�Z2dddd,d-d�Z3dddd.d�Z4d/e dd0d�Z5Gd1d2�d2�Z6Gd3d4�d4�Z7d5d?dddddd7d8d�Z8ej9d9ks�ej:j;d:kr�e8Z<n0eed;�a=d5d@dddddd<d�Z<Gd=d�d�Z>Gd>d�de?�Z@dS)A�NamedTemporaryFile�
TemporaryFile�SpooledTemporaryFile�TemporaryDirectory�mkstemp�mkdtemp�mktemp�TMP_MAX�
gettempprefix�tempdir�
gettempdir�gettempprefixb�gettempdirb�N)�Random�
O_NOFOLLOW�O_BINARYi'�tmp�lstat�statcCs&tj|tj�}tj|�dS)N)�_os�open�O_RDONLY�close)�fn�fd�r�-/opt/alt/python35/lib64/python3.5/tempfile.py�_statTsrcCs/yt|�Wntk
r&dSYnXdSdS)NFT)r�OSError)rrrr�_existsXs

	rcGs�d}xk|D]c}|dkr"q
t|t�rR|tkrItd��t}q
|tkrjtd��t}q
W|dkr�tS|S)Nz1Can't mix bytes and non-bytes in path components.)�
isinstance�bytes�str�	TypeError)�args�return_type�argrrr�_infer_return_typeas
	
r'cCs�t|||�}|dkr'|�}|dkrW|tkrHt}ntjt�}|dkr�|tkr{t�}n	t�}||||fS)N)r'r"�templater�fsencoderr
)�prefix�suffix�dir�output_typerrr�_sanitize_paramsvs			r.c@s@eZdZdZedd��Zdd�Zdd�ZdS)	�_RandomNameSequence�%abcdefghijklmnopqrstuvwxyz0123456789_cCs@tj�}|t|dd�kr9t�|_||_|jS)N�_rng_pid)r�getpid�getattr�_Random�_rngr1)�self�cur_pidrrr�rng�s
	z_RandomNameSequence.rngcCs|S)Nr)r6rrr�__iter__�sz_RandomNameSequence.__iter__csD|j�|jj���fdd�td�D�}dj|�S)Ncsg|]}����qSrr)�.0�dummy)�c�chooserr�
<listcomp>�s	z0_RandomNameSequence.__next__.<locals>.<listcomp>��)�
charactersr8�choice�range�join)r6�lettersr)r<r=r�__next__�s	"z_RandomNameSequence.__next__N)�__name__�
__module__�__qualname__rA�propertyr8r9rFrrrrr/�sr/cCs�g}x0dD](}tj|�}|r
|j|�q
Wtjdkrd|jddddg�n|jd	d
dg�y|jtj��Wn(ttfk
r�|jtj�YnX|S)
N�TMPDIR�TEMP�TMP�ntzc:\tempzc:\tmpz\tempz\tmpz/tmpz/var/tmpz/usr/tmp)rKrLrM)	r�getenv�append�name�extend�getcwd�AttributeErrorr�curdir)�dirlist�envname�dirnamerrr�_candidate_tempdir_list�s
rYcCs~t�}t�}xO|D]G}|tjkr@tjj|�}xtd�D]}t|�}tjj||�}yvtj	|t
d�}zHz3tj	|ddd��}|jd�WdQRXWdtj
|�XWdtj|�X|SWqMtk
r�YqMtk
rItjdkrDtjj|�rDtj|tj�rDwMPYqMtk
r[PYqMXqMWqWttjd|��dS)	N�di��wb�closefdFsblatrNz)No usable temporary directory found in %s)r/rYrrU�path�abspathrC�nextrDr�_bin_openflags�_io�writer�unlink�FileExistsError�PermissionErrorrQ�isdir�access�W_OKr�FileNotFoundError�_errno�ENOENT)�namerrVr,�seqrQ�filenamer�fprrr�_get_default_tempdir�s:			


!
	rpc
CsAtdkr=tj�ztdkr.t�aWdtj�XtS)N)�_name_sequence�
_once_lock�acquirer/�releaserrrr�_get_candidate_names�s

ruc
Cst�}|tkr'ttj|�}x�tt�D]�}t|�}tjj	||||�}ytj
||d�}	Wnetk
r�w4YnQtk
r�tj
dkr�tjj|�r�tj|tj�r�w4n�YnX|	tjj|�fSWttjd��dS)Ni�rNz#No usable temporary file name found)rur!�maprr)rCrr_r]rDrrdrerQrfrgrhr^rj�EEXIST)
r,�pre�suf�flagsr-�namesrmrQ�filerrrr�_mkstemp_inner�s$	

!	r}cCstS)N)r(rrrrr	scCstjt��S)N)rr)r	rrrrrsc
CsAtdkr=tj�ztdkr.t�aWdtj�XtS)N)r
rrrsrprtrrrrr!s

cCstjt��S)N)rr)rrrrrr
-sFcCsIt|||�\}}}}|r-t}nt}t|||||�S)N)r.�_text_openflagsr`r})r+r*r,�textr-rzrrrr1s
	cCst|||�\}}}}t�}|tkrEttj|�}x�tt�D]�}t|�}tj	j
||||�}ytj|d�Wnetk
r�wRYnQt
k
r�tjdkr�tj	j|�r�tj|tj�r�wRn�YnX|SWttjd��dS)Ni�rNz(No usable temporary directory name found)r.rur!rvrr)rCrr_r]rD�mkdirrdrerQrfrgrhrjrw)r+r*r,r-r{rmrQr|rrrrYs&
	

!	r@cCs�|dkrt�}t�}xMtt�D]?}t|�}tjj||||�}t|�s+|Sq+Wt	t
jd��dS)Nz"No usable temporary filename found)rrurCrr_rr]rDrrdrjrw)r+r*r,r{rmrQr|rrrr�s			c@sgeZdZdZdZddd�ZejdkrWejdd�Z	d	d
�Z
ndd�Z	dS)�_TemporaryFileCloserNFTcCs||_||_||_dS)N)r|rQ�delete)r6r|rQr�rrr�__init__�s		z_TemporaryFileCloser.__init__rNcCsQ|jrM|jdk	rMd|_z|jj�Wd|jrL||j�XdS)NT)�close_calledr|rr�rQ)r6rcrrrr�s		z_TemporaryFileCloser.closecCs|j�dS)N)r)r6rrr�__del__�sz_TemporaryFileCloser.__del__cCs#|jsd|_|jj�dS)NT)r�r|r)r6rrrr�s		)rGrHrIr|r�r�rrQrcrr�rrrrr��s
r�c@s[eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)�_TemporaryFileWrapperTcCs4||_||_||_t|||�|_dS)N)r|rQr�r��_closer)r6r|rQr�rrrr��s			z_TemporaryFileWrapper.__init__cs�|jd}t||�}t|d�rd|�tj���fdd��}|j|_|}t|t�s�t|||�|S)Nr|�__call__cs
�||�S)Nr)r$�kwargs)�funcrr�func_wrapper�sz7_TemporaryFileWrapper.__getattr__.<locals>.func_wrapper)	�__dict__r3�hasattr�
_functools�wrapsr�r �int�setattr)r6rQr|�ar�r)r�r�__getattr__�s
!z!_TemporaryFileWrapper.__getattr__cCs|jj�|S)N)r|�	__enter__)r6rrrr��s
z_TemporaryFileWrapper.__enter__cCs&|jj|||�}|j�|S)N)r|�__exit__r)r6�exc�value�tb�resultrrrr��s
z_TemporaryFileWrapper.__exit__cCs|jj�dS)N)r�r)r6rrrr�sz_TemporaryFileWrapper.closeccsx|jD]}|Vq
WdS)N)r|)r6�linerrrr9sz_TemporaryFileWrapper.__iter__N)	rGrHrIr�r�r�r�rr9rrrrr��sr�zw+b�Tc
Cs�t|||�\}}}}t}	tjdkrF|rF|	tjO}	t||||	|�\}
}y8tj|
|d|d|d|�}t|||�SWn/t	k
r�tj
|�tj|
��YnXdS)NrN�	buffering�newline�encoding)r.r`rrQ�O_TEMPORARYr}rarr��
BaseExceptionrcr)
�moder�r�r�r+r*r,r�r-rzrrQr|rrrr
s



�posix�cygwin�	O_TMPFILEcCs5t|||�\}}}}t}tr�y.|tjBtj@}	tj||	d�}
Wn)tk
rrdaYnStk
r�YnBXy&t	j|
|d|d|d|�SWntj
|
��YnXt|||||�\}
}y3tj|�t	j|
|d|d|d|�SWntj
|
��YnXdS)Ni�Fr�r�r�)
r.r`�_O_TMPFILE_WORKSrr��O_CREATr�IsADirectoryErrorrrarr}rc)r�r�r�r�r+r*r,r-rz�flags2rrQrrrr;s0





c
@sueZdZdZddd6ddddddd�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/�Zdd0d1�Zd2d3�Zd4d5�ZdS)7rFrzw+br�Nc		Cs|d|krtj�|_ntjdd�|_||_d|_d|d|d|d|d	|d|d
|i|_dS)N�br��
Fr�r�r+r*r�r,)ra�BytesIO�_file�StringIO�	_max_size�_rolled�_TemporaryFileArgs)	r6�max_sizer�r�r�r�r+r*r,rrrr�|s		zSpooledTemporaryFile.__init__cCs<|jr
dS|j}|r8|j�|kr8|j�dS)N)r�r��tell�rollover)r6r|r�rrr�_check�s
		zSpooledTemporaryFile._checkcCsh|jr
dS|j}t|j�}|_|`|j|j��|j|j�d�d|_dS)NrT)r�r�rr�rb�getvalue�seekr�)r6r|�newfilerrrr��s		zSpooledTemporaryFile.rollovercCs|jjrtd��|S)Nz%Cannot enter context with closed file)r��closed�
ValueError)r6rrrr��szSpooledTemporaryFile.__enter__cCs|jj�dS)N)r�r)r6r�r�r�rrrr��szSpooledTemporaryFile.__exit__cCs
|jj�S)N)r�r9)r6rrrr9�szSpooledTemporaryFile.__iter__cCs|jj�dS)N)r�r)r6rrrr�szSpooledTemporaryFile.closecCs
|jjS)N)r�r�)r6rrrr��szSpooledTemporaryFile.closedcCsHy|jjSWn3tk
rCd|jdkr4�|jdSYnXdS)Nr�r�r�)r�r�rTr�)r6rrrr��s
zSpooledTemporaryFile.encodingcCs|j�|jj�S)N)r�r��fileno)r6rrrr��s
zSpooledTemporaryFile.filenocCs|jj�dS)N)r��flush)r6rrrr��szSpooledTemporaryFile.flushcCs
|jj�S)N)r��isatty)r6rrrr��szSpooledTemporaryFile.isattycCs2y|jjSWntk
r-|jdSYnXdS)Nr�)r�r�rTr�)r6rrrr��s
zSpooledTemporaryFile.modecCs+y|jjSWntk
r&dSYnXdS)N)r�rQrT)r6rrrrQ�s
zSpooledTemporaryFile.namecCsHy|jjSWn3tk
rCd|jdkr4�|jdSYnXdS)Nr�r�r�)r��newlinesrTr�)r6rrrr��s
zSpooledTemporaryFile.newlinescGs|jj|�S)N)r��read)r6r$rrrr��szSpooledTemporaryFile.readcGs|jj|�S)N)r��readline)r6r$rrrr��szSpooledTemporaryFile.readlinecGs|jj|�S)N)r��	readlines)r6r$rrrr��szSpooledTemporaryFile.readlinescGs|jj|�dS)N)r�r�)r6r$rrrr��szSpooledTemporaryFile.seekcCs
|jjS)N)r��	softspace)r6rrrr��szSpooledTemporaryFile.softspacecCs
|jj�S)N)r�r�)r6rrrr��szSpooledTemporaryFile.tellcCsI|dkr|jj�n)||jkr5|j�|jj|�dS)N)r��truncater�r�)r6�sizerrrr��s

zSpooledTemporaryFile.truncatecCs)|j}|j|�}|j|�|S)N)r�rbr�)r6�sr|�rvrrrrb�s	
zSpooledTemporaryFile.writecCs)|j}|j|�}|j|�|S)N)r��
writelinesr�)r6�iterabler|r�rrrr�s	
zSpooledTemporaryFile.writelines���)rGrHrIr�r�r�r�r�r�r9rrJr�r�r�r�r�r�rQr�r�r�r�r�r�r�r�rbr�rrrrrus6			c@sgeZdZddddd�Zedd��Zdd�Zdd	�Zd
d�Zdd
�Z	dS)rNcCsFt|||�|_tj||j|jddj|��|_dS)N�warn_messagezImplicitly cleaning up {!r})rrQ�_weakref�finalize�_cleanup�format�
_finalizer)r6r+r*r,rrrr�szTemporaryDirectory.__init__cCs!tj|�tj|t�dS)N)�_shutil�rmtree�	_warnings�warn�ResourceWarning)�clsrQr�rrrr�s
zTemporaryDirectory._cleanupcCsdj|jj|j�S)Nz	<{} {!r}>)r��	__class__rGrQ)r6rrr�__repr__!szTemporaryDirectory.__repr__cCs|jS)N)rQ)r6rrrr�$szTemporaryDirectory.__enter__cCs|j�dS)N)�cleanup)r6r�r�r�rrrr�'szTemporaryDirectory.__exit__cCs#|jj�rtj|j�dS)N)r��detachr�r�rQ)r6rrrr�*szTemporaryDirectory.cleanup)
rGrHrIr��classmethodr�r�r�r�r�rrrrr	sr�r�)A�__all__�	functoolsr��warningsr��iora�osr�shutilr��errnorj�randomrr4�weakrefr��_thread�ImportError�
_dummy_thread�
allocate_lock�_allocate_lock�O_RDWRr��O_EXCLr~r�rr`rrr(rrrrrrr'r.r/rYrprqrur}r	rr
rr
rrrr�r�rrQ�sys�platformrr�r�objectrrrrr�<module>s�
	

		-(' +?		$!			8�