Your IP : 18.224.45.82


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/tempfile.cpython-310.opt-2.pyc

o

6��fs�@s	gd�ZddlZddlZddlZddlZddl	Z
ddlZddl
mZddlZddlZddlZddlZejZejejBejBZeed�rIeejOZeZeed�rUeej OZeed�r^ej!Z!ndZ!dZ"e�Z#d	d
�Z$dd�Z%d
d�Z&Gdd�d�Z'dd�Z(dd�Z)da*dd�Z+dd�Z,dd�Z-dd�Z.dd�Z/dd �Z0da1d!d"�Z2d#d$�Z3d%d&�Z4dBd(d)�Z5dCd*d+�Z6d,e"dfd-d.�Z7Gd/d0�d0�Z8Gd1d2�d2�Z9			5dDdd6�d7d8�Z:ej;d9ks�ej<d:kr�e:Z=need;�a>			dEdd6�d<d=�Z=Gd>d?�d?�Z?Gd@dA�dA�Z@dS)F)
�NamedTemporaryFile�
TemporaryFile�SpooledTemporaryFile�TemporaryDirectory�mkstemp�mkdtemp�mktemp�TMP_MAX�
gettempprefix�tempdir�
gettempdir�gettempprefixb�gettempdirb�N)�Random�
O_NOFOLLOW�O_BINARYri'�tmpcCs&zt�|�WdStyYdSw)NFT)�_os�lstat�OSError)�fn�r�//opt/alt/python310/lib64/python3.10/tempfile.py�_existsLs��rcGs�	d}|D],}|durqt|tj�rt�|�}t|t�r'|tur$td��t}q|tur/td��t}q|durCtdus?ttt�rAtStS|S)Nz1Can't mix bytes and non-bytes in path components.)�
isinstancer�PathLike�fspath�bytes�str�	TypeErrorr
)�argsZreturn_type�argrrr�_infer_return_typeUs&

r"cCsf	t|||�}|dur|�}|dur|turt}nt�t�}|dur-|tur*t�}nt�}||||fS�N)r"r�templater�fsencoderr
)�prefix�suffix�dir�output_typerrr�_sanitize_paramsrs
r*c@s.eZdZ	dZedd��Zdd�Zdd�ZdS)	�_RandomNameSequenceZ%abcdefghijklmnopqrstuvwxyz0123456789_cCs,t��}|t|dd�krt�|_||_|jS)N�_rng_pid)r�getpid�getattr�_RandomZ_rngr,)�selfZcur_pidrrr�rng�s
z_RandomNameSequence.rngcCs|Sr#r�r0rrr�__iter__�sz_RandomNameSequence.__iter__cCsd�|jj|jdd��S)N��)�k)�joinr1�choices�
charactersr2rrr�__next__�sz_RandomNameSequence.__next__N)�__name__�
__module__�__qualname__r9�propertyr1r3r:rrrrr+�s
r+c	Cs�	g}dD]}t�|�}|r|�|�qtjdkr-|�tj�d�tj�d�ddddg�n|�gd	��z
|�t���W|St	t
fyP|�tj�Y|Sw)
N)ZTMPDIRZTEMPZTMP�ntz~\AppData\Local\Tempz%SYSTEMROOT%\Tempzc:\tempzc:\tmpz\tempz\tmp)z/tmpz/var/tmpz/usr/tmp)r�getenv�append�name�extend�path�
expanduser�
expandvars�getcwd�AttributeErrorr�curdir)�dirlistZenvname�dirnamerrr�_candidate_tempdir_list�s&
�

