ACC SHELL

Path : /usr/lib/python/
File Upload :
Current File : //usr/lib/python/tempfile.pyo

Ñò
oÄMc@sdZddddddddd	d
g
ZddkZddkZdd
klZyddk	l
ZWn#ej
oddk
l
ZnXyddk
ZWnej
od„ZnXd„ZyddkZWnej
odd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(dd"ede4d)„Z5ei6d*jpei7i8d+jo
e5Z9nd(dd"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/lib/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/lib/python2.6/tempfile.pyR
/s
tO_NOINHERITt
O_NOFOLLOWtO_BINARYi'ttmptlstattstatcCs=yt|ƒ}Wntj
oti‚nX|iƒdS(N(topenRt_osterrortclose(tfntf((s/usr/lib/python2.6/tempfile.pyt_stat\s
cCs0yt|ƒWntij
otSXtSdS(N(R!RRtFalsetTrue(R((s/usr/lib/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.tabcdefghijklmnopqrstuvwxyztABCDEFGHIJKLMNOPQRSTUVWXYZt0123456789_cCs+tƒ|_tƒ|_tii|_dS(N(t_allocate_locktmutext_RandomtrngRtpathtnormcase(tself((s/usr/lib/python2.6/tempfile.pyt__init__wscCs|S(N((R/((s/usr/lib/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/lib/python2.6/tempfile.pytnexts		
+(t__name__t
__module__t__doc__R4R0R1R?(((s/usr/lib/python2.6/tempfile.pyR%ks		cCsg}x5dD]-}ti|ƒ}|o|i|ƒq
q
Wtidjo+tidƒ}|o|i|ƒq¼nDtidjo|iddd	d
gƒn|idd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/lib/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/lib/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/lib/python2.6/tempfile.pyt_get_candidate_namesÍs


c
CsÍtƒ}x«ttƒD]}|iƒ}tii||||ƒ}y9ti||dƒ}t|ƒ|tii	|ƒfSWqt
j
o&}	|	it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/lib/python2.6/tempfile.pyt_mkstemp_innerÛs	

cCstS(sAccessor for tempdir.template.(ttemplate(((s/usr/lib/python2.6/tempfile.pyRñscCsKtdjo:tiƒztdjo
tƒanWdtiƒXntS(sAccessor for tempfile.tempdir.N(RRgRhR6ReR7(((s/usr/lib/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/lib/python2.6/tempfile.pyRs


cCsÆ|djo
tƒ}ntƒ}xŠttƒD]|}|iƒ}tii||||ƒ}yti	|dƒ|SWq0t
j
o&}|it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/lib/python2.6/tempfile.pyR(s


	
cCs‹|djo
tƒ}ntƒ}xOttƒD]A}|iƒ}tii||||ƒ}t	|ƒp|Sq0Wt
ti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/lib/python2.6/tempfile.pyRGs

	

	t_TemporaryFileWrappercBsdeZdZed„Zd„Zd„Zeidjo(ei	Z	d„Z
d„Zd„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/lib/python2.6/tempfile.pyR0ms			cCsP|id}t||ƒ}tt|ƒtdƒƒpt|||ƒn|S(NRni(t__dict__tgetattrt
issubclassttypetsetattr(R/RJRnta((s/usr/lib/python2.6/tempfile.pyt__getattr__ss

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

	

cCs|iƒdS(N(R(R/((s/usr/lib/python2.6/tempfile.pyt__del__•scCs&|ii|||ƒ}|iƒ|S(N(Rnt__exit__R(R/texctvaluettbtresult((s/usr/lib/python2.6/tempfile.pyR‚šs
(
R@RARBR#R0RR€RRJRZRRR‚(((s/usr/lib/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	RqRURRJtO_TEMPORARYRoRXRv(
tmodetbufsizeRrRsR`RxRRRJRn((s/usr/lib/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/lib/python2.6/tempfile.pyRÆs






cBs4eZdZeZddddedd„Zd„Zd„Z	d„Z
d	„Zd
„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/lib/python2.6/tempfile.pyR0ês		cCsD|iodS|i}|o!|iƒ|jo|iƒndS(N(RRttelltrollover(R/RnR’((s/usr/lib/python2.6/tempfile.pyt_checkñs

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

		!		#				%;	#
	

ACC SHELL 2018