ok

Mini Shell

Direktori : /opt/alt/python36/lib64/python3.6/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/__pycache__/tempfile.cpython-36.opt-2.pyc

3

��2a�h�@s.dddddddddd	d
ddg
Zd
dlZd
dlZd
dlZd
dlZd
dl	Z
d
dlZd
dl
mZd
dlZyd
dlZWnek
r�d
dlZYnXejZejejBejBZeed�r�eejOZeZeed�r�eejOZeed�r�ejZndZdZ e�Z!eed��rej"Z#need��rej$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/da0d*d
�Z1d+d�Z2d?d-d�Z3d@d.d�Z4d/e dfd0d�Z5Gd1d2�d2�Z6Gd3d4�d4�Z7dBd8d�Z8ej9d9k�s�ej:j;d:k�r�e8Z<need;�a=dDd<d�Z<Gd=d�d�Z>Gd>d�de?�Z@dS)E�NamedTemporaryFile�
TemporaryFile�SpooledTemporaryFile�TemporaryDirectory�mkstemp�mkdtemp�mktemp�TMP_MAX�
gettempprefix�tempdir�
gettempdir�gettempprefixb�gettempdirb�N)�Random�
O_NOFOLLOW�O_BINARYi'Ztmp�lstat�statcCstj|tj�}tj|�dS)N)�_os�open�O_RDONLY�close)�fn�fd�r�-/opt/alt/python36/lib64/python3.6/tempfile.py�_statTsrcCs*yt|�Wntk
r dSXdSdS)NFT)r�OSError)rrrr�_existsXs
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_typeas

r%cCsdt|||�}|dkr|�}|dkr:|tkr0t}n
tjt�}|dkrX|tkrRt�}nt�}||||fS)N)r%r!�templater�fsencoderr
)�prefix�suffix�dir�output_typerrr�_sanitize_paramsvs
r,c@s,eZdZdZedd��Zdd�Zdd�ZdS)	�_RandomNameSequenceZ%abcdefghijklmnopqrstuvwxyz0123456789_cCs,tj�}|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�}dj|�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]}tj|�}|r
|j|�q
Wtjdkr\|jtjjd�tjjd�ddd	d
g�n|jddd
g�y|jtj��Wn$t	t
fk
r�|jtj�YnX|S)N�TMPDIR�TEMP�TMP�ntz~\AppData\Local\Tempz%SYSTEMROOT%\Tempzc:\tempzc:\tmpz\tempz\tmpz/tmpz/var/tmpz/usr/tmp)rDrErF)r�getenv�append�name�extend�path�
expanduser�
expandvars�getcwd�AttributeErrorr�curdir)�dirlistZenvname�dirnamerrr�_candidate_tempdir_list�s



rTcCs4t�}t�}�x|D�]}|tjkr0tjj|�}x�td�D]�}t|�}tjj||�}y\tj	|t
d�}z<z*tj	|ddd��}|jd�WdQRXWdtj
|�XWdtj|�X|Stk
r�Yq:tk
�rtjdkr�tjj|�r�tj|tj�r�w:PYq:tk
�rPYq:Xq:WqWttjd|��dS)	N�di��wbF)�closefdsblatrGz)No usable temporary directory found in %s)r-rTrrQrL�abspathr=�nextr>r�_bin_openflags�_io�writer�unlink�FileExistsError�PermissionErrorrJ�isdir�access�W_OKr�FileNotFoundError�_errno�ENOENT)ZnamerrRr*�seqrJ�filenamer�fprrr�_get_default_tempdir�s:	
ric
Cs2tdkr.tj�ztdkr t�aWdtj�XtS)N)�_name_sequence�
_once_lock�acquirer-�releaserrrr�_get_candidate_names�s

rnc
Cs�t�}|tkrttj|�}x�tt�D]�}t|�}tjj	||||�}ytj
||d�}	WnRtk
rnw$Yn>tk
r�tj
dkr�tjj|�r�tj|tj�r�w$n�YnX|	tjj|�fSWttjd��dS)Ni�rGz#No usable temporary file name found)rnr �maprr'r=rrYrLr>rr^r_rJr`rarbrXrd�EEXIST)
r*ZpreZsuf�flagsr+�namesrfrJ�filerrrr�_mkstemp_inner�s$rtcCstS)N)r&rrrrr	scCstjt��S)N)rr'r	rrrrrsc
Cs2tdkr.tj�ztdkr t�aWdtj�XtS)N)r
rkrlrirmrrrrr#s