���rLcCs 	t�}t�}|D]~}|tjkrtj�|�}td�D]l}t|�}tj�||�}z0t�	|t
d�}zz
t�|d�Wt�|�nt�|�wWt�
|�nt�
|�w|WSty`Yqty}tjdkrztj�|�rzt�|tj�rzYqYn
ty�Ynwq	ttjd|��)N�d�sblatr?z)No usable temporary directory found in %s)r+rLrrIrD�abspath�range�nextr7�open�_bin_openflags�write�close�unlink�FileExistsError�PermissionErrorrB�isdir�access�W_OKr�FileNotFoundError�_errnoZENOENT)ZnamerrJr(�seqrB�filename�fdrrr�_get_default_tempdir�sD
�����racC�L	tdur$t��ztdurt�aWt��tSWt��tSt��wtSr#)�_name_sequence�
_once_lock�acquirer+�releaserrrr�_get_candidate_names�s�
�rgc
	Cs�	tj�|�}t�}|turttj|�}tt�D]J}t	|�}tj�
||||�}t�d|�z	t�
||d�}	Wn$tyAYqty\tjdkr[tj�|�r[t�|tj�r[Yq�w|	|fSttjd��)Nztempfile.mkstemprNr?z#No usable temporary file name found)rrDrOrgr�mapr%rPrrQr7�_sys�auditrRrWrXrBrYrZr[r]�EEXIST)
r(ZpreZsuf�flagsr)�namesr^rB�filer`rrr�_mkstemp_inner�s0���rocGsR|tjvr||g|�Rddi�dStjdkstj�|�s'||g|�R�dSdS)N�follow_symlinksFr?)r�supports_follow_symlinksrBrD�islink)�funcrDr rrr�_dont_follow_symlinkss

�rtcCs<ztj}Wn	tyYnwt||d�ttj|d�dS)Nr�)r�chflagsrHrt�chmod)rDrvrrr�_resetpermss
�rxcC�	t�t�Sr#)r�fsdecoder$rrrrr	#�
r	cCryr#)rr%r$rrrrr'r{rcCrbr#)r
rdrerarfrrrr�_gettempdir-s�
�r|cC�	t�t��Sr#)rrzr|rrrrr9�rcCr}r#)rr%r|rrrrr
=r~r
FcCs4	t|||�\}}}}|rt}nt}t|||||�Sr#)r*�_text_openflagsrSro)r'r&r(�textr)rlrrrrAsrc	Cs�	t|||�\}}}}t�}|turttj|�}tt�D]F}t|�}tj	�
||||�}t�d|�zt�
|d�W|StyGYqtybtjdkratj	�|�rat�|tj�raYq�wttjd��)Nztempfile.mkdtemprur?z(No usable temporary directory name found)r*rgrrhrr%rPrrQrDr7rirj�mkdirrWrXrBrYrZr[r]rk)r'r&r(r)rmr^rBrnrrrrhs0���
�rr4cCs^	|durt�}t�}tt�D]}t|�}tj�||||�}t|�s(|Sqt	t
jd��)Nz"No usable temporary filename found)rrgrPrrQrrDr7rrWr]rk)r'r&r(rmr^rBrnrrrr�s��rc@sLeZdZ	dZdZddd�Zejdkr ejfdd�Z	d	d
�Z
dSdd�Z	dS)
�_TemporaryFileCloserNFTcCs||_||_||_dSr#)rnrB�delete�r0rnrBr�rrr�__init__�s
z_TemporaryFileCloser.__init__r?cCsX|js(|jdur*d|_z|j��W|jr||j�dSdS|jr'||j�wwdSdS�NT)�close_calledrnrUr�rB)r0rVrrrrU�s
���z_TemporaryFileCloser.closecC�|��dSr#)rUr2rrr�__del__��z_TemporaryFileCloser.__del__cCs|js
d|_|j��dSdSr�)r�rnrUr2rrrrU�s��T)r;r<r=rnr�r�rrBrVrUr�rrrrr��s


r�c@s@eZdZ	ddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)�_TemporaryFileWrapperTcCs$||_||_||_t|||�|_dSr#)rnrBr�r��_closerr�rrrr��sz_TemporaryFileWrapper.__init__cs^|jd}t||�}t|d�r"|�t����fdd��}|j|_|}t|t�s-t|||�|S)Nrn�__call__cs�|i|��Sr#r)r �kwargs�rsrr�func_wrapper�sz7_TemporaryFileWrapper.__getattr__.<locals>.func_wrapper)	�__dict__r.�hasattr�
_functools�wrapsr�r�int�setattr)r0rBrn�ar�rr�r�__getattr__�s



