Your IP : 18.119.117.77


Current Path : /opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/tempfile.cpython-38.opt-2.pyc

U

i�f�l�
@s�dddddddddd	d
ddg
Zd
dlZd
dlZd
dlZd
dlZd
dl	Z
d
dlZd
dl
mZd
dlZd
dlZd
dlZejZejejBejBZeed�r�eejOZeZeed�r�eejOZeed�r�ejZndZdZ e�Z!dd�Z"dd�Z#dd�Z$Gdd�d�Z%dd�Z&dd�Z'da(d d!�Z)d"d#�Z*d$d%�Z+d&d'�Z,d(d�Z-d)d�Z.da/d*d
�Z0d+d�Z1d@d-d�Z2dAd.d�Z3d/e dfd0d�Z4Gd1d2�d2�Z5Gd3d4�d4�Z6dBdd8�d9d�Z7ej8d:k�s�ej9d;k�r�e7Z:need<�a;dCdd8�d=d�Z:Gd>d�d�Z<Gd?d�de=�Z>dS)D�NamedTemporaryFile�
TemporaryFile�SpooledTemporaryFile�TemporaryDirectory�mkstemp�mkdtemp�mktemp�TMP_MAX�
gettempprefix�tempdir�
gettempdir�gettempprefixb�gettempdirb�N)�Random�
O_NOFOLLOW�O_BINARYi'ZtmpcCs.zt�|�Wntk
r$YdSXdSdS)NFT)�_os�lstat�OSError)�fn�r�-/opt/alt/python38/lib64/python3.8/tempfile.py�_existsKs
rcGs\d}|D]B}|dkrqt|t�r6|tkr0td��t}q|tkrFtd��t}q|dkrXtS|S)Nz1Can't mix bytes and non-bytes in path components.)�
isinstance�bytes�str�	TypeError)�argsZreturn_type�argrrr�_infer_return_typeTs
rcCsdt|||�}|dkr|�}|dkr:|tkr0t}n
t�t�}|dkrX|tkrRt�}nt�}||||fS�N)rr�templater�fsencoderr
)�prefix�suffix�dir�output_typerrr�_sanitize_paramsis
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|Sr r�r-rrr�__iter__�sz_RandomNameSequence.__iter__cs0|j�|jj���fdd�td�D�}d�|�S)Ncsg|]}����qSrr)�.0Zdummy��cZchooserr�
<listcomp>�sz0_RandomNameSequence.__next__.<locals>.<listcomp>��)�
charactersr.Zchoice�range�join)r-Zlettersrr2r�__next__�sz_RandomNameSequence.__next__N)�__name__�
__module__�__qualname__r7�propertyr.r0r:rrrrr({s

r(c	Cs�g}dD]}t�|�}|r|�|�qtjdkrX|�tj�d�tj�d�ddddg�n|�d	d
dg�z|�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&


�rLcCsFt�}t�}|D�]}|tjkr,tj�|�}td�D�]�}t|�}tj�||�}zft�	|t
d�}z<z*t
j	|ddd��}|�d�W5QRXW5t�|�XW5t�|�X|WStk
r�Yq4tk
�rtjdk�rtj�|��rt�|tj��rYq4YqYq4tk
�r,YqYq4Xq4qttjd|��dS)	N�d��wbF)�closefdsblatr?z)No usable temporary directory found in %s)r(rLrrIrD�abspathr8�nextr9�open�_bin_openflags�unlink�close�_io�write�FileExistsError�PermissionErrorrB�isdir�access�W_OKr�FileNotFoundError�_errnoZENOENT)ZnamerrJr%�seqrB�filename�fd�fprrr�_get_default_tempdir�s@	

�
��rdcCs2tdkr.t��ztdkr t�aW5t��XtSr )�_name_sequence�
_once_lock�acquire�releaser(rrrr�_get_candidate_names�s

ric
	Cs�t�}|tkrttj|�}tt�D]�}t|�}tj�	||||�}t
