Hacked By AnonymousFox

Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/tempfile.cpython-39.opt-2.pyc

a

R�f;m�@s�gd�ZddlZddlZddlZddlZddl	Z
ddlZddl
mZddlZddlZddlZddlZejZejejBejBZeed�r�eejOZeZeed�r�eej 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&d'�Z4dAd(d)�Z5d*e"dfd+d,�Z6Gd-d.�d.�Z7Gd/d0�d0�Z8dBdd4�d5d6�Z9ej:d7k�s�ej;d8k�r�e9Z<need9�a=dCdd4�d:d;�Z<Gd<d=�d=�Z>Gd>d?�d?e?�Z@dS)D)
�NamedTemporaryFile�
TemporaryFile�SpooledTemporaryFile�TemporaryDirectory�mkstemp�mkdtemp�mktemp�TMP_MAX�
gettempprefix�tempdir�
gettempdir�gettempprefixb�gettempdirb�N)�Random�
O_NOFOLLOW�O_BINARYri'�tmpcCs,zt�|�Wnty"YdS0dSdS)NFT)�_os�lstat�OSError)�fn�r�-/opt/alt/python39/lib64/python3.9/tempfile.py�_existsLs
rcGsrd}|D]X}|durqt|tj�r,t�|�}t|t�rL|turFtd��t}q|tur\td��t}q|durntS|S)Nz1Can't mix bytes and non-bytes in path components.)�
isinstancer�PathLike�fspath�bytes�str�	TypeError)�argsZreturn_type�argrrr�_infer_return_typeUs 

r"cCsdt|||�}|dur|�}|dur:|tur0t}n
t�t�}|durX|turRt�}nt�}||||fS�N)r"r�templater�fsencoderr
)�prefix�suffix�dir�output_typerrr�_sanitize_paramsns
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�r0rrr�__iter__�sz_RandomNameSequence.__iter__cs0|j�|jj���fdd�td�D�}d�|�S)Ncsg|]}����qSrr)�.0Zdummy��cZchooserr�
<listcomp>��z0_RandomNameSequence.__next__.<locals>.<listcomp>��)�
charactersr1Zchoice�range�join)r0Zlettersrr5r�__next__�sz_RandomNameSequence.__next__N)�__name__�
__module__�__qualname__r;�propertyr1r3r>rrrrr+�s

r+c	Cs�g}dD]}t�|�}|r|�|�qtjdkrX|�tj�d�tj�d�ddddg�n|�gd	��z|�t���Wn"t	t
fy�|�tj�Yn0|S)
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


�rPcCsht�}t�}|D�]@}|tjkr,tj�|�}td�D�]}t|�}tj�||�}z�t�	|t
d�}zdzHtj	|ddd��}|�d�Wd�n1s�0YWt�
|�nt�
|�0Wt�|�nt�|�0|WSty�Yq4t�y6tjdk�r,tj�|��r,t�|tj��r,Yq4YqYq4t�yNYqYq40q4qttjd|��dS)	N�d��wbF)�closefdsblatrCz)No usable temporary directory found in %s)r+rPrrMrH�abspathr<�nextr=�open�_bin_openflags�_io�write�close�unlink�FileExistsError�PermissionErrorrF�isdir�access�W_OKr�FileNotFoundError�_errnoZENOENT)ZnamerrNr(�seqrF�filename�fd�fprrr�_get_default_tempdir�s@	

*�
��rhcCs:tdur6t��ztdur t�aWt��n
t��0tSr#)�_name_sequence�
_once_lock�acquirer+�releaserrrr�_get_candidate_names�srmc
	Cs�t�}|turttj|�}tt�D]�}t|�}tj�	||||�}t
