tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
M\¬Qc
@s dZddddddddd    d
g
Zd d lZd d lZd d lZd d lm    Z
yd dl m Z Wn!ek
r•d dl m Z nXyd d lZWnek
rÂd„Zn
Xd„Zyd d lZWnek
rûd d lZnXejZejejBejBZeedƒr;eejOZneedƒrZeejOZneZeedƒreejOZneedƒršej Z ndZ dZ!eƒZ"eedƒrÊej#Z$n$eedƒråej%Z$n    d„Z$d„Z&dd.d„ƒYZ'd„Z(d„Z)d a+d„Z,d„Z-d „Z.d a/d!„Z0d"e!d e1d#„Z2d"e!d d$„Z3d"e!d d%„Z4d&d/d'„ƒYZ5d(d d"e!d e6d)„Z7ej8d*ksÔej9j:d+krÝe7Z;nd(d d"e!d d,„Z;dd0d-„ƒ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((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyt _set_cloexec-scCsWytj|tjdƒ}Wntk
r/n$X|tjO}tj|tj|ƒdS(Ni(t_fcntltfcntltF_GETFDtIOErrort
FD_CLOEXECtF_SETFD(R tflags((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR 0s   t O_NOINHERITt
O_NOFOLLOWtO_BINARYi'ttmptlstattstatcCs;yt|ƒ}Wntk
r,tj‚nX|jƒdS(N(topenRt_osterrortclose(tfntf((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyt_stat]s
  cCs.yt|ƒWntjk
r%tSXtSdS(N(R!RRtFalsetTrue(R((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyt_existsds
t_RandomNameSequencecBsFeZdZdddZd„Zed„ƒ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_cCstƒ|_tjj|_dS(N(t_allocate_locktmutexRtpathtnormcase(tself((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyt__init__xs cCsCtjƒ}|t|ddƒkr<tƒ|_||_n|jS(Nt_rng_pid(RtgetpidtgetattrtNonet_Randomt_rngR/(R-tcur_pid((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pytrng|s
   cCs|S(N((R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyt__iter__„scCso|j}|j}|jj}|jƒz#gdD]}||ƒ^q2}Wd|jƒX|jdj|ƒƒS(Nt123456t(R*t
charactersR6tchoicetacquiretreleaseR,tjoin(R-tmtctchoosetdummytletters((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pytnext‡s         
# (    t__name__t
__module__t__doc__R:R.tpropertyR6R7RD(((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR%ls        cCsüg}x3dD]+}tj|ƒ}|r |j|ƒq q Wtjdkrstjdƒ}|r´|j|ƒq´nAtjdkrž|jddd    d
gƒn|jd d d gƒy|jtjƒƒWn*ttjfk
r÷|jtjƒ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(RIRJRK(    RtgetenvtappendtnametextendtgetcwdtAttributeErrorRtcurdir(tdirlisttenvnametdirname((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyt_candidate_tempdir_list”s" c
CsVtƒ}tƒ}t}x!|D]}|tjkrUtjjtjj|ƒƒ}nxàtdƒD]Ò}|j    ƒ}tjj
||ƒ}yutj ||dƒ}zGz2t j |ddt ƒ}|jdƒWdQXWdtj|ƒXWdtj|ƒX|SWqbttfk
r3}    |    jdtjkr4Pq4qbXqbWqWttjd|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€twbtclosefdtblatNis)No usable temporary directory found in %s(R%RXt_text_openflagsRRTR+R,tabspathtxrangeRDR>Rt_ioR"twriteRtunlinktOSErrorRtargst_errnotEEXISTtENOENT(
tnamerRURtdirtseqRPtfilenameR tfpte((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyt_get_default_tempdir°s0             !      cCsGtdkrCtjƒztdkr1tƒanWdtjƒXntS(s7Common setup sequence for all user-callable interfaces.N(t_name_sequenceR2t
_once_lockR<R%R=(((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyt_get_candidate_namesØs 
 c
CsÉtƒ}x§ttƒD]™}|jƒ}tjj||||ƒ}y9tj||dƒ}t|ƒ|tjj    |ƒfSWqt
k
r®}    |    j t j kr¨qn‚qXqWtt j df‚dS(s>Code common to mkstemp, TemporaryFile, and NamedTemporaryFile.i€s#No usable temporary file name foundN(RpR^RRDRR+R>RR R]RbterrnoRdReR(
RhtpretsufRtnamesRiRPtfileR Rl((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyt_mkstemp_inneræs     
 cCstS(sAccessor for tempdir.template.(ttemplate(((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyRüscCsGtdkrCtjƒztdkr1tƒanWdtjƒXntS(sAccessor for tempfile.tempdir.N(RR2RoR<RmR=(((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR    s 
 R9cCs@|dkrtƒ}n|r'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(R2R    R\t_bin_openflagsRv(tsuffixtprefixRhttextR((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyRs       cCsÀ|dkrtƒ}ntƒ}x†ttƒD]x}|jƒ}tjj||||ƒ}ytj    |dƒ|SWq.t
k
r¥}|j t j krŸq.n‚q.Xq.Wtt j 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(R2R    RpR^RRDRR+R>tmkdirRbRqRdReR(RyRzRhRtRiRPRuRl((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR3s        cCs‡|dkrtƒ}ntƒ}xMttƒD]?}|jƒ}tjj||||ƒ}t    |ƒs.|Sq.Wt
t j 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( R2R    RpR^RRDRR+R>R$RRdRe(RyRzRhRtRiRPRu((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyRRs        t_TemporaryFileWrappercBskeZdZed„Zd„Zd„Zejdkr`ej    Z    d„Z
d„Z d„Z n    d„Z RS(    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(RuRPR"t close_calledtdelete(R-RuRPR((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR.xs            cCsN|jd}t||ƒ}tt|ƒtdƒƒsJt|||ƒn|S(NRui(t__dict__R1t
issubclassttypetsetattr(R-RPRuta((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyt __getattr__~s
 cCs|jjƒ|S(N(Rut    __enter__(R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR†Šs RMcCsB|js>t|_|jjƒ|jr>|j|jƒq>ndS(N(R~R#RuRRRaRP(R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR™s
             cCs|jƒdS(N(R(R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyt__del__ scCs&|jj|||ƒ}|jƒ|S(N(Rut__exit__R(R-texctvaluettbtresult((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyRˆ¥s
cCs|jj|||ƒdS(N(RuRˆ(R-R‰RŠR‹((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyRˆªs( RERFRGR#R.R…R†RRPRaRR‡Rˆ(((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR}ps                      sw+bc
Cs˜|dkrtƒ}nd|kr-t}nt}tjdkrX|rX|tjO}nt||||ƒ\}}tj|||ƒ}    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.
    tbRMN(
R2R    RxR\RRPt O_TEMPORARYRvtfdopenR}(
tmodetbufsizeRyRzRhRRR RPRu((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR®s       tposixtcygwincCs|dkrtƒ}nd|kr-t}nt}t||||ƒ\}}y$tj|ƒtj|||ƒSWntj|ƒ‚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(    R2R    RxR\RvRRaRR(RR‘RyRzRhRR RP((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyRÔs         cBseZdZeZddddedd„Zd„Zd„Z    d„Z
d    „Z d
„Z d „Z ed „ƒZd „Zd„Zd„Zed„ƒZed„ƒZd„Zd„Zd„Zd„Zd„Zed„ƒZd„Zd„Zd„Zd„Zd„ZRS(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ÿÿÿÿR9cCs:tƒ|_||_t|_|||||f|_dS(N(t    _StringIOt_filet    _max_sizeR"t_rolledt_TemporaryFileArgs(R-tmax_sizeRR‘RyRzRh((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR.øs         cCs?|jr dS|j}|r;|jƒ|kr;|jƒndS(N(R—R–ttelltrollover(R-RuR™((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyt_checkÿs
        cCsh|jr dS|j}t|jŒ}|_|`|j|jƒƒ|j|jƒdƒt|_dS(Ni(    R—R•RR˜R`tgetvaluetseekRšR#(R-Rutnewfile((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR›s        cCs|jjrtdƒ‚n|S(Ns%Cannot enter context with closed file(R•tclosedt
ValueError(R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR†s cCs|jjƒdS(N(R•R(R-R‰RŠR‹((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyRˆscCs |jjƒS(N(R•R7(R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR7scCs|jjƒdS(N(R•R(R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR"scCs
|jjS(N(R•R (R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR %scCs|jƒ|jjƒS(N(R›R•tfileno(R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR¢)s
cCs|jjƒdS(N(R•tflush(R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR£-scCs |jjƒS(N(R•tisatty(R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR¤0scCs.y|jjSWntk
r)|jdSXdS(Ni(R•RRSR˜(R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR3s cCs'y|jjSWntk
r"dSXdS(N(R•RPRSR2(R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyRP:s cCs
|jjS(N(R•RD(R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyRDAscGs|jj|ŒS(N(R•tread(R-Rc((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR¥DscGs|jj|ŒS(N(R•treadline(R-Rc((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR¦GscGs|jj|ŒS(N(R•t    readlines(R-Rc((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR§JscGs|jj|ŒdS(N(R•Rž(R-Rc((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyRžMscCs
|jjS(N(R•t    softspace(R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR¨PscCs |jjƒS(N(R•Rš(R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyRšTscCs|jjƒdS(N(R•ttruncate(R-((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR©WscCs)|j}|j|ƒ}|j|ƒ|S(N(R•R`Rœ(R-tsRutrv((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR`Zs     cCs)|j}|j|ƒ}|j|ƒ|S(N(R•t
writelinesRœ(R-titerableRuR«((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR¬`s     cGs?y|jj|ŒSWn$tk
r:t|jj|ŒƒSXdS(N(R•t
xreadlinesRStiterR§(R-Rc((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyR®fs N( RERFRGR"R—RwR2R.RœR›R†RˆR7RRHR R¢R£R¤RRPRDR¥R¦R§RžR¨RšR©R`R¬R®(((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyRñs6                                                                            ((((=RGt__all__tioR_tosRRqRdtrandomR
R3t    cStringIOR R”t ImportErrorRRR tthreadt_threadt dummy_threadt allocate_lockR)tO_RDWRtO_CREATtO_EXCLR\thasattrRRRxRRRwRoRR!RR$R%RXRmR2RnRpRvRRR    R"RRRR}R#RRPtsystplatformRR(((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/tempfile.pyt<module>s~                                (        &                 %>    !