Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/__pycache__/tempfile.cpython-37.opt-2.pyc

B

YI~djh�
@sdddddddddd	d
ddg
Zd
dlZd
dlZd
dlZd
dlZd
dl	Z
d
dlZd
dl
mZd
dlZd
dlZejZejejBejBZeed�r�eejOZeZeed�r�eejOZeed�r�ejZndZdZe�Zeed�r�ej Z!need�r�ej"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-da.d*d
�Z/d+d�Z0d?d-d�Z1d@d.d�Z2d/edfd0d�Z3Gd1d2�d2�Z4Gd3d4�d4�Z5dAd8d�Z6ej7d9k�s�ej8j9d:k�r�e6Z:need;�a;dBd<d�Z:Gd=d�d�Z<Gd>d�de=�Z>dS)C�NamedTemporaryFile�
TemporaryFile�SpooledTemporaryFile�TemporaryDirectory�mkstemp�mkdtemp�mktemp�TMP_MAX�
gettempprefix�tempdir�
gettempdir�gettempprefixb�gettempdirb�N)�Random�
O_NOFOLLOW�O_BINARYi'Ztmp�lstat�statcCst�|tj�}t�|�dS)N)�_os�open�O_RDONLY�close)�fn�fd�r�-/opt/alt/python37/lib64/python3.7/tempfile.py�_statPsrcCs*yt|�Wntk
r dSXdSdS)NFT)r�OSError)rrrr�_existsTs
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_type]s

r%cCsdt|||�}|dkr|�}|dkr:|tkr0t}n
t�t�}|dkrX|tkrRt�}nt�}||||fS)N)r%r!�templater�fsencoderr
)�prefix�suffix�dir�output_typerrr�_sanitize_paramsrs
r,c@s,eZdZdZedd��Zdd�Zdd�ZdS)	�_RandomNameSequenceZ%abcdefghijklmnopqrstuvwxyz0123456789_cCs,t��}|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�}d�|�S)Ncsg|]}����qSrr)�.0Zdummy)�c�chooserr�
<listcomp>�sz0_RandomNameSequence.__next__.<locals>.<listcomp>��)�
charactersr3�choice�range�join)r2Zlettersr)r6r7r�__next__�sz_RandomNameSequence.__next__N)�__name__�
__module__�__qualname__r;�propertyr3r4r?rrrrr-�sr-c	Cs�g}x$dD]}t�|�}|r
|�|�q
Wtjdkr\|�tj�d�tj�d�ddddg�n|�d	d
dg�y|�t���Wn$t	t
fk
r�|�tj�YnX|S)N)ZTMPDIRZTEMPZTMP�ntz~\AppData\Local\Tempz%SYSTEMROOT%\Tempzc:\tempzc:\tmpz\tempz\tmpz/tmpz/var/tmpz/usr/tmp)r�getenv�append�name�extend�path�
expanduser�
expandvars�getcwd�AttributeErrorr�curdir)�dirlistZenvname�dirnamerrr�_candidate_tempdir_list�s



rQcCs4t�}t�}�x|D�]}|tjkr0tj�|�}x�td�D]�}t|�}tj�||�}y\t�	|t
d�}z<z*tj	|ddd��}|�d�WdQRXWdt�
|�XWdt�|�X|Stk
r�Yq:tk
�rtjdkr�tj�|�r�t�|tj�r�w:PYq:tk
�rPYq:Xq:WqWttjd|��dS)	N�di��wbF)�closefdsblatrDz)No usable temporary directory found in %s)r-rQrrNrI�abspathr=�nextr>r�_bin_openflags�_io�writer�unlink�FileExistsError�PermissionErrorrG�isdir�access�W_OKr�FileNotFoundError�_errno�ENOENT)ZnamerrOr*�seqrG�filenamer�fprrr�_get_default_tempdir�s:	
rfcCs2tdkr.t��ztdkr t�aWdt��XtS)N)�_name_sequence�
_once_lock�acquirer-�releaserrrr�_get_candidate_names�s

rkc
	Cs�t�}|tkrttj|�}x�tt�D]�}t|�}tj�	||||�}yt�
||d�}	WnRtk
rnw$Yn>tk
r�tj
dkr�tj�|�r�t�|tj�r�w$n�YnX|	tj�|�fSWttjd��dS)Ni�rDz#No usable temporary file name found)rkr �maprr'r=rrVrIr>rr[r\rGr]r^r_rUra�EEXIST)
r*ZpreZsuf�flagsr+�namesrcrG�filerrrr�_mkstemp_inner�s$rqcCstS)N)r&rrrrr	scCst�t��S)N)rr'r	rrrrrscCs2tdkr.t��ztdkr t�aWdt��XtS)N)r
rhrirfrjrrrrrs