cCstjt��S)N)rr'rrrrrr
/sFcCs2t|||�\}}}}|rt}nt}t|||||�S)N)r,�_text_openflagsrZrt)r)r(r*�textr+rqrrrr3s
cCs�t|||�\}}}}t�}|tkr.ttj|�}x�tt�D]�}t|�}tj	j
||||�}ytj|d�WnRtk
r�w8Yn>t
k
r�tjdkr�tj	j|�r�tj|tj�r�w8n�YnX|SWttjd��dS)Ni�rGz(No usable temporary directory name found)r,rnr rorr'r=rrYrLr>�mkdirr^r_rJr`rarbrdrp)r)r(r*r+rrrfrJrsrrrr[s&
r:cCs`|dkrt�}t�}x:tt�D].}t|�}tjj||||�}t|�s|SqWt	t
jd��dS)Nz"No usable temporary filename found)rrnr=rrYrrLr>rr^rdrp)r)r(r*rrrfrJrsrrrr�sc@sHeZdZdZdZddd�Zejdkr<ejfdd�Z	d	d
�Z
ndd�Z	dS)
�_TemporaryFileCloserNFTcCs||_||_||_dS)N)rsrJ�delete)r2rsrJryrrr�__init__�sz_TemporaryFileCloser.__init__rGcCs>|jr:|jdk	r:d|_z|jj�Wd|jr8||j�XdS)NT)�close_calledrsrryrJ)r2r]rrrr�sz_TemporaryFileCloser.closecCs|j�dS)N)r)r2rrr�__del__�sz_TemporaryFileCloser.__del__cCs|jsd|_|jj�dS)NT)r{rsr)r2rrrr�s)T)r@rArBrsr{rzrrJr]rr|rrrrrx�s



rxc@s>eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)�_TemporaryFileWrapperTcCs$||_||_||_t|||�|_dS)N)rsrJryrx�_closer)r2rsrJryrrrrz�sz_TemporaryFileWrapper.__init__cs^|jd}t||�}t|d�rD|�tj���fdd��}|j|_|}t|t�sZt|||�|S)Nrs�__call__cs
�||�S)Nr)r#�kwargs)�funcrr�func_wrapper�sz7_TemporaryFileWrapper.__getattr__.<locals>.func_wrapper)	�__dict__r0�hasattr�
_functools�wrapsr~r�int�setattr)r2rJrs�ar�r)r�r�__getattr__�s



z!_TemporaryFileWrapper.__getattr__cCs|jj�|S)N)rs�	__enter__)r2rrrr��s
z_TemporaryFileWrapper.__enter__cCs|jj|||�}|j�|S)N)rs�__exit__r)r2�exc�value�tb�resultrrrr��sz_TemporaryFileWrapper.__exit__cCs|jj�dS)N)r~r)r2rrrr�sz_TemporaryFileWrapper.closeccsx|jD]
}|VqWdS)N)rs)r2�linerrrr4sz_TemporaryFileWrapper.__iter__N)T)	r@rArBrzr�r�r�rr4rrrrr}�s
r}�w+b�Tc

Cs�t|||�\}}}}t}	tjdkr0|r0|	tjO}	t||||	|�\}
}y tj|
||||d�}t|||�St	k
r�tj
|�tj|
��YnXdS)NrG)�	buffering�newline�encoding)r,rZrrJZO_TEMPORARYrtr[rr}�
BaseExceptionr]r)
�moder�r�r�r)r(r*ryr+rqrrJrsrrrrs




�posix�cygwin�	O_TMPFILEcCs�t|||�\}}}}t}tr�y$|tjBtj@}	tj||	d�}
Wn*tk
rXdaYnBtk
rjYn0Xyt	j|
||||d�Stj
|
��YnXt|||||�\}
}ytj|�t	j|
||||d�Stj
|
��YnXdS)Ni�F)r�r�r�)
r,rZ�_O_TMPFILE_WORKSrr��O_CREATr�IsADirectoryErrorrr[rrtr])r�r�r�r�r)r(r*r+rqZflags2rrJrrrr=s0






c@s�eZdZdZd7dd�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/�Zd8d0d1�Zd2d3�Zd4d5�ZdS)9rFr�w+br�Nc		CsHd|krtj�|_ntjdd�|_||_d|_|||||||d�|_dS)N�b�
)r�F)r�r�r)r(r�r�r*)r[�BytesIO�_file�StringIO�	_max_size�_rolled�_TemporaryFileArgs)	r2�max_sizer�r�r�r�r)r(r*rrrrz~szSpooledTemporaryFile.__init__cCs,|jr
dS|j}|r(|j�|kr(|j�dS)N)r�r��tell�rollover)r2rsr�rrr�_check�s
zSpooledTemporaryFile._checkcCsN|jr
dS|j}tf|j�}|_|`|j|j��|j|j�d�d|_dS)NrT)r�r�rr�r\�getvalue�seekr�)r2rsZnewfilerrrr��szSpooledTemporaryFile.rollovercCs|jjrtd��|S)Nz%Cannot enter context with closed file)r��closed�
ValueError)r2rrrr��szSpooledTemporaryFile.__enter__cCs|jj�dS)N)r�r)r2r�r�r�rrrr��szSpooledTemporaryFile.__exit__cCs
|jj�S)N)r�r4)r2rrrr4�szSpooledTemporaryFile.__iter__cCs|jj�dS)N)r�r)r2rrrr�szSpooledTemporaryFile.closecCs|jjS)N)r�r�)r2rrrr��szSpooledTemporaryFile.closedcCs8y|jjStk
r2d|jdkr(�|jdSXdS)Nr�r�r�)r�r�rPr�)r2rrrr��szSpooledTemporaryFile.encodingcCs|j�|jj�S)N)r�r��fileno)r2rrrr��szSpooledTemporaryFile.filenocCs|jj�dS)N)r��flush)r2rrrr��szSpooledTemporaryFile.flushcCs
|jj�S)N)r��isatty)r2rrrr��szSpooledTemporaryFile.isattycCs(y|jjStk
r"|jdSXdS)Nr�)r�r�rPr�)r2rrrr��szSpooledTemporaryFile.modecCs"y|jjStk
rdSXdS)N)r�rJrP)r2rrrrJ�szSpooledTemporaryFile.namecCs8y|jjStk
r2d|jdkr(�|jdSXdS)Nr�r�r�)r��newlinesrPr�)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|�dS)N)r�r�)r2r#rrrr��szSpooledTemporaryFile.seekcCs|jjS)N)r��	softspace)r2rrrr��szSpooledTemporaryFile.softspacecCs
|jj�S)N)r�r�)r2rrrr��szSpooledTemporaryFile.tellcCs6|dkr|jj�n||jkr&|j�|jj|�dS)N)r��truncater�r�)r2�sizerrrr��s