z!_TemporaryFileWrapper.__getattr__cCs|j��|Sr#)rn�	__enter__r2rrrr��s
z_TemporaryFileWrapper.__enter__cCs|j�|||�}|��|Sr#)rn�__exit__rU)r0�exc�value�tb�resultrrrr�sz_TemporaryFileWrapper.__exit__cCs	|j��dSr#)r�rUr2rrrrU	sz_TemporaryFileWrapper.closeccs�|jD]}|VqdSr#)rn)r0�linerrrr3s�
�z_TemporaryFileWrapper.__iter__Nr�)	r;r<r=r�r�r�r�rUr3rrrrr��s
r��w+b���T��errorsc	s�	t����\����t�tjdkr|r�tjO�d|vr"t�|�}d�������fdd�}	z,tj�||||||	d�}
zt|
d|
�}t|d|�}�|_t	|
�|�WWS|
�
���durotjdkrj|sot����)Nr?�bcst������\}�|Sr#)ro)r r`�r(rlrBr)r&r'rr�opener:sz"NamedTemporaryFile.<locals>.opener��	buffering�newline�encodingr�r��buffer�raw)r*rSrrBZO_TEMPORARY�_io�
text_encodingrRr.r�rUrV)�moder�r�r�r'r&r(r�r�r�rnr�rr�rrs4


�
r�posix�cygwin�	O_TMPFILEc	s�	d|vr
t�|�}t����\����t�trTd����fdd�}ztj�||||||d�}	t|	d|	�}
t|
d|
�}
�|
_|	WStyKdaYn	t	ySYnwd�������fdd�}tj�||||||d�}	t|	d|	�}
t|
d|
�}
�|
_|	S)	Nr�cs$�tjBtj@}t��|d���S)NrN)rr��O_CREATrR)r Zflags2)r(r`rlrrr�tszTemporaryFile.<locals>.openerr�r�r�Fc
sJt������\�}zt�|�W�Sty$}zt����d}~wwr#)rorrV�
BaseExceptionrU)r rB�e�r(r`rlr)r&r'rrr��s�
��)
r�r�r*rS�_O_TMPFILE_WORKSrRr.rB�IsADirectoryErrorr)r�r�r�r�r'r&r(r�r�rnr�rr�rrZs@

��
	�rc@seZdZ	dZ			d7dd�dd�Zeej�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zedd��Zedd��Zedd��Zdd�Zdd�Zdd �Zed!d"��Zed#d$��Zed%d&��Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd8d1d2�Zd3d4�Zd5d6�Z dS)9rFrr�r�Nr�c	
	Cs^d|vr
t��|_nt�|�}tjt��||	|d�|_||_d|_||||||||	d�|_dS)Nr�)r�r�r�F)r�r�r'r&r�r�r(r�)r��BytesIO�_filer��
TextIOWrapper�	_max_size�_rolled�_TemporaryFileArgs)
r0�max_sizer�r�r�r�r'r&r(r�rrrr��s

��zSpooledTemporaryFile.__init__cCs4|jrdS|j}|r|��|kr|��dSdSdSr#)r�r��tell�rollover)r0rnr�rrr�_check�s