cCst�t��S)N)rr'rrrrrr
+sFcCs2t|||�\}}}}|rt}nt}t|||||�S)N)r,�_text_openflagsrWrq)r)r(r*�textr+rnrrrr/s
c	Cs�t|||�\}}}}t�}|tkr.ttj|�}x�tt�D]�}t|�}tj	�
||||�}yt�|d�WnRtk
r�w8Yn>t
k
r�tjdkr�tj	�|�r�t�|tj�r�w8n�YnX|SWttjd��dS)Ni�rDz(No usable temporary directory name found)r,rkr rlrr'r=rrVrIr>�mkdirr[r\rGr]r^r_rarm)r)r(r*r+rorcrGrprrrrWs&
r:cCs`|dkrt�}t�}x:tt�D].}t|�}tj�||||�}t|�s|SqWt	t
jd��dS)Nz"No usable temporary filename found)rrkr=rrVrrIr>rr[rarm)r)r(r*rorcrGrprrrr~sc@sHeZdZdZdZddd�Zejdkr<ejfdd�Z	d	d
�Z
ndd�Z	dS)
�_TemporaryFileCloserNFTcCs||_||_||_dS)N)rprG�delete)r2rprGrvrrr�__init__�sz_TemporaryFileCloser.__init__rDcCs<|js8|jdk	r8d|_z|j��Wd|jr6||j�XdS)NT)�close_calledrprrvrG)r2rZrrrr�sz_TemporaryFileCloser.closecCs|��dS)N)r)r2rrr�__del__�sz_TemporaryFileCloser.__del__cCs|jsd|_|j��dS)NT)rxrpr)r2rrrr�s)T)r@rArBrprxrwrrGrZrryrrrrru�s



ruc@s>eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)�_TemporaryFileWrapperTcCs$||_||_||_t|||�|_dS)N)rprGrvru�_closer)r2rprGrvrrrrw�sz_TemporaryFileWrapper.__init__cs^|jd}t||�}t|d�rD|�t����fdd��}|j|_|}t|t�sZt|||�|S)Nrp�__call__cs
�||�S)Nr)r#�kwargs)�funcrr�func_wrapper�sz7_TemporaryFileWrapper.__getattr__.<locals>.func_wrapper)	�__dict__r0�hasattr�
_functools�wrapsr{r�int�setattr)r2rGrp�arr)r~r�__getattr__�s



z!_TemporaryFileWrapper.__getattr__cCs|j��|S)N)rp�	__enter__)r2rrrr��s
z_TemporaryFileWrapper.__enter__cCs|j�|||�}|��|S)N)rp�__exit__r)r2�exc�value�tb�resultrrrr��sz_TemporaryFileWrapper.__exit__cCs|j��dS)N)r{r)r2rrrr�sz_TemporaryFileWrapper.closeccsx|jD]
}|VqWdS)N)rp)r2�linerrrr4�sz_TemporaryFileWrapper.__iter__N)T)	r@rArBrwr�r�r�rr4rrrrrz�s
rz�w+b���Tc
Cs�t|||�\}}}}t}	tjdkr0|r0|	tjO}	t||||	|�\}
}y tj|
||||d�}t|||�St	k
r�t�
|�t�|
��YnXdS)NrD)�	buffering�newline�encoding)r,rWrrGZO_TEMPORARYrqrXrrz�
BaseExceptionrZr)
�moder�r�r�r)r(r*rvr+rnrrGrprrrrs




�posix�cygwin�	O_TMPFILEcCs�t|||�\}}}}t}tr�y$|tjBtj@}	t�||	d�}
Wn*tk
rXdaYnBtk
rjYn0Xyt	j|
||||d�St�
|
��YnXt|||||�\}
}yt�|�t	j|
||||d�St�
|
��YnXdS)Ni�F)r�r�r�)
r,rW�_O_TMPFILE_WORKSrr��O_CREATr�IsADirectoryErrorrrXrrqrZ)r�r�r�r�r)r(r*r+rnZflags2rrGrrrr9s0






c@s�eZdZdZd6dd�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/�Zd7d0d1�Zd2d3�Zd4d5�ZdS)8rFr�w+br�Nc		CsPd|krt��|_ntjt��||d�|_||_d|_|||||||d�|_dS)N�b)r�r�F)r�r�r)r(r�r�r*)rX�BytesIO�_file�
TextIOWrapper�	_max_size�_rolled�_TemporaryFileArgs)	r2�max_sizer�r�r�r�r)r(r*rrrrwzs
zSpooledTemporaryFile.__init__cCs,|jr
dS|j}|r(|��|kr(|��dS)N)r�r��tell�rollover)r2rpr�rrr�_check�s
zSpooledTemporaryFile._checkcCsr|jr
dS|j}tf|j�}|_|`|��}t|d�rN|j�|���	��n|�|�	��|�
|d�d|_dS)N�bufferrT)r�r�rr�r�r�r�rY�detach�getvalue�seek)r2rpZnewfile�posrrrr��s
zSpooledTemporaryFile.rollovercCs|jjrtd��|S)Nz%Cannot enter context with closed file)r��closed�
ValueError)r2rrrr��szSpooledTemporaryFile.__enter__cCs|j��dS)N)r�r)r2r�r�r�rrrr��szSpooledTemporaryFile.__exit__cCs
|j��S)N)r�r4)r2rrrr4�szSpooledTemporaryFile.__iter__cCs|j��dS)N)r�r)r2rrrr�szSpooledTemporaryFile.closecCs|jjS)N)r�r�)r2rrrr��szSpooledTemporaryFile.closedcCs8y|jjStk
r2d|jdkr(�|jdSXdS)Nr�r�r�)r�r�rMr�)r2rrrr��szSpooledTemporaryFile.encodingcCs|��|j��S)N)r�r��fileno)r2rrrr��szSpooledTemporaryFile.filenocCs|j��dS)N)r��flush)r2rrrr��szSpooledTemporaryFile.flushcCs
|j��S)N)r��isatty)r2rrrr��szSpooledTemporaryFile.isattycCs(y|jjStk
r"|jdSXdS)Nr�)r�r�rMr�)r2rrrr��szSpooledTemporaryFile.modecCs"y|jjStk
rdSXdS)N)r�rGrM)r2rrrrG�szSpooledTemporaryFile.namecCs8y|jjStk
r2d|jdkr(�|jdSXdS)Nr�r�r�)r��newlinesrMr�)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|�S)N)r�r�)r2r#rrrr��szSpooledTemporaryFile.seekcCs|jjS)N)r��	softspace)r2rrrr��szSpooledTemporaryFile.softspacecCs
|j��S)N)r�r�)r2rrrr��szSpooledTemporaryFile.tellcCs6|dkr|j��n||jkr&|��|j�|�dS)N)r��truncater�r�)r2�sizerrrr��s