�d|�zt�||d�}	WnRt
yxYq"Yn>ty�tjdkr�tj�|�r�t�|tj�r�Yq"n�Yn0|	tj�|�fSt
tjd��dS)Nztempfile.mkstemprRrCz#No usable temporary file name found)rmr�maprr%r<rrVrHr=�_sys�auditrWr]r^rFr_r`rarUrc�EEXIST)
r(ZpreZsuf�flagsr)�namesrdrF�filerfrrr�_mkstemp_inner�s*��rucGsL|tjvr"||g|�Rddi�n&tjdks8tj�|�sH||g|�R�dS)N�follow_symlinksFrC)r�supports_follow_symlinksrFrH�islink)�funcrHr rrr�_dont_follow_symlinkss
rzcCs<z
tj}WntyYn0t||d�ttj|d�dS)Nr�)r�chflagsrLrz�chmod)rHr|rrr�_resetpermss
r~cCstSr#)r$rrrrr	"sr	cCst�t��Sr#)rr%r	rrrrr&srcCs:tdur6t��ztdur t�aWt��n
t��0tSr#)r
rjrkrhrlrrrrr,srcCst�t��Sr#)rr%rrrrrr
8sr
FcCs2t|||�\}}}}|rt}nt}t|||||�Sr#)r*�_text_openflagsrXru)r'r&r(�textr)rrrrrr<s
rc	Cs�t|||�\}}}}t�}|tur.ttj|�}tt�D]�}t|�}tj	�
||||�}t�d|�zt�
|d�WnRty�Yq6Yn>ty�tjdkr�tj	�|�r�t�|tj�r�Yq6n�Yn0|Sttjd��dS)Nztempfile.mkdtempr{rCz(No usable temporary directory name found)r*rmrrnrr%r<rrVrHr=rorp�mkdirr]r^rFr_r`rarcrq)r'r&r(r)rsrdrFrtrrrrcs,
��rr:cCs`|durt�}t�}tt�D]2}t|�}tj�||||�}t|�s|Sqt	t
jd��dS)Nz"No usable temporary filename found)rrmr<rrVrrHr=rr]rcrq)r'r&r(rsrdrFrtrrrr�s
�rc@sHeZdZdZdZddd�Zejdkr<ejfdd�Z	d	d
�Z
ndd�Z	dS)
�_TemporaryFileCloserNFTcCs||_||_||_dSr#)rtrF�delete�r0rtrFr�rrr�__init__�sz_TemporaryFileCloser.__init__rCcCsL|jsH|jdurHd|_z|j��W|jrH||j�n|jrF||j�0dS�NT)�close_calledrtr[r�rF)r0r\rrrr[�s�z_TemporaryFileCloser.closecCs|��dSr#)r[r2rrr�__del__�sz_TemporaryFileCloser.__del__cCs|jsd|_|j��dSr�)r�rtr[r2rrrr[�s)T)r?r@rArtr�r�rrFr\r[r�rrrrr��s



r�c@s>eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)�_TemporaryFileWrapperTcCs$||_||_||_t|||�|_dSr#)rtrFr�r��_closerr�rrrr��sz_TemporaryFileWrapper.__init__cs^|jd}t||�}t|d�rD|�t����fdd��}|j|_|}t|t�sZt|||�|S)Nrt�__call__cs�|i|��Sr#r)r �kwargs�ryrr�func_wrapper�sz7_TemporaryFileWrapper.__getattr__.<locals>.func_wrapper)	�__dict__r.�hasattr�
_functools�wrapsr�r�int�setattr)r0rFrt�ar�rr�r�__getattr__�s



z!_TemporaryFileWrapper.__getattr__cCs|j��|Sr#)rt�	__enter__r2rrrr��s
z_TemporaryFileWrapper.__enter__cCs|j�|||�}|��|Sr#)rt�__exit__r[)r0�exc�value�tb�resultrrrr��sz_TemporaryFileWrapper.__exit__cCs|j��dSr#)r�r[r2rrrr[sz_TemporaryFileWrapper.closeccs|jD]
}|VqdSr#)rt)r0�linerrrr3s
z_TemporaryFileWrapper.__iter__N)T)	r?r@rAr�r�r�r�r[r3rrrrr��s
r��w+b���T��errorscCs�t|||�\}}}}	t}
tjdkr0|r0|
tjO}
t||||
|	�\}}z$tj||||||d�}
t|
||�WSt	y�t�
|�t�|��Yn0dS)NrC��	buffering�newline�encodingr�)r*rXrrFZO_TEMPORARYrurYrWr��
BaseExceptionr\r[)�moder�r�r�r'r&r(r�r�r)rrrfrFrtrrrrs

�

r�posix�cygwin�	O_TMPFILEc
Cs�t|||�\}}}}t}	tr�z$|	tjBtj@}
t�||
d�}Wn&tyVdaYnDtyfYn40zt	j||||||d�WSt�
|��Yn0t||||	|�\}}z"t�|�t	j||||||d�WSt�
|��Yn0dS)NrRFr�)
r*rX�_O_TMPFILE_WORKSrr��O_CREATrW�IsADirectoryErrorrrYr[rur\)
r�r�r�r�r'r&r(r�r)rrZflags2rfrFrrrrGs6
�


�
rc@s�eZdZdZd7dd�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	
	CsTd|vrt��|_ntjt��||	|d�|_||_d|_||||||||	d�|_dS)N�b)r�r�r�F)r�r�r'r&r�r�r(r�)rY�BytesIO�_file�
TextIOWrapper�	_max_size�_rolled�_TemporaryFileArgs)
r0�max_sizer�r�r�r�r'r&r(r�rrrr��s
��zSpooledTemporaryFile.__init__cCs,|jr
dS|j}|r(|��|kr(|��dSr#)r�r��tell�rollover)r0rtr�rrr�_check�s
zSpooledTemporaryFile._checkcCsv|jr
dS|j}tfi|j��}|_|`|��}t|d�rR|j�|���	��n|�|�	��|�
|d�d|_dS)N�bufferrT)r�r�rr�r�r�r�rZ�detach�getvalue�seek)r0rtZnewfile�posrrrr��s

zSpooledTemporaryFile.rollovercCs|jjrtd��|S)Nz%Cannot enter context with closed file)r��closed�
ValueErrorr2rrrr��szSpooledTemporaryFile.__enter__cCs|j��dSr#�r�r[�r0r�r�r�rrrr��szSpooledTemporaryFile.__exit__cCs
|j��Sr#)r�r3r2rrrr3�szSpooledTemporaryFile.__iter__cCs|j��dSr#r�r2rrrr[�szSpooledTemporaryFile.closecCs|jjSr#)r�r�r2rrrr��szSpooledTemporaryFile.closedcCs|jjSr#)r�r�r2rrrr��szSpooledTemporaryFile.encodingcCs|jjSr#)r�r�r2rrrr��szSpooledTemporaryFile.errorscCs|��|j��Sr#)r�r��filenor2rrrr��szSpooledTemporaryFile.filenocCs|j��dSr#)r��flushr2rrrr��szSpooledTemporaryFile.flushcCs
|j��Sr#)r��isattyr2rrrr��szSpooledTemporaryFile.isattycCs,z
|jjWSty&|jdYS0dS)Nr�)r�r�rLr�r2rrrr��s
zSpooledTemporaryFile.modecCs$z
|jjWStyYdS0dSr#)r�rFrLr2rrrrF�s
zSpooledTemporaryFile.namecCs|jjSr#)r��newlinesr2rrrr��szSpooledTemporaryFile.newlinescGs|jj|�Sr#)r��read�r0r rrrr��szSpooledTemporaryFile.readcGs|jj|�Sr#)r��readliner�rrrr��szSpooledTemporaryFile.readlinecGs|jj|�Sr#)r��	readlinesr�rrrr��szSpooledTemporaryFile.readlinescGs|jj|�Sr#)r�r�r�rrrr��szSpooledTemporaryFile.seekcCs
|j��Sr#)r�r�r2rrrr��szSpooledTemporaryFile.tellcCs6|dur|j��n||jkr&|��|j�|�dSr#)r��truncater�r�)r0�sizerrrr��s

zSpooledTemporaryFile.truncatecCs|j}|�|�}|�|�|Sr#)r�rZr�)r0�srt�rvrrrrZs

zSpooledTemporaryFile.writecCs|j}|�|�}|�|�|Sr#)r��
writelinesr�)r0�iterablertr�rrrr�s

zSpooledTemporaryFile.writelines)rr�r�NNNNN)N)!r?r@rAr�r��classmethod�_types�GenericAlias�__class_getitem__r�r�r�r�r3r[rBr�r�r�r�r�r�r�rFr�r�r�r�r�r�r�rZr�rrrrr�sJ��







rc@sXeZdZddd�Zedd��Zedd��Zdd	�Zd
d�Zdd
�Z	dd�Z
eej�Z
dS)rNcCs0t|||�|_tj||j|jd�|�d�|_dS)NzImplicitly cleaning up {!r})�warn_message)rrF�_weakrefZfinalize�_cleanup�format�
_finalizer)r0r'r&r(rrrr�s

�zTemporaryDirectory.__init__cs ��fdd�}tj�|d�dS)Nc	s�t|dt�rxzT|�kr(ttj�|��t|�zt�|�Wn ttfy^��|�Yn0Wq�t	ytYq�0nt|dt	�r�n�dS)Nr)
�
issubclassr^r~rrHrOr\r��_rmtreerb)ryrH�exc_info��clsrFrr�onerror&sz+TemporaryDirectory._rmtree.<locals>.onerror)r�)�_shutilZrmtree)r�rFr�rr�rr�$szTemporaryDirectory._rmtreecCs|�|�t�|t�dSr#)r��	_warnings�warn�ResourceWarning)r�rFr�rrrr�;s
zTemporaryDirectory._cleanupcCsd�|jj|j�S)Nz	<{} {!r}>)r��	__class__r?rFr2rrr�__repr__@szTemporaryDirectory.__repr__cCs|jSr#)rFr2rrrr�CszTemporaryDirectory.__enter__cCs|��dSr#)�cleanupr�rrrr�FszTemporaryDirectory.__exit__cCs|j��r|�|j�dSr#)r�r�r�rFr2rrrr�Is
zTemporaryDirectory.cleanup)NNN)r?r@rAr�r�r�r�r�r�r�r�r�r�r�rrrrrs


r)NNNF)NNN)r�r�NNNNNT)r�r�NNNNN)A�__all__�	functoolsr��warningsr��iorY�osrZshutilr��errnorcZrandomrr/�sysro�typesr��weakrefr��_thread�
allocate_lockZ_allocate_lock�O_RDWRr��O_EXCLrr�rrXrrr$rjrr"r*r+rPrhrirmrurzr~r	rr
rr
rrrr�r�rrF�platformrr�r�objectrrrrr�<module>s|





	-
'
( +?��'
��<

Hacked By AnonymousFox1.0, Coded By AnonymousFox