zSpooledTemporaryFile.truncatecCs|j}|j|�}|j|�|S)N)r�r\r�)r2�srs�rvrrrr\�s

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

zSpooledTemporaryFile.writelines���)rr�r�NNNNN)N)r@rArBr�rzr�r�r�r�r4rrCr�r�r�r�r�r�rJr�r�r�r�r�r�r�r�r\r�rrrrrws6
		
c@sBeZdZddd�Zedd��Zdd�Zdd	�Zd
d�Zdd
�Z	dS)rNcCs0t|||�|_tj||j|jdj|�d�|_dS)NzImplicitly cleaning up {!r})�warn_message)rrJ�_weakref�finalize�_cleanup�format�
_finalizer)r2r)r(r*rrrrzs
zTemporaryDirectory.__init__cCstj|�tj|t�dS)N)�_shutil�rmtree�	_warnings�warn�ResourceWarning)�clsrJr�rrrr�s
zTemporaryDirectory._cleanupcCsdj|jj|j�S)Nz	<{} {!r}>)r��	__class__r@rJ)r2rrr�__repr__"szTemporaryDirectory.__repr__cCs|jS)N)rJ)r2rrrr�%szTemporaryDirectory.__enter__cCs|j�dS)N)�cleanup)r2r�r�r�rrrr�(szTemporaryDirectory.__exit__cCs|jj�rtj|j�dS)N)r��detachr�r�rJ)r2rrrr�+s
zTemporaryDirectory.cleanup)NNN)
r@rArBrz�classmethodr�r�r�r�r�rrrrrs
)NNNF)NNNr�)r�r�NNNNNTr�)r�r�NNNNN)A�__all__�	functoolsr��warningsr��ior[�osrZshutilr��errnordZrandomrr1�weakrefr��_thread�ImportErrorZ
_dummy_thread�
allocate_lockZ_allocate_lock�O_RDWRr��O_EXCLrur�rrZrrr&rkrrrrr%r,r-rTrirjrnrtr	rr
rr
rrrrxr}rrJ�sys�platformrr�r�objectrrrrr�<module>s�




	-
(
' +?
$

8

Zerion Mini Shell 1.0