/usr/lib/python3.10/__pycache__
NameSizeModeActions
abc.cpython-310.pyc67510644editdlrm
aifc.cpython-310.pyc246850644editdlrm
antigravity.cpython-310.pyc8220644editdlrm
argparse.cpython-310.pyc635390644editdlrm
ast.cpython-310.pyc557390644editdlrm
asynchat.cpython-310.pyc70250644editdlrm
asyncore.cpython-310.pyc160020644editdlrm
base64.cpython-310.pyc171620644editdlrm
bdb.cpython-310.pyc258320644editdlrm
binhex.cpython-310.pyc128700644editdlrm
bisect.cpython-310.pyc25880644editdlrm
bz2.cpython-310.pyc108700644editdlrm
calendar.cpython-310.pyc263030644editdlrm
cgi.cpython-310.pyc267230644editdlrm
cgitb.cpython-310.pyc99980644editdlrm
chunk.cpython-310.pyc48600644editdlrm
cmd.cpython-310.pyc127070644editdlrm
code.cpython-310.pyc99570644editdlrm
codecs.cpython-310.pyc332190644editdlrm
codeop.cpython-310.pyc55950644editdlrm
colorsys.cpython-310.pyc32650644editdlrm
compileall.cpython-310.pyc127330644editdlrm
configparser.cpython-310.pyc454580644editdlrm
contextlib.cpython-310.pyc208950644editdlrm
contextvars.cpython-310.pyc2460644editdlrm
copy.cpython-310.pyc69960644editdlrm
copyreg.cpython-310.pyc46830644editdlrm
cProfile.cpython-310.pyc51130644editdlrm
crypt.cpython-310.pyc35500644editdlrm
csv.cpython-310.pyc117980644editdlrm
dataclasses.cpython-310.pyc265780644editdlrm
datetime.cpython-310.pyc565330644editdlrm
decimal.cpython-310.pyc3620644editdlrm
difflib.cpython-310.pyc589050644editdlrm
dis.cpython-310.pyc156560644editdlrm
doctest.cpython-310.pyc761750644editdlrm
enum.cpython-310.pyc260630644editdlrm
filecmp.cpython-310.pyc87490644editdlrm
fileinput.cpython-310.pyc140720644editdlrm
fnmatch.cpython-310.pyc42440644editdlrm
fractions.cpython-310.pyc186000644editdlrm
ftplib.cpython-310.pyc290340644editdlrm
functools.cpython-310.pyc283350644editdlrm
genericpath.cpython-310.pyc39070644editdlrm
getopt.cpython-310.pyc63390644editdlrm
getpass.cpython-310.pyc42100644editdlrm
gettext.cpython-310.pyc182210644editdlrm
glob.cpython-310.pyc58520644editdlrm
graphlib.cpython-310.pyc76160644editdlrm
gzip.cpython-310.pyc185460644editdlrm
hashlib.cpython-310.pyc68450644editdlrm
heapq.cpython-310.pyc138650644editdlrm
hmac.cpython-310.pyc69730644editdlrm
imaplib.cpython-310.pyc423120644editdlrm
imghdr.cpython-310.pyc39050644editdlrm
imp.cpython-310.pyc97860644editdlrm
inspect.cpython-310.pyc851530644editdlrm
io.cpython-310.pyc36630644editdlrm
ipaddress.cpython-310.pyc626700644editdlrm
keyword.cpython-310.pyc9270644editdlrm
linecache.cpython-310.pyc41420644editdlrm
locale.cpython-310.pyc461540644editdlrm
lzma.cpython-310.pyc121000644editdlrm
mailbox.cpython-310.pyc600910644editdlrm
mailcap.cpython-310.pyc73200644editdlrm
mimetypes.cpython-310.pyc176190644editdlrm
modulefinder.cpython-310.pyc161660644editdlrm
netrc.cpython-310.pyc39330644editdlrm
nntplib.cpython-310.pyc316230644editdlrm
ntpath.cpython-310.pyc147040644editdlrm
nturl2path.cpython-310.pyc17470644editdlrm
numbers.cpython-310.pyc118660644editdlrm
opcode.cpython-310.pyc54470644editdlrm
operator.cpython-310.pyc135080644editdlrm
optparse.cpython-310.pyc477540644editdlrm
os.cpython-310.pyc315990644editdlrm
pathlib.cpython-310.pyc420520644editdlrm
pdb.cpython-310.pyc474400644editdlrm
pickle.cpython-310.pyc468820644editdlrm
pickletools.cpython-310.pyc677600644editdlrm
pipes.cpython-310.pyc77690644editdlrm
pkgutil.cpython-310.pyc183610644editdlrm
platform.cpython-310.pyc274290644editdlrm
plistlib.cpython-310.pyc237650644editdlrm
poplib.cpython-310.pyc135730644editdlrm
posixpath.cpython-310.pyc105600644editdlrm
pprint.cpython-310.pyc178750644editdlrm
profile.cpython-310.pyc143910644editdlrm
pstats.cpython-310.pyc236210644editdlrm
pty.cpython-310.pyc41430644editdlrm
pyclbr.cpython-310.pyc97750644editdlrm
pydoc.cpython-310.pyc856450644editdlrm
py_compile.cpython-310.pyc73390644editdlrm
queue.cpython-310.pyc107920644editdlrm
quopri.cpython-310.pyc57940644editdlrm
random.cpython-310.pyc227480644editdlrm
re.cpython-310.pyc142270644editdlrm
reprlib.cpython-310.pyc52500644editdlrm
rlcompleter.cpython-310.pyc59540644editdlrm
runpy.cpython-310.pyc94110644editdlrm
sched.cpython-310.pyc61150644editdlrm
secrets.cpython-310.pyc21750644editdlrm
selectors.cpython-310.pyc171050644editdlrm
shelve.cpython-310.pyc94920644editdlrm
shlex.cpython-310.pyc77820644editdlrm
shutil.cpython-310.pyc385360644editdlrm
signal.cpython-310.pyc29350644editdlrm
site.cpython-310.pyc179220644editdlrm
sitecustomize.cpython-310.pyc2250644editdlrm
smtpd.cpython-310.pyc261470644editdlrm
smtplib.cpython-310.pyc357660644editdlrm
sndhdr.cpython-310.pyc69620644editdlrm
socket.cpython-310.pyc289630644editdlrm
socketserver.cpython-310.pyc253470644editdlrm
sre_compile.cpython-310.pyc151940644editdlrm
sre_constants.cpython-310.pyc63570644editdlrm
sre_parse.cpython-310.pyc217550644editdlrm
ssl.cpython-310.pyc452710644editdlrm
stat.cpython-310.pyc42730644editdlrm
statistics.cpython-310.pyc370510644editdlrm
string.cpython-310.pyc71020644editdlrm
stringprep.cpython-310.pyc170750644editdlrm
struct.cpython-310.pyc3070644editdlrm
subprocess.cpython-310.pyc447410644editdlrm
sunau.cpython-310.pyc164820644editdlrm
symtable.cpython-310.pyc128350644editdlrm
sysconfig.cpython-310.pyc181510644editdlrm
tabnanny.cpython-310.pyc69500644editdlrm
tarfile.cpython-310.pyc715780644editdlrm
telnetlib.cpython-310.pyc185060644editdlrm
tempfile.cpython-310.pyc273390644editdlrm
textwrap.cpython-310.pyc138120644editdlrm
this.cpython-310.pyc12640644editdlrm
threading.cpython-310.pyc449690644editdlrm
timeit.cpython-310.pyc117690644editdlrm
token.cpython-310.pyc27380644editdlrm
tokenize.cpython-310.pyc171940644editdlrm
trace.cpython-310.pyc198700644editdlrm
traceback.cpython-310.pyc217120644editdlrm
tracemalloc.cpython-310.pyc175250644editdlrm
tty.cpython-310.pyc10790644editdlrm
turtle.cpython-310.pyc1288570644editdlrm
types.cpython-310.pyc95250644editdlrm
typing.cpython-310.pyc852770644editdlrm
uu.cpython-310.pyc38670644editdlrm
uuid.cpython-310.pyc224980644editdlrm
warnings.cpython-310.pyc136460644editdlrm
wave.cpython-310.pyc175940644editdlrm
weakref.cpython-310.pyc203430644editdlrm
webbrowser.cpython-310.pyc174630644editdlrm
xdrlib.cpython-310.pyc78800644editdlrm
zipapp.cpython-310.pyc60130644editdlrm
zipfile.cpython-310.pyc618450644editdlrm
zipimport.cpython-310.pyc170330644editdlrm
_aix_support.cpython-310.pyc28790644editdlrm
_bootsubprocess.cpython-310.pyc22940644editdlrm
_collections_abc.cpython-310.pyc329250644editdlrm
_compat_pickle.cpython-310.pyc58720644editdlrm
_compression.cpython-310.pyc45120644editdlrm
_distutils_system_mod.cpython-310.pyc54220644editdlrm
_markupbase.cpython-310.pyc75720644editdlrm
_osx_support.cpython-310.pyc115350644editdlrm
_pydecimal.cpython-310.pyc1577360644editdlrm
_pyio.cpython-310.pyc736540644editdlrm
_py_abc.cpython-310.pyc46830644editdlrm
_sitebuiltins.cpython-310.pyc35470644editdlrm
_strptime.cpython-310.pyc159450644editdlrm
_sysconfigdata__linux_x86_64-linux-gnu.cpython-310.pyc353850644editdlrm
_sysconfigdata__x86_64-linux-gnu.cpython-310.pyc353790644editdlrm
_threading_local.cpython-310.pyc65390644editdlrm
_weakrefset.cpython-310.pyc76080644editdlrm
__future__.cpython-310.pyc41310644editdlrm
__phello__.foo.cpython-310.pyc1300644editdlrm
Edit: /usr/lib/python3.10/__pycache__/tempfile.cpython-310.pyc (27339B)
o 9j@sdZgdZddlZddlZddlZddlZ z ddl Z e j Z Wn7eyVddlZddlZddZddZe je je je jhe jkoNe je jvoNe je jvZdId d Z YnwddlZdd lm Z!ddlZddl"Z#ddl$Z%ddl&Z&e&j'Z(e j)e j*Be j+BZ,e-e d re,e j.OZ,e,Z/e-e d re/e j0OZ/e-e dre j1Z1ndZ1dZ2e(Z3ddZ4ddZ5ddZ6GdddZ7ddZ8ddZ9da:ddZ;dd Zd%d&Z?d'd(Z@daAd)d*ZBd+d,ZCd-d.ZDdJd/d0ZEdKd1d2ZFd3e2dfd4d5ZGGd6d7d7ZHGd8d9d9ZI   d?ZJe jKd@ksejLdAkr eJZMne-e dBaN   dMdd=dCdDZMGdEdFdFZOGdGdHdHZPdS)NaTemporary files. This module provides generic, low- and high-level interfaces for creating temporary files and directories. All of the interfaces provided by this module can be used without fear of race conditions except for 'mktemp'. 'mktemp' is subject to race conditions and should not be used; it is provided for backward compatibility only. The default path names are returned as str. If you supply bytes as input, all return values will be in bytes. Ex: >>> tempfile.mkstemp() (4, '/tmp/tmptpu9nin8') >>> tempfile.mkdtemp(suffix=b'') b'/tmp/tmppbi8f0hy' This module also provides some data items to the user: TMP_MAX - maximum number of names that will be tried before giving up. 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. ) NamedTemporaryFile TemporaryFileSpooledTemporaryFileTemporaryDirectorymkstempmkdtempmktempTMP_MAX gettempprefixtempdir gettempdirgettempprefixb gettempdirbNc Cs:z tj|r tdWnty |tjj|tYdSwg}zt|}Wnty<|tj|tYnw|D]A}tj||}zt|j }Wn ty[d}Ynwt |rgt ||q?zt |Wq?ty|tj |tYq?wzt|WdSty|tj|tYdSw)N%Cannot call rmtree on a symbolic linkr)_ospathislinkOSError_sysexc_infolistdirjoinlstatst_mode_statS_ISDIR_rmtree_unsafeunlinkrmdir)ronerrornamesnamefullnamemoder$/usr/lib/python3.10/tempfile.pyr2sB        rc Csg}zt|}Wnty'}z||_|tj|tWYd}~nd}~ww|D]}tj||}z tj||dd}|j }Wn tyKd}Ynwt |rz tj |tj |d} Wntyn|tj |tYq*wzKtj|t| rt| ||z tj||dWn*ty|tj|tYnwztdty|tjj|tYnwWt| q*t| wz tj||dWq*ty|tj|tYq*wdS)NF)dir_fdfollow_symlinksr)r&r)rrrfilenamerrrrstatrrropenO_RDONLYsamestatfstat_rmtree_safe_fdrrcloser) topfdrrr errr!r"orig_str#dirfdr$r$r%r.SsV        r.Fc Csr|rdd}n|durdd}trt|trt|}zt|}Wnty5|tj|tYdSwz t |tj }WntyR|tj|tYdSwzZtj |t |r~t|||zt|Wn*ty}|tj|tYn!wztdty|tj j|tYnwWt|dSWt|dSWt|dSt|wt||S)aRecursively delete a directory tree. If ignore_errors is set, errors are ignored; otherwise, if onerror is set, it is called to handle the error with arguments (func, path, exc_info) where func is platform and implementation dependent; path is the argument to that function that caused it to fail; and exc_info is a tuple returned by sys.exc_info(). If ignore_errors is false and onerror is None, an exception is raised. cWsdSNr$argsr$r$r%rz_rmtree..onerrorNcWsr4r$r5r$r$r%rsr)_use_fd_functions isinstancebytesrfsdecoder Exceptionrrr*r+rr,r-r.rrrr/r)r ignore_errorsrr2fdr$r$r%_rmtreesN          r?)Random O_NOFOLLOWO_BINARYri'tmpcCs&zt|WdStyYdSw)NFT)rrr)fnr$r$r%_existss   rEcGsd}|D],}|dur qt|tjrt|}t|tr&|tur#tdt}q|tur.tdt}q|durBtdus>tttr@tStS|S)zBLook at the type of all args and divine their implied return type.Nz1Can't mix bytes and non-bytes in path components.)r9rPathLikefspathr:str TypeErrorr )r6 return_typeargr$r$r%_infer_return_types$   rLcCsdt|||}|dur |}|dur|turt}ntt}|dur,|tur)t}nt}||||fS)z9Common parameter processing for most APIs in this module.N)rLrHtemplaterfsencoder r )prefixsuffixdir output_typer$r$r%_sanitize_paramss   rSc@s0eZdZdZdZeddZddZddZd S) _RandomNameSequencea,An instance of _RandomNameSequence generates an endless sequence of unpredictable strings which can safely be incorporated into file names. Each string is eight characters long. Multiple threads can safely use the same instance at the same time. _RandomNameSequence is an iterator.%abcdefghijklmnopqrstuvwxyz0123456789_cCs,t}|t|ddkrt|_||_|jS)N_rng_pid)rgetpidgetattr_Random_rngrV)selfcur_pidr$r$r%rngs z_RandomNameSequence.rngcCs|Sr4r$r[r$r$r%__iter__!r7z_RandomNameSequence.__iter__cCsd|jj|jddS)N)k)rr]choices charactersr^r$r$r%__next__$sz_RandomNameSequence.__next__N) __name__ __module__ __qualname____doc__rdpropertyr]r_rer$r$r$r%rTs  rTc Csg}dD]}t|}|r||qtjdkr,|tjdtjdddddgn|gd z |tW|St t fyO|tj Y|Sw) z[Generate a list of candidate temporary directories which _get_default_tempdir will try.)TMPDIRTEMPTMPntz~\AppData\Local\Tempz%SYSTEMROOT%\Tempzc:\tempzc:\tmpz\tempz\tmp)z/tmpz/var/tmpz/usr/tmp) rgetenvappendr!extendr expanduser expandvarsgetcwdAttributeErrorrcurdir)dirlistenvnamedirnamer$r$r%_candidate_tempdir_list's$   rzc Cst}t}|D]~}|tjkrtj|}tdD]l}t|}tj||}z0t |t d}zz t |dWt |nt |wWt |nt |w|WSty_Yqty|tjdkrytj|ryt|tjryYqYn tyYnwqttjd|)aqCalculate 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.dsblatrnz)No usable temporary directory found in %s)rTrzrrvrabspathrangenextrr*_bin_openflagswriter/rFileExistsErrorPermissionErrorr!isdiraccessW_OKrFileNotFoundError_errnoENOENT)namerrwrQseqr!r(r>r$r$r%_get_default_tempdirBsB        rcCJtdur#tztdurtaWttSWttStwtS)z7Common setup sequence for all user-callable interfaces.N)_name_sequence _once_lockacquirerTreleaser$r$r$r%_get_candidate_namesps rc Cstj|}t}|turttj|}ttD]J}t |}tj ||||}t d|z t ||d} Wn$ty@Yqty[tjdkrZtj|rZt|tjrZYqw| |fSttjd)z>Code common to mkstemp, TemporaryFile, and NamedTemporaryFile.ztempfile.mkstempr|rnz#No usable temporary file name found)rrr}rr:maprNr~rrrrauditr*rrr!rrrrEEXIST) rQpresufflagsrRr rr!filer>r$r$r%_mkstemp_inner~s.        rcGsR|tjvr||g|RddidStjdkstj|s'||g|RdSdS)Nr'Frn)rsupports_follow_symlinksr!rr)funcrr6r$r$r%_dont_follow_symlinkss rcCs<ztj}Wn tyYnwt||dttj|ddS)Nr)rchflagsrurchmod)rrr$r$r% _resetpermss   rcC ttS)z7The default prefix for temporary directories as string.)rr;rMr$r$r$r%r  r cCr)z6The default prefix for temporary directories as bytes.)rrNrMr$r$r$r%r rr cCr)z&Private accessor for tempfile.tempdir.N)r rrrrr$r$r$r% _gettempdirs rcC ttS)z Returns tempfile.tempdir as str.)rr;rr$r$r$r%r  r cCr)z"Returns tempfile.tempdir as bytes.)rrNrr$r$r$r%r rr cCs2t|||\}}}}|rt}nt}t|||||S)aUser-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 not None, the file name will end with that suffix, otherwise there will be no suffix. If 'prefix' is not None, the file name will begin with that prefix, otherwise a default prefix is used. If 'dir' is not None, 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. If any of 'suffix', 'prefix' and 'dir' are not None, they must be the same type. If they are bytes, the returned name will be bytes; str otherwise. 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. )rS_text_openflagsrr)rPrOrQtextrRrr$r$r%rs rc Cst|||\}}}}t}|turttj|}ttD]F}t|}tj ||||}t d|z t |dW|StyFYqtyatjdkr`tj |r`t|tjr`Yqwttjd)aUser-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. ztempfile.mkdtemprrnz(No usable temporary directory name found)rSrr:rrrNr~rrrrrrmkdirrrr!rrrrr)rPrOrQrRr rr!rr$r$r%rs.        rr`cCs\|durt}t}ttD]}t|}tj||||}t|s'|Sqt t j d)aUser-callable function to return a unique temporary file name. The file is not created. Arguments are similar to mkstemp, except that the 'text' argument is not accepted, and suffix=None, prefix=None and bytes file names are not supported. THIS FUNCTION IS UNSAFE AND SHOULD NOT BE USED. The file name may refer 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. Nz"No usable temporary filename found) r rr~rrrrrrErrr)rPrOrQr rr!rr$r$r%rs rc@sNeZdZdZdZdZd ddZejdkr!ej fdd Z d d Z dSd d Z dS)_TemporaryFileCloserzA separate object allowing proper closing of a temporary file's underlying file object, without adding a __del__ method to the temporary file.NFTcCs||_||_||_dSr4)rr!deleter[rr!rr$r$r%__init__Cs z_TemporaryFileCloser.__init__rncCsX|js(|jdur*d|_z|jW|jr||jdSdS|jr'||jwwdSdSNT) close_calledrr/rr!)r[rr$r$r%r/Rs  z_TemporaryFileCloser.closecC |dSr4)r/r^r$r$r%__del__\ z_TemporaryFileCloser.__del__cCs|js d|_|jdSdSr)rrr/r^r$r$r%r/`sT) rfrgrhrirrrrr!rr/rr$r$r$r%r;s   rc@sBeZdZdZdddZddZddZd d Zd d Zd dZ dS)_TemporaryFileWrapperzTemporary 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. TcCs$||_||_||_t||||_dSr4)rr!rr_closerrr$r$r%rnsz_TemporaryFileWrapper.__init__cs^|jd}t||}t|dr"|tfdd}|j|_|}t|ts-t||||S)Nr__call__cs|i|Sr4r$)r6kwargsrr$r% func_wrapper|sz7_TemporaryFileWrapper.__getattr__..func_wrapper) __dict__rXhasattr _functoolswrapsrr9intsetattr)r[r!rarr$rr% __getattr__ts     z!_TemporaryFileWrapper.__getattr__cCs|j|Sr4)r __enter__r^r$r$r%rs z_TemporaryFileWrapper.__enter__cCs|j|||}||Sr4)r__exit__r/)r[excvaluetbresultr$r$r%rsz_TemporaryFileWrapper.__exit__cCs|jdS)zA Close the temporary file, possibly deleting it. N)rr/r^r$r$r%r/sz_TemporaryFileWrapper.closeccs|jD]}|VqdSr4)r)r[liner$r$r%r_s z_TemporaryFileWrapper.__iter__Nr) rfrgrhrirrrrr/r_r$r$r$r%rfs  rw+bTerrorsc st\ttjdkr|rtjOd|vr!t|}dfdd} z,tj|||||| d} zt| d| } t| d| } | _t | |WWS| durntjdkri|snt ) aCreate and return a temporary file. Arguments: 'prefix', 'suffix', 'dir' -- as for mkstemp. 'mode' -- the mode argument to io.open (default "w+b"). 'buffering' -- the buffer size argument to io.open (default -1). 'encoding' -- the encoding argument to io.open (default None) 'newline' -- the newline argument to io.open (default None) 'delete' -- whether the file is deleted on close (default True). 'errors' -- the errors argument to io.open (default None) 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 its 'name' attribute. The file will be automatically deleted when it is closed unless the 'delete' argument is set to False. rnbNcst\}|Sr4)r)r6r>rQrr!rRrOrPr$r%openersz"NamedTemporaryFile..opener bufferingnewlineencodingrrbufferraw) rSrrr! O_TEMPORARY_io text_encodingr*rXrr/r) r#rrrrPrOrQrrrrrr$rr%rs2      rposixcygwin O_TMPFILEc sd|vr t|}t\ttrSdfdd}ztj||||||d} t| d| } t| d| } | _| WStyJdaYn t yRYnwdfd d}tj||||||d} t| d| } t| d| } | _| S) aCreate and return a temporary file. Arguments: 'prefix', 'suffix', 'dir' -- as for mkstemp. 'mode' -- the mode argument to io.open (default "w+b"). 'buffering' -- the buffer size argument to io.open (default -1). 'encoding' -- the encoding argument to io.open (default None) 'newline' -- the newline argument to io.open (default None) 'errors' -- the errors argument to io.open (default None) 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. rNcs$tjBtj@}t|dS)Nr|)rrO_CREATr*)r6flags2)rQr>rr$r%rszTemporaryFile..openerrrrFc sJt\}zt|WSty$}ztd}~wwr4)rrr BaseExceptionr/)r6r!erQr>rrRrOrPr$r%rs  ) rrrSr_O_TMPFILE_WORKSr*rXr!IsADirectoryErrorr) r#rrrrPrOrQrrrrr$rr%rs>          rc@seZdZdZdZ   d8dddd ZeejZ d d Z d d Z ddZ ddZ ddZddZeddZeddZeddZddZddZd d!Zed"d#Zed$d%Zed&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd9d2d3Zd4d5Z d6d7Z!dS):rzTemporary file wrapper, specialized to switch from BytesIO or StringIO to a real file when it exceeds a certain size or when a fileno is needed. FrrrNrc  Cs^d|vr t|_nt|}tjt|| |d|_||_d|_|||||||| d|_dS)Nr)rrrF)r#rrPrOrrrQr)rBytesIO_filer TextIOWrapper _max_size_rolled_TemporaryFileArgs) r[max_sizer#rrrrPrOrQrr$r$r%r7s    zSpooledTemporaryFile.__init__cCs4|jrdS|j}|r||kr|dSdSdSr4)rrtellrollover)r[rrr$r$r%_checkJs  zSpooledTemporaryFile._checkcCsv|jrdS|j}tdi|j}|_|`|}t|dr)|j| n|| | |dd|_dS)NrrTr$) rrrrrrrrdetachgetvalueseek)r[rnewfileposr$r$r%rPs    zSpooledTemporaryFile.rollovercCs|jjrtd|S)Nz%Cannot enter context with closed file)rclosed ValueErrorr^r$r$r%reszSpooledTemporaryFile.__enter__cC|jdSr4rr/r[rrrr$r$r%rjzSpooledTemporaryFile.__exit__cC |jSr4)rr_r^r$r$r%r_n zSpooledTemporaryFile.__iter__cCrr4rr^r$r$r%r/qrzSpooledTemporaryFile.closecC|jjSr4)rrr^r$r$r%rtzSpooledTemporaryFile.closedcCrr4)rrr^r$r$r%rxrzSpooledTemporaryFile.encodingcCrr4)rrr^r$r$r%r|rzSpooledTemporaryFile.errorscCs||jSr4)rrfilenor^r$r$r%rs zSpooledTemporaryFile.filenocCrr4)rflushr^r$r$r%rrzSpooledTemporaryFile.flushcCrr4)risattyr^r$r$r%rrzSpooledTemporaryFile.isattycCs(z|jjWSty|jdYSw)Nr#)rr#rurr^r$r$r%r#s   zSpooledTemporaryFile.modecCs z|jjWStyYdSwr4)rr!rur^r$r$r%r!s   zSpooledTemporaryFile.namecCrr4)rnewlinesr^r$r$r%rrzSpooledTemporaryFile.newlinescG |jj|Sr4)rreadr[r6r$r$r%rrzSpooledTemporaryFile.readcGrr4)rreadlinerr$r$r%rrzSpooledTemporaryFile.readlinecGrr4)r readlinesrr$r$r%rrzSpooledTemporaryFile.readlinescGrr4)rrrr$r$r%rrzSpooledTemporaryFile.seekcCrr4)rrr^r$r$r%rrzSpooledTemporaryFile.tellcCs8|dur |jdS||jkr||j|dSr4)rtruncaterr)r[sizer$r$r%rs  zSpooledTemporaryFile.truncatecC|j}||}|||Sr4)rrr)r[srrvr$r$r%r  zSpooledTemporaryFile.writecCrr4)r writelinesr)r[iterablerr r$r$r%r r zSpooledTemporaryFile.writelines)rrrNNNNNr4)"rfrgrhrirr classmethod_types GenericAlias__class_getitem__rrrrr_r/rjrrrrrrr#r!rrrrrrrrr r$r$r$r%r0sN         rc@sdeZdZdZ  dddZedddZeddd Zd d Zd d Z ddZ ddZ ee j ZdS)ra+Create and return a temporary directory. This has the same behavior as mkdtemp but can be used as a context manager. For example: with TemporaryDirectory() as tmpdir: ... Upon exiting the context, the directory and everything contained in it are removed. NFcCs:t||||_||_tj||j|jd||jd|_dS)NzImplicitly cleaning up {!r}) warn_messager=)rr!_ignore_cleanup_errors_weakreffinalize_cleanupformat _finalizer)r[rPrOrQignore_cleanup_errorsr$r$r%rs  zTemporaryDirectory.__init__cs fdd}t|ddS)Nc st|dtrAz/|krttj|t|z t|WWdSttfy3j|dYnwWdSt y@YdSwt|dt rJdSsMdS)Nrr=) issubclassrrrrryrrr?r)rrrclsr=r!r$r%rs& z+TemporaryDirectory._rmtree..onerror)r)r?)rr!r=rr$rr%r?szTemporaryDirectory._rmtreecCs|j||dt|tdSNr)r? _warningswarnResourceWarning)rr!rr=r$r$r%rszTemporaryDirectory._cleanupcCsd|jj|jS)Nz <{} {!r}>)r __class__rfr!r^r$r$r%__repr__szTemporaryDirectory.__repr__cCs|jSr4)r!r^r$r$r%rszTemporaryDirectory.__enter__cCrr4)cleanuprr$r$r%rrzTemporaryDirectory.__exit__cCs2|js tj|jr|j|j|jddSdSr)rrrrexistsr!r?rr^r$r$r%r#szTemporaryDirectory.cleanupNNNF)F)rfrgrhrirr r?rr"rrr#rrrr$r$r$r%rs    r)FNr%)NNN)rrNNNNNT)rrNNNNN)Qri__all__ functoolsrwarningsriorosrshutil_shutilrmtreer? ImportErrorsysrr)rrr.r*rrsupports_dir_fdr supports_fdrr8errnorrandomr@rYtypesrweakrefr_thread allocate_lock_allocate_lockO_RDWRrO_EXCLrrrArrBrrMrrErLrSrTrzrrrrrrr r r rr r rrrrrrr!platformrrrrr$r$r$r%s   !,         ,    '( +? 5  K