�d|�zt�||d�}	WnVt
k
rzYq"Yn@tk
r�tjdkr�tj�|�r�t�|tj�r�Yq"n�YnX|	tj�|�fSt
tjd��dS)Nztempfile.mkstemprNr?z#No usable temporary file name found)rir�maprr"r8rrRrDr9�_sys�auditrSrYrZrBr[r\r]rQr_�EEXIST)
r%ZpreZsuf�flagsr&�namesr`rB�filerbrrr�_mkstemp_inner�s*��rqcGsH|tjkr ||f|�ddi�n$tjdks6tj�|�sD||f|��dS)N�follow_symlinksFr?)r�supports_follow_symlinksrBrD�islink)�funcrDrrrr�_dont_follow_symlinks
s
rvcCs>z
tj}Wntk
rYnXt||d�ttj|d�dS)Nr�)r�chflagsrHrv�chmod)rDrxrrr�_resetpermss
rzcCstSr )r!rrrrr	scCst�t��Sr )rr"r	rrrrr!scCs2tdkr.t��ztdkr t�aW5t��XtSr )r
rfrgrhrdrrrrr's

cCst�t��Sr )rr"rrrrrr
3sFcCs2t|||�\}}}}|rt}nt}t|||||�Sr )r'�_text_openflagsrTrq)r$r#r%�textr&rnrrrr7s
c	Cs�t|||�\}}}}t�}|tkr.ttj|�}tt�D]�}t|�}tj	�
||||�}t�d|�zt�
|d�WnVtk
r�Yq6Yn@tk
r�tjdkr�tj	�|�r�t�|tj�r�Yq6n�YnX|Sttjd��dS)Nztempfile.mkdtemprwr?z(No usable temporary directory name found)r'rirrjrr"r8rrRrDr9rkrl�mkdirrYrZrBr[r\r]r_rm)r$r#r%r&ror`rBrprrrr^s,
��r6cCs`|dkrt�}t�}tt�D]2}t|�}tj�||||�}t|�s|Sqt	t
jd��dS)Nz"No usable temporary filename found)rrir8rrRrrDr9rrYr_rm)r$r#r%ror`rBrprrrr�s
�c@sHeZdZdZdZddd�Zejdkr<ejfdd�Z	d	d
�Z
ndd�Z	dS)
�_TemporaryFileCloserNFTcCs||_||_||_dSr )rprB�delete�r-rprBrrrr�__init__�sz_TemporaryFileCloser.__init__r?cCs<|js8|jdk	r8d|_z|j��W5|jr6||j�XdS�NT)�close_calledrprrBrV)r-rUrrrrV�sz_TemporaryFileCloser.closecCs|��dSr )rVr/rrr�__del__�sz_TemporaryFileCloser.__del__cCs|jsd|_|j��dSr�)r�rprVr/rrrrV�s)T)r;r<r=rpr�r�rrBrUrVr�rrrrr~�s



r~c@s>eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)�_TemporaryFileWrapperTcCs$||_||_||_t|||�|_dSr )rprBrr~�_closerr�rrrr��sz_TemporaryFileWrapper.__init__cs^|jd}t||�}t|d�rD|�t����fdd��}|j|_|}t|t�sZt|||�|S)Nrp�__call__cs
�||�Sr r)r�kwargs�rurr�func_wrapper�sz7_TemporaryFileWrapper.__getattr__.<locals>.func_wrapper)	�__dict__r+�hasattr�
_functools�wrapsr�r�int�setattr)r-rBrp�ar�rr�r�__getattr__�s



z!_TemporaryFileWrapper.__getattr__cCs|j��|Sr )rp�	__enter__r/rrrr��s
z_TemporaryFileWrapper.__enter__cCs|j�|||�}|��|Sr )rp�__exit__rV)r-�exc�value�tb�resultrrrr��sz_TemporaryFileWrapper.__exit__cCs|j��dSr )r�rVr/rrrrV�sz_TemporaryFileWrapper.closeccs|jD]
}|VqdSr )rp)r-�linerrrr0s
z_TemporaryFileWrapper.__iter__N)T)	r;r<r=r�r�r�r�rVr0rrrrr��s
r��w+b���T��errorscCs�t|||�\}}}}	t}
tjdkr0|r0|
tjO}
t||||
|	�\}}z$tj||||||d�}
t|
||�WSt	k
r�t�
|�t�|��YnXdS)Nr?��	buffering�newline�encodingr�)r'rTrrBZO_TEMPORARYrqrWrSr��
BaseExceptionrUrV)�moder�r�r�r$r#r%rr�r&rnrbrBrprrrrs 

�

�posix�cygwin�	O_TMPFILEc
Cs�t|||�\}}}}t}	tr�z$|	tjBtj@}
t�||
d�}Wn*tk
rXdaYnFtk
rjYn4Xzt	j||||||d�WSt�
|��YnXt||||	|�\}}z"t�|�t	j||||||d�WSt�
|��YnXdS)NrNFr�)
r'rT�_O_TMPFILE_WORKSrr��O_CREATrS�IsADirectoryErrorrrWrVrqrU)
r�r�r�r�r$r#r%r�r&rnZflags2rbrBrrrrBs<
�


�
c@s�eZdZdZd9dd�dd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
edd��Zedd��Z
edd��Zdd�Zdd�Zdd �Zed!d"��Zed#d$��Zed%d&��Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zed/d0��Zd1d2�Zd:d3d4�Zd5d6�Zd7d8�ZdS);rFrr�r�Nr�c	
	CsTd|krt��|_ntjt��||	|d�|_||_d|_||||||||	d�|_dS)N�b)r�r�r�F)r�r�r$r#r�r�r%r�)rW�BytesIO�_file�
TextIOWrapper�	_max_size�_rolled�_TemporaryFileArgs)
r-�max_sizer�r�r�r�r$r#r%r�rrrr��s"
��zSpooledTemporaryFile.__init__cCs,|jr
dS|j}|r(|��|kr(|��dSr )r�r��tell�rollover)r-rpr�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�rX�detach�getvalue�seek)r-rpZnewfile�posrrrr��s
zSpooledTemporaryFile.rollovercCs|jjrtd��|S)Nz%Cannot enter context with closed file)r��closed�
ValueErrorr/rrrr��szSpooledTemporaryFile.__enter__cCs|j��dSr �r�rV�r-r�r�r�rrrr��szSpooledTemporaryFile.__exit__cCs
|j��Sr )r�r0r/rrrr0�szSpooledTemporaryFile.__iter__cCs|j��dSr r�r/rrrrV�szSpooledTemporaryFile.closecCs|jjSr )r�r�r/rrrr��szSpooledTemporaryFile.closedcCs|jjSr )r�r�r/rrrr��szSpooledTemporaryFile.encodingcCs|jjSr )r�r�r/rrrr��szSpooledTemporaryFile.errorscCs|��|j��Sr )r�r��filenor/rrrr��szSpooledTemporaryFile.filenocCs|j��dSr )r��flushr/rrrr��szSpooledTemporaryFile.flushcCs
|j��Sr )r��isattyr/rrrr��szSpooledTemporaryFile.isattycCs.z
|jjWStk
r(|jdYSXdS)Nr�)r�r�rHr�r/rrrr��s
zSpooledTemporaryFile.modecCs&z
|jjWStk
r YdSXdSr )r�rBrHr/rrrrB�s
zSpooledTemporaryFile.namecCs|jjSr )r��newlinesr/rrrr��szSpooledTemporaryFile.newlinescGs|jj|�Sr )r��read�r-rrrrr��szSpooledTemporaryFile.readcGs|jj|�Sr )r��readliner�rrrr��szSpooledTemporaryFile.readlinecGs|jj|�Sr )r��	readlinesr�rrrr��szSpooledTemporaryFile.readlinescGs|jj|�Sr )r�r�r�rrrr��szSpooledTemporaryFile.seekcCs|jjSr )r��	softspacer/rrrr��szSpooledTemporaryFile.softspacecCs
|j��Sr )r�r�r/rrrr��szSpooledTemporaryFile.tellcCs6|dkr|j��n||jkr&|��|j�|�dSr )r��truncater�r�)r-�sizerrrr��s

zSpooledTemporaryFile.truncatecCs|j}|�|�}|�|�|Sr )r�rXr�)r-�srp�rvrrrrXs

zSpooledTemporaryFile.writecCs|j}|�|�}|�|�|Sr )r��
writelinesr�)r-�iterablerpr�rrrr�s

zSpooledTemporaryFile.writelines)rr�r�NNNNN)N)r;r<r=r�r�r�r�r�r�r0rVr>r�r�r�r�r�r�r�rBr�r�r�r�r�r�r�r�rXr�rrrrr~sR��







c@sNeZdZddd�Zedd��Zedd��Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)rNcCs0t|||�|_tj||j|jd�|�d�|_dS)NzImplicitly cleaning up {!r})�warn_message)rrB�_weakrefZfinalize�_cleanup�format�
_finalizer)r-r$r#r%rrrr�s�zTemporaryDirectory.__init__cs ��fdd�}tj�|d�dS)Nc	s�t|dt�r|zV|�kr(ttj�|��t|�zt�|�Wn"ttfk
r`��|�YnXWq�t	k
rxYq�Xnt|dt	�r�n�dS)Nr)
�
issubclassrZrzrrDrKrUr��_rmtreer^)rurD�exc_info��clsrBrr�onerror#sz+TemporaryDirectory._rmtree.<locals>.onerror)r�)�_shutilZrmtree)r�rBr�rr�rr�!szTemporaryDirectory._rmtreecCs|�|�t�|t�dSr )r��	_warnings�warn�ResourceWarning)r�rBr�rrrr�8s
zTemporaryDirectory._cleanupcCsd�|jj|j�S)Nz	<{} {!r}>)r��	__class__r;rBr/rrr�__repr__=szTemporaryDirectory.__repr__cCs|jSr )rBr/rrrr�@szTemporaryDirectory.__enter__cCs|��dSr )�cleanupr�rrrr�CszTemporaryDirectory.__exit__cCs|j��r|�|j�dSr )r�r�r�rBr/rrrr�Fs
zTemporaryDirectory.cleanup)NNN)r;r<r=r��classmethodr�r�r�r�r�r�rrrrrs


)NNNF)NNN)r�r�NNNNNT)r�r�NNNNN)?�__all__�	functoolsr��warningsr��iorW�osrZshutilr��errnor_Zrandomrr,�sysrk�weakrefr��_thread�
allocate_lockZ_allocate_lock�O_RDWRr��O_EXCLr{r�rrTrrr!rfrrr'r(rLrdrerirqrvrzr	rr
rr
rrrr~r�rrB�platformrr�r�objectrrrrr�<module>s��





	-
'
( +?��'
��<

?>