�zSpooledTemporaryFile._checkcCsv|jrdS|j}tdi|j��}|_|`|��}t|d�r)|j�|���	��n|�|�	��|�
|d�d|_dS)Nr�rTr)r�r�rr�r�r�r�rT�detach�getvalue�seek)r0rnZnewfile�posrrrr��s


zSpooledTemporaryFile.rollovercCs|jjrtd��|S)Nz%Cannot enter context with closed file)r��closed�
ValueErrorr2rrrr��szSpooledTemporaryFile.__enter__cC�|j��dSr#�r�rU�r0r�r�r�rrrr���zSpooledTemporaryFile.__exit__cC�
|j��Sr#)r�r3r2rrrr3��
zSpooledTemporaryFile.__iter__cCr�r#r�r2rrrrU�r�zSpooledTemporaryFile.closecC�|jjSr#)r�r�r2rrrr���zSpooledTemporaryFile.closedcCr�r#)r�r�r2rrrr��r�zSpooledTemporaryFile.encodingcCr�r#)r�r�r2rrrr��r�zSpooledTemporaryFile.errorscCs|��|j��Sr#)r�r��filenor2rrrr��s
zSpooledTemporaryFile.filenocCr�r#)r��flushr2rrrr��r�zSpooledTemporaryFile.flushcCr�r#)r��isattyr2rrrr��r�zSpooledTemporaryFile.isattycCs(z|jjWSty|jdYSw)Nr�)r�r�rHr�r2rrrr��s

�zSpooledTemporaryFile.modecCs z|jjWStyYdSwr#)r�rBrHr2rrrrBs

�zSpooledTemporaryFile.namecCr�r#)r��newlinesr2rrrr�
r�zSpooledTemporaryFile.newlinescG�|jj|�Sr#)r��read�r0r rrrr�r�zSpooledTemporaryFile.readcGr�r#)r��readliner�rrrr�r�zSpooledTemporaryFile.readlinecGr�r#)r��	readlinesr�rrrr�r�zSpooledTemporaryFile.readlinescGr�r#)r�r�r�rrrr�r�zSpooledTemporaryFile.seekcCr�r#)r�r�r2rrrr�r�zSpooledTemporaryFile.tellcCs8|dur|j��dS||jkr|��|j�|�dSr#)r��truncater�r�)r0�sizerrrr� s

zSpooledTemporaryFile.truncatecC�|j}|�|�}|�|�|Sr#)r�rTr�)r0�srn�rvrrrrT(�

zSpooledTemporaryFile.writecCr�r#)r��
writelinesr�)r0�iterablernr�rrrr�.r�zSpooledTemporaryFile.writelines)rr�r�NNNNNr#)!r;r<r=r�r��classmethod�_types�GenericAlias�__class_getitem__r�r�r�r�r3rUr>r�r�r�r�r�r�r�rBr�r�r�r�r�r�r�rTr�rrrrr�sN��







rc@sbeZdZ			ddd�Zeddd��Zeddd��Zd	d
�Zdd�Zd
d�Z	dd�Z
eej�Z
dS)rNFcCs:t|||�|_||_tj||j|jd�|�|jd�|_dS)NzImplicitly cleaning up {!r})�warn_message�
ignore_errors)rrB�_ignore_cleanup_errors�_weakrefZfinalize�_cleanup�format�
_finalizer)r0r'r&r(Zignore_cleanup_errorsrrrr�As
�zTemporaryDirectory.__init__cs"���fdd�}tj�|d�dS)Nc	s�t|dt�rAz/|�krttj�|��t|�z	t�|�WWdSttfy3�j|�d�YnwWdSt	y@YdSwt|dt	�rJdS�sM�dS)Nr�r�)
�
issubclassrXrxrrDrKrVr��_rmtreer\)rsrD�exc_info��clsr�rBrr�onerrorLs&���z+TemporaryDirectory._rmtree.<locals>.onerror)r�)�_shutilZrmtree)r�rBr�r�rr�rr�JszTemporaryDirectory._rmtreecCs|j||d�t�|t�dS�Nr�)r��	_warnings�warn�ResourceWarning)r�rBr�r�rrrr�bszTemporaryDirectory._cleanupcCsd�|jj|j�S)Nz	<{} {!r}>)r��	__class__r;rBr2rrr�__repr__gszTemporaryDirectory.__repr__cCs|jSr#)rBr2rrrr�jszTemporaryDirectory.__enter__cCr�r#)�cleanupr�rrrr�mr�zTemporaryDirectory.__exit__cCs2|j��stj�|j�r|j|j|jd�dSdSr�)r�r�rrD�existsrBr�r�r2rrrr�ps�zTemporaryDirectory.cleanup�NNNF)F)r;r<r=r�r�r�r�r�r�r�r�r�r�r�rrrrr5s
�	rr�)NNN)r�r�NNNNNT)r�r�NNNNN)A�__all__�	functoolsr��warningsr��ior��osrZshutilr��errnor]Zrandomrr/�sysri�typesr��weakrefr��_thread�
allocate_lockZ_allocate_lock�O_RDWRr��O_EXCLrr�rrSrrr$rdrr"r*r+rLrarcrgrortrxr	rr
r|rr
rrrr�r�rrB�platformrr�rrrrrr�<module>s�





	,

'( +?��5
��K

?>