zSpooledTemporaryFile.truncatecCs|j}|�|�}|�|�|S)N)r�rYr�)r2�srp�rvrrrrY�s

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

zSpooledTemporaryFile.writelines)rr�r�NNNNN)N)r@rArBr�rwr�r�r�r�r4rrCr�r�r�r�r�r�rGr�r�r�r�r�r�r�r�rYr�rrrrrss6

		
c@sBeZdZddd�Zedd��Zdd�Zdd	�Zd
d�Zdd
�Z	dS)rNcCs0t|||�|_tj||j|jd�|�d�|_dS)NzImplicitly cleaning up {!r})�warn_message)rrG�_weakrefZfinalize�_cleanup�format�
_finalizer)r2r)r(r*rrrrws
zTemporaryDirectory.__init__cCst�|�t�|t�dS)N)�_shutil�rmtree�	_warnings�warn�ResourceWarning)�clsrGr�rrrr�s
zTemporaryDirectory._cleanupcCsd�|jj|j�S)Nz	<{} {!r}>)r��	__class__r@rG)r2rrr�__repr__ szTemporaryDirectory.__repr__cCs|jS)N)rG)r2rrrr�#szTemporaryDirectory.__enter__cCs|��dS)N)�cleanup)r2r�r�r�rrrr�&szTemporaryDirectory.__exit__cCs|j��rt�|j�dS)N)r�r�r�r�rG)r2rrrr�)s
zTemporaryDirectory.cleanup)NNN)
r@rArBrw�classmethodr�r�r�r�r�rrrrr	s
)NNNF)NNN)r�r�NNNNNT)r�r�NNNNN)?�__all__�	functoolsr��warningsr��iorX�osrZshutilr��errnoraZrandomrr1�weakrefr��_thread�
allocate_lockZ_allocate_lock�O_RDWRr��O_EXCLrrr�rrWrrr&rhrrrrr%r,r-rQrfrgrkrqr	rr
rr
rrrrurzrrG�sys�platformrr�r�objectrrrrr�<module>s~






	-
(
' +?
$

8

Hacked By AnonymousFox1.0, Coded By AnonymousFox