b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 104.21.65.202 | your ip : 10.244.126.0
safemode OFF
 >  / usr / lib64 / python2.6 /
Filename/usr/lib64/python2.6/tempfile.pyc
Size19.11 kb
Permissionrw-r--r--
Ownerapache
Create time23-Dec-2025 17:41
Last modified20-Jun-2019 19:45
Last accessed22-Apr-2026 05:26
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
Ñò
§ÚêLc@sdZddddddddd d
g
Zd d kZd d kZd d
klZyd dk l
Z Wn#e j
od dk
l
Z nXyd d k
ZWne j
od�Zn Xd�Zyd d kZWne j
od d kZnXeiZeieiBeiBZeed�oeeiOZneed�oeeiOZneZeed�oeeiOZneed�o
eiZndZdZe�Z eed�o
ei!Z"n'eed�o
ei#Z"n
d�Z"d�Z$dd.d��YZ%d�Z&d�Z'd a)d�Z*d�Z+d �Z,d a-d!�Z.d"ed e/d#�Z0d"ed d$�Z1d"ed d%�Z2d&d/d'��YZ3d(d d"ed e4d)�Z5ei6d*jpei7i8d+jo
e5Z9nd(d d"ed d,�Z9dd0d-��YZ:d S(1søTemporary files.

This module provides generic, low- and high-level interfaces for
creating temporary files and directories. The interfaces listed
as "safe" just below can be used without fear of race conditions.
Those listed as "unsafe" cannot, and are provided for backward
compatibility only.

This module also provides some data items to the user:

TMP_MAX - maximum number of names that will be tried before
giving up.
template - the default prefix for all temporary names.
You may change this to control the default prefix.
tempdir - If this is set to a string before the first use of
any routine from this module, it will be considered as
another candidate location to store temporary files.
tNamedTemporaryFilet
TemporaryFiletSpooledTemporaryFiletmkstemptmkdtemptmktemptTMP_MAXt
gettempprefixttempdirt
gettempdiriÿÿÿÿN(tRandom(tStringIOcCsdS(N((tfd((s /usr/lib64/python2.6/tempfile.pyt _set_cloexec,scCsYyti|tid�}Wntj
on%X|tiO}ti|ti|�dS(Ni(t_fcntltfcntltF_GETFDtIOErrort
FD_CLOEXECtF_SETFD(R tflags((s /usr/lib64/python2.6/tempfile.pyR
/s 
t O_NOINHERITt
O_NOFOLLOWtO_BINARYi'ttmptlstattstatcCs=yt|�}Wntj
oti�nX|i�dS(N(topenRt_osterrortclose(tfntf((s /usr/lib64/python2.6/tempfile.pyt_stat\s
cCs0yt|�Wntij
otSXtSdS(N(R!RRtFalsetTrue(R((s /usr/lib64/python2.6/tempfile.pyt_existscs
t_RandomNameSequencecBs7eZdZdddZd�Zd�Zd�ZRS(s*An instance of _RandomNameSequence generates an endless
sequence of unpredictable strings which can safely be incorporated
into file names. Each string is six characters long. Multiple
threads can safely use the same instance at the same time.

_RandomNameSequence is an iterator.tabcdefghijklmnopqrstuvwxyztABCDEFGHIJKLMNOPQRSTUVWXYZt 0123456789_cCs+t�|_t�|_tii|_dS(N(t_allocate_locktmutext_RandomtrngRtpathtnormcase(tself((s /usr/lib64/python2.6/tempfile.pyt__init__ws  cCs|S(N((R/((s /usr/lib64/python2.6/tempfile.pyt__iter__|scCsw|i}|i}|ii}|i�z+g}dD]}|||�q6~}Wd|i�X|idi|��S(Nt123456t(R*t
charactersR,tchoicetacquiretreleaseR.tjoin(R/tmtctchooset_[1]tdummytletters((s /usr/lib64/python2.6/tempfile.pytnexts   
+ (t__name__t
__module__t__doc__R4R0R1R?(((s /usr/lib64/python2.6/tempfile.pyR%ks   cCsg}x5dD]-}ti|�}|o|i|�q
q
Wtidjo+tid�}|o|i|�q¼nDtidjo|iddd d
g�n|id d d
g�y|iti��Wn,ttifj
o|iti�nX|S(s[Generate a list of candidate temporary directories which
_get_default_tempdir will try.tTMPDIRtTEMPtTMPtriscoss
Wimp$ScrapDirtntsc:\tempsc:\tmps\temps\tmps/tmps/var/tmps/usr/tmp(RCRDRE( RtgetenvtappendtnametextendtgetcwdtAttributeErrorRtcurdir(tdirlisttenvnametdirname((s /usr/lib64/python2.6/tempfile.pyt_candidate_tempdir_list�s$c
Cs=t�}t�}t}x|D]}|tijo"tiitii|��}nxÅtd�D]·}|i �}tii
||�}yYti ||d�}ti |d�}|i
d�|i�ti|�~~|SWqdttfj
o"} | dtijoPqqdXqdWqWttid|f�dS(sqCalculate the default directory to use for temporary files.
This routine should be called exactly once.

We determine whether or not a candidate temp dir is usable by
trying to create and write to a file in that directory. If this
is successful, the test file is deleted. To prevent denial of
service, the name of the test file must be randomized.idi�twtblatis)No usable temporary directory found in %sN(R%RRt_text_openflagsRRNR-R.tabspathtxrangeR?R8RtfdopentwriteRtunlinktOSErrorRt_errnotEEXISTtENOENT(
tnamerRORtdirtseqRJtfilenameR tfpte((s /usr/lib64/python2.6/tempfile.pyt_get_default_tempdir¨s2  "
 



 cCsKtdjo:ti�ztdjo
t�anWdti�XntS(s7Common setup sequence for all user-callable interfaces.N(t_name_sequencetNonet
_once_lockR6R%R7(((s /usr/lib64/python2.6/tempfile.pyt_get_candidate_namesÍs


c
CsÍt�}x«tt�D]�}|i�}tii||||�}y9ti||d�}t|�|tii |�fSWqt
j
o&} | i t i
joqn�qXqWtt i
df�dS(s>Code common to mkstemp, TemporaryFile, and NamedTemporaryFile.i�s#No usable temporary file name foundN(RiRWRR?RR-R8RR
RVR[terrnoR\R]R(
R`tpretsufRtnamesRaRJtfileR Rd((s /usr/lib64/python2.6/tempfile.pyt_mkstemp_innerÛs 
 
 cCstS(sAccessor for tempdir.template.(ttemplate(((s /usr/lib64/python2.6/tempfile.pyRñscCsKtdjo:ti�ztdjo
t�anWdti�XntS(sAccessor for tempfile.tempdir.N(RRgRhR6ReR7(((s /usr/lib64/python2.6/tempfile.pyR ÷s


R3cCsD|djo
t�}n|o
t}nt}t||||�S(s'User-callable function to create and return a unique temporary
file. The return value is a pair (fd, name) where fd is the
file descriptor returned by os.open, and name is the filename.

If 'suffix' is specified, the file name will end with that suffix,
otherwise there will be no suffix.

If 'prefix' is specified, the file name will begin with that prefix,
otherwise a default prefix is used.

If 'dir' is specified, the file will be created in that directory,
otherwise a default directory is used.

If 'text' is specified and true, the file is opened in text
mode. Else (the default) the file is opened in binary mode. On
some operating systems, this makes no difference.

The file is readable and writable only by the creating user ID.
If the operating system uses permission bits to indicate whether a
file is executable, the file is executable by no one. The file
descriptor is not inherited by children of this process.

Caller is responsible for deleting the file when done with it.
N(RgR RUt_bin_openflagsRo(tsuffixtprefixR`ttextR((s /usr/lib64/python2.6/tempfile.pyRs 


cCsÆ|djo
t�}nt�}x�tt�D]|}|i�}tii||||�}yti |d�|SWq0t
j
o&}|i t i
joq0n�q0Xq0Wtt i
df�dS(sUser-callable function to create and return a unique temporary
directory. The return value is the pathname of the directory.

Arguments are as for mkstemp, except that the 'text' argument is
not accepted.

The directory is readable, writable, and searchable only by the
creating user.

Caller is responsible for deleting the directory when done with it.
iÀs(No usable temporary directory name foundN(RgR RiRWRR?RR-R8tmkdirR[RjR\R]R(RrRsR`RmRaRJRnRd((s /usr/lib64/python2.6/tempfile.pyR(s


 
  cCs�|djo
t�}nt�}xOtt�D]A}|i�}tii||||�}t |�p|Sq0Wt
t i df�dS(s�User-callable function to return a unique temporary file name. The
file is not created.

Arguments are as for mkstemp, except that the 'text' argument is
not accepted.

This function is unsafe and should not be used. The file name
refers to a file that did not exist at some point, but by the time
you get around to creating it, someone else may have beaten you to
the punch.
s"No usable temporary filename foundN(
RgR RiRWRR?RR-R8R$RR\R](RrRsR`RmRaRJRn((s /usr/lib64/python2.6/tempfile.pyRGs

 
 
 t_TemporaryFileWrappercBsdeZdZed�Zd�Zd�Zeidjo(ei Z d�Z
d�Z d�Z nRS(sÄTemporary file wrapper

This class provides a wrapper around files opened for
temporary use. In particular, it seeks to automatically
remove the file when it is no longer needed.
cCs(||_||_t|_||_dS(N(RnRJR"t close_calledtdelete(R/RnRJRx((s /usr/lib64/python2.6/tempfile.pyR0ms   cCsP|id}t||�}tt|�td��pt|||�n|S(NRni(t__dict__tgetattrt
issubclassttypetsetattr(R/RJRnta((s /usr/lib64/python2.6/tempfile.pyt __getattr__ss

cCs|ii�|S(N(Rnt __enter__(R/((s /usr/lib64/python2.6/tempfile.pyR�s
RGcCsF|ip8t|_|ii�|io|i|i�qBndS(N(RwR#RnRRxRZRJ(R/((s /usr/lib64/python2.6/tempfile.pyR�s

 

cCs|i�dS(N(R(R/((s /usr/lib64/python2.6/tempfile.pyt__del__�scCs&|ii|||�}|i�|S(N(Rnt__exit__R(R/texctvaluettbtresult((s /usr/lib64/python2.6/tempfile.pyR��s
(
R@RARBR#R0RR�RRJRZRR�R�(((s /usr/lib64/python2.6/tempfile.pyRves     sw+bc
Cs�|djo
t�}nd|jo
t}nt}tidjo|o|tiO}nt||||�\}}ti|||�} t | ||�S(s6Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to os.fdopen (default "w+b").
'bufsize' -- the buffer size argument to os.fdopen (default -1).
'delete' -- whether the file is deleted on close (default True).
The file is created as mkstemp() would do it.

Returns an object with a file-like interface; the name of the file
is accessible as file.name. The file will be automatically deleted
when it is closed unless the 'delete' argument is set to False.
tbRGN(
RgR RqRURRJt O_TEMPORARYRoRXRv(
tmodetbufsizeRrRsR`RxRR RJRn((s /usr/lib64/python2.6/tempfile.pyR s



tposixtcygwincCs�|djo
t�}nd|jo
t}nt}t||||�\}}y$ti|�ti|||�SWnti|��nXdS(s¶Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to os.fdopen (default "w+b").
'bufsize' -- the buffer size argument to os.fdopen (default -1).
The file is created as mkstemp() would do it.

Returns an object with a file-like interface. The file has no
name, and will cease to exist when it is closed.
R�N( RgR RqRURoRRZRXR(R�R�RrRsR`RR RJ((s /usr/lib64/python2.6/tempfile.pyRÆs






cBs4eZdZeZddddedd�Zd�Zd�Z d�Z
d �Z d
�Z d �Z
ed ��Zed
��Zd�Zd�Zd�Zed��Zed��Zed��Zd�Zd�Zd�Zd�Zd�Zed��Zd�Zd�Zd�Zd�Z d�Z!RS( s�Temporary file wrapper, specialized to switch from
StringIO to a real file when it exceeds a certain size or
when a fileno is needed.
isw+biÿÿÿÿR3cCs:t�|_||_t|_|||||f|_dS(N(t _StringIOt_filet _max_sizeR"t_rolledt_TemporaryFileArgs(R/tmax_sizeR�R�RrRsR`((s /usr/lib64/python2.6/tempfile.pyR0ês   cCsD|iodS|i}|o!|i�|jo|i�ndS(N(R�R�ttelltrollover(R/RnR�((s /usr/lib64/python2.6/tempfile.pyt_checkñs

 cCsj|iodS|i}t|i�}|_|`|i|i��|i|i�d�t|_dS(Ni( R�R�RR�RYtgetvaluetseekR�R#(R/Rntnewfile((s /usr/lib64/python2.6/tempfile.pyR�÷s
 cCs!|iiotd��n|S(Ns%Cannot enter context with closed file(R�tclosedt
ValueError(R/((s /usr/lib64/python2.6/tempfile.pyR�s
cCs|ii�dS(N(R�R(R/R�R�R�((s /usr/lib64/python2.6/tempfile.pyR�
scCs
|ii�S(N(R�R1(R/((s /usr/lib64/python2.6/tempfile.pyR1scCs|ii�dS(N(R�R(R/((s /usr/lib64/python2.6/tempfile.pyRscCs
|iiS(N(R�R�(R/((s /usr/lib64/python2.6/tempfile.pyR�scCs
|iiS(N(R�tencoding(R/((s /usr/lib64/python2.6/tempfile.pyR�scCs|i�|ii�S(N(R�R�tfileno(R/((s /usr/lib64/python2.6/tempfile.pyR�s
cCs|ii�dS(N(R�tflush(R/((s /usr/lib64/python2.6/tempfile.pyR�#scCs
|ii�S(N(R�tisatty(R/((s /usr/lib64/python2.6/tempfile.pyR�&scCs
|iiS(N(R�R�(R/((s /usr/lib64/python2.6/tempfile.pyR�)scCs
|iiS(N(R�RJ(R/((s /usr/lib64/python2.6/tempfile.pyRJ-scCs
|iiS(N(R�tnewlines(R/((s /usr/lib64/python2.6/tempfile.pyR�1scCs
|iiS(N(R�R?(R/((s /usr/lib64/python2.6/tempfile.pyR?5scGs|ii|�S(N(R�tread(R/targs((s /usr/lib64/python2.6/tempfile.pyR 8scGs|ii|�S(N(R�treadline(R/R¡((s /usr/lib64/python2.6/tempfile.pyR¢;scGs|ii|�S(N(R�t readlines(R/R¡((s /usr/lib64/python2.6/tempfile.pyR£>scGs|ii|�dS(N(R�R�(R/R¡((s /usr/lib64/python2.6/tempfile.pyR�AscCs
|iiS(N(R�t softspace(R/((s /usr/lib64/python2.6/tempfile.pyR¤DscCs
|ii�S(N(R�R�(R/((s /usr/lib64/python2.6/tempfile.pyR�HscCs|ii�dS(N(R�ttruncate(R/((s /usr/lib64/python2.6/tempfile.pyR¥KscCs)|i}|i|�}|i|�|S(N(R�RYR�(R/tsRntrv((s /usr/lib64/python2.6/tempfile.pyRYNs 
cCs)|i}|i|�}|i|�|S(N(R�t
writelinesR�(R/titerableRnR§((s /usr/lib64/python2.6/tempfile.pyR¨Ts 
cGs|ii|�S(N(R�t
xreadlines(R/R¡((s /usr/lib64/python2.6/tempfile.pyRªZsN("R@RARBR"R�RpRgR0R�R�R�R�R1RtpropertyR�R�R�R�R�R�RJR�R?R R¢R£R�R¤R�R¥RYR¨Rª(((s /usr/lib64/python2.6/tempfile.pyRãs:                   ((((;RBt__all__tosRRjR\trandomR
R+t cStringIOR R�t ImportErrorRRR
tthreadt_threadt dummy_threadt
allocate_lockR)tO_RDWRtO_CREATtO_EXCLRUthasattrRRRqRRRpRhRR!RR$R%RRReRgRfRiRoRRR R"RRRRvR#RRJtsystplatformRR(((s /usr/lib64/python2.6/tempfile.pyt<module>s|     
 

  !  #    %; #