/snap/core20/2769/usr/lib/python3.8/__pycache__
NameSizeModeActions
abc.cpython-38.pyc53340644editdlrm
aifc.cpython-38.pyc254740644editdlrm
antigravity.cpython-38.pyc7970644editdlrm
argparse.cpython-38.pyc625910644editdlrm
ast.cpython-38.pyc167630644editdlrm
asynchat.cpython-38.pyc68510644editdlrm
asyncore.cpython-38.pyc160280644editdlrm
base64.cpython-38.pyc170710644editdlrm
bdb.cpython-38.pyc249210644editdlrm
binhex.cpython-38.pyc121340644editdlrm
bisect.cpython-38.pyc23540644editdlrm
bz2.cpython-38.pyc114450644editdlrm
calendar.cpython-38.pyc270640644editdlrm
cgi.cpython-38.pyc265440644editdlrm
cgitb.cpython-38.pyc101500644editdlrm
chunk.cpython-38.pyc48390644editdlrm
cmd.cpython-38.pyc126260644editdlrm
code.cpython-38.pyc99130644editdlrm
codecs.cpython-38.pyc339560644editdlrm
codeop.cpython-38.pyc64170644editdlrm
colorsys.cpython-38.pyc32400644editdlrm
compileall.cpython-38.pyc94100644editdlrm
configparser.cpython-38.pyc457180644editdlrm
contextlib.cpython-38.pyc202290644editdlrm
contextvars.cpython-38.pyc2430644editdlrm
copy.cpython-38.pyc69870644editdlrm
copyreg.cpython-38.pyc43180644editdlrm
cProfile.cpython-38.pyc54800644editdlrm
crypt.cpython-38.pyc33870644editdlrm
csv.cpython-38.pyc119100644editdlrm
dataclasses.cpython-38.pyc236530644editdlrm
datetime.cpython-38.pyc571730644editdlrm
decimal.cpython-38.pyc3590644editdlrm
difflib.cpython-38.pyc594380644editdlrm
dis.cpython-38.pyc158080644editdlrm
doctest.cpython-38.pyc759740644editdlrm
dummy_threading.cpython-38.pyc11100644editdlrm
enum.cpython-38.pyc259620644editdlrm
filecmp.cpython-38.pyc84270644editdlrm
fileinput.cpython-38.pyc133730644editdlrm
fnmatch.cpython-38.pyc33550644editdlrm
formatter.cpython-38.pyc175450644editdlrm
fractions.cpython-38.pyc187390644editdlrm
ftplib.cpython-38.pyc280070644editdlrm
functools.cpython-38.pyc279010644editdlrm
genericpath.cpython-38.pyc40010644editdlrm
getopt.cpython-38.pyc62710644editdlrm
getpass.cpython-38.pyc41780644editdlrm
gettext.cpython-38.pyc180000644editdlrm
glob.cpython-38.pyc43430644editdlrm
gzip.cpython-38.pyc181840644editdlrm
hashlib.cpython-38.pyc67270644editdlrm
heapq.cpython-38.pyc140700644editdlrm
hmac.cpython-38.pyc63880644editdlrm
imaplib.cpython-38.pyc414640644editdlrm
imghdr.cpython-38.pyc41180644editdlrm
imp.cpython-38.pyc98090644editdlrm
inspect.cpython-38.pyc805930644editdlrm
io.cpython-38.pyc34540644editdlrm
ipaddress.cpython-38.pyc628290644editdlrm
keyword.cpython-38.pyc9980644editdlrm
linecache.cpython-38.pyc38670644editdlrm
locale.cpython-38.pyc346740644editdlrm
lzma.cpython-38.pyc120180644editdlrm
mailbox.cpython-38.pyc602640644editdlrm
mailcap.cpython-38.pyc72060644editdlrm
mimetypes.cpython-38.pyc160310644editdlrm
modulefinder.cpython-38.pyc161150644editdlrm
netrc.cpython-38.pyc37770644editdlrm
nntplib.cpython-38.pyc339740644editdlrm
ntpath.cpython-38.pyc140910644editdlrm
nturl2path.cpython-38.pyc17440644editdlrm
numbers.cpython-38.pyc122020644editdlrm
opcode.cpython-38.pyc54200644editdlrm
operator.cpython-38.pyc136910644editdlrm
optparse.cpython-38.pyc480570644editdlrm
os.cpython-38.pyc313970644editdlrm
pathlib.cpython-38.pyc442090644editdlrm
pdb.cpython-38.pyc472260644editdlrm
pickle.cpython-38.pyc469080644editdlrm
pickletools.cpython-38.pyc672040644editdlrm
pipes.cpython-38.pyc77950644editdlrm
pkgutil.cpython-38.pyc163090644editdlrm
platform.cpython-38.pyc243260644editdlrm
plistlib.cpython-38.pyc273740644editdlrm
poplib.cpython-38.pyc135560644editdlrm
posixpath.cpython-38.pyc104610644editdlrm
pprint.cpython-38.pyc162810644editdlrm
profile.cpython-38.pyc147580644editdlrm
pstats.cpython-38.pyc220660644editdlrm
pty.cpython-38.pyc39550644editdlrm
pyclbr.cpython-38.pyc104510644editdlrm
pydoc.cpython-38.pyc836460644editdlrm
py_compile.cpython-38.pyc73520644editdlrm
queue.cpython-38.pyc106260644editdlrm
quopri.cpython-38.pyc57480644editdlrm
random.cpython-38.pyc201080644editdlrm
re.cpython-38.pyc144220644editdlrm
reprlib.cpython-38.pyc53030644editdlrm
rlcompleter.cpython-38.pyc57550644editdlrm
runpy.cpython-38.pyc81810644editdlrm
sched.cpython-38.pyc65320644editdlrm
secrets.cpython-38.pyc21900644editdlrm
selectors.cpython-38.pyc169350644editdlrm
shelve.cpython-38.pyc94900644editdlrm
shlex.cpython-38.pyc75360644editdlrm
shutil.cpython-38.pyc372190644editdlrm
signal.cpython-38.pyc28430644editdlrm
site.cpython-38.pyc171680644editdlrm
sitecustomize.cpython-38.pyc2200644editdlrm
smtpd.cpython-38.pyc264630644editdlrm
smtplib.cpython-38.pyc355320644editdlrm
sndhdr.cpython-38.pyc69890644editdlrm
socket.cpython-38.pyc277870644editdlrm
socketserver.cpython-38.pyc253610644editdlrm
sre_compile.cpython-38.pyc151420644editdlrm
sre_constants.cpython-38.pyc63590644editdlrm
sre_parse.cpython-38.pyc216470644editdlrm
ssl.cpython-38.pyc450370644editdlrm
stat.cpython-38.pyc43720644editdlrm
statistics.cpython-38.pyc336530644editdlrm
string.cpython-38.pyc73000644editdlrm
stringprep.cpython-38.pyc110170644editdlrm
struct.cpython-38.pyc3300644editdlrm
subprocess.cpython-38.pyc419670644editdlrm
sunau.cpython-38.pyc170800644editdlrm
symbol.cpython-38.pyc24040644editdlrm
symtable.cpython-38.pyc113220644editdlrm
sysconfig.cpython-38.pyc158370644editdlrm
tabnanny.cpython-38.pyc70300644editdlrm
tarfile.cpython-38.pyc630430644editdlrm
telnetlib.cpython-38.pyc182370644editdlrm
tempfile.cpython-38.pyc266530644editdlrm
textwrap.cpython-38.pyc135190644editdlrm
this.cpython-38.pyc12610644editdlrm
threading.cpython-38.pyc399760644editdlrm
timeit.cpython-38.pyc117770644editdlrm
token.cpython-38.pyc24850644editdlrm
tokenize.cpython-38.pyc171600644editdlrm
trace.cpython-38.pyc200260644editdlrm
traceback.cpython-38.pyc199380644editdlrm
tracemalloc.cpython-38.pyc173630644editdlrm
tty.cpython-38.pyc10760644editdlrm
turtle.cpython-38.pyc1300220644editdlrm
types.cpython-38.pyc91770644editdlrm
typing.cpython-38.pyc624200644editdlrm
uu.cpython-38.pyc36050644editdlrm
uuid.cpython-38.pyc236830644editdlrm
warnings.cpython-38.pyc136520644editdlrm
wave.cpython-38.pyc181490644editdlrm
weakref.cpython-38.pyc195180644editdlrm
webbrowser.cpython-38.pyc171200644editdlrm
xdrlib.cpython-38.pyc82210644editdlrm
zipapp.cpython-38.pyc58540644editdlrm
zipfile.cpython-38.pyc593360644editdlrm
zipimport.cpython-38.pyc172750644editdlrm
_bootlocale.cpython-38.pyc12430644editdlrm
_collections_abc.cpython-38.pyc287410644editdlrm
_compat_pickle.cpython-38.pyc55010644editdlrm
_compression.cpython-38.pyc41460644editdlrm
_dummy_thread.cpython-38.pyc60370644editdlrm
_markupbase.cpython-38.pyc77900644editdlrm
_osx_support.cpython-38.pyc115930644editdlrm
_pydecimal.cpython-38.pyc1607350644editdlrm
_pyio.cpython-38.pyc740790644editdlrm
_py_abc.cpython-38.pyc46700644editdlrm
_sitebuiltins.cpython-38.pyc34810644editdlrm
_strptime.cpython-38.pyc160440644editdlrm
_sysconfigdata__linux_x86_64-linux-gnu.cpython-38.pyc211210644editdlrm
_sysconfigdata__x86_64-linux-gnu.cpython-38.pyc211150644editdlrm
_threading_local.cpython-38.pyc64460644editdlrm
_weakrefset.cpython-38.pyc76000644editdlrm
__future__.cpython-38.pyc41580644editdlrm
__phello__.foo.cpython-38.pyc1270644editdlrm
Edit: /snap/core20/2769/usr/lib/python3.8/__pycache__/cgi.cpython-38.pyc (26544B)
U yi @sjdZdZddlmZmZmZddlmZddlZddl Z ddl Z ddl m Z ddlmZddlZddlZddlZdd d d d d ddddddg ZdadaddZddZddZddZeadade jdddfdd Zd1d!d Zd"d#Zd$d Z Gd%ddZ!Gd&d d Z"e jfd'd Z#d2d(dZ$e jfd)dZ%d*dZ&d+dZ'd,dZ(d-dZ)d.d/Z*e+d0krfe#dS)3zSupport module for CGI (Common Gateway Interface) scripts. This module defines a number of utilities for use by CGI scripts written in Python. z2.6)StringIOBytesIO TextIOWrapper)MappingN) FeedParser)MessageMiniFieldStorage FieldStorageparseparse_multipart parse_headertestprint_exception print_environ print_formprint_directoryprint_argumentsprint_environ_usagecGsFtr,ts,zttdaWntk r*YnXts6tantat|dS)aWrite a log message, if there is a log file. Even though this function is called initlog(), you should always use log(); log is a variable that is set either to initlog (initially), to dolog (once the log file has been opened), or to nolog (when logging is disabled). The first argument is a format string; the remaining arguments (if any) are arguments to the % operator, so e.g. log("%s: %s", "a", "b") will write "a: b" to the log file, followed by a newline. If the global logfp is not None, it should be a file object to which log data is written. If the global logfp is None, the global logfile may be a string giving a filename to open, in append mode. This file should be world writable!!! If the file can't be opened, logging is silently disabled (since there is no safe place where we could send an error message). aN)logfilelogfpopenOSErrornologlogdologZallargsr/usr/lib/python3.8/cgi.pyinitlog8sr cGst||ddS)z=Write a log message to the log file. See initlog() for docs. N)rwrite)Zfmtargsrrrr[srcGsdS)z9Dummy function, assigned to log when logging is disabled.Nrrrrrr_srcCsdatrtdatadS)zClose the log file.rN)rrcloser rrrrrcloselogcs r%&c Cs^|dkrtj}t|dr |j}nd}t|tr4|j}d|krDd|d<|ddkr t|d\}}|dkrxt|||d S|d krt |d }t r|t krt d | | |} nd } d|kr| r| d} | |d} n*tjddr| r| d} | tjd} | |d<nsz#parse_multipart..)r;formatrZset_typeKeyErrorr )r>rCr'rJr,rGrBrIrrNrr s   ccs|dddkr|dd}|d}|dkr`|dd||dd|dr`|d|d}q&|dkrpt|}|d|}|V||d}qdS)Nr1;r"\")findcountlenstrip)sendfrrr _parseparams  (  r]cCstd|}|}i}|D]}|d}|dkr|d|}||dd}t|dkr|d|dkrdkrnn |dd}|d d d d}|||<q||fS) zfParse a Content-type like header. Return the main content-type and a dictionary of options. rR=rNr1rUrSz\\\rT)r]__next__rVrYlowerrXrF)linepartskeyrCpinamevaluerrrr s  ,  c@s@eZdZdZdZdZdZdZiZdZ iZ iZ ddZ ddZ dS)rz=Like FieldStorage, for use when no file uploads are possible.NcCs||_||_dS)z&Constructor from field name and value.Nrhriselfrhrirrr__init__ szMiniFieldStorage.__init__cCsd|j|jfS)z Return printable representation.zMiniFieldStorage(%r, %r)rjrlrrr__repr__szMiniFieldStorage.__repr__)__name__ __module__ __qualname____doc__filenamelisttypefile type_options dispositiondisposition_optionsrIrmrorrrrrsc @seZdZdZdddejdddddddf dd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ d;ddZdrr4r'rJbytesrvrp outerboundary bytes_readlimitr ryrzrhrt _binary_filerx innerboundaryr7r9r8lengthrurwdoneread_urlencoded read_multi read_single)rlr>rIrr?r@rArr'rJrr,methodrDZcdisprCrBZclenrrrrm?s/                          zFieldStorage.__init__cCs(z|jWntk r"YnXdSN)rwr$AttributeErrorrnrrr__del__szFieldStorage.__del__cCs|Srrrnrrr __enter__szFieldStorage.__enter__cGs|jdSr)rwr$)rlr#rrr__exit__szFieldStorage.__exit__cCsd|j|j|jfS)z"Return a printable representation.zFieldStorage(%r, %r, %r))rhrtrirnrrrros zFieldStorage.__repr__cCs t|Sr)iterkeysrnrrr__iter__szFieldStorage.__iter__cCsT|dkrt||jr:|jd|j}|jdn|jdk rL|j}nd}|S)Nrir)rrwseekr:rurkrrr __getattr__s   zFieldStorage.__getattr__cCs^|jdkrtdg}|jD]}|j|kr||q|sBt|t|dkrV|dS|SdS)zDictionary style indexing.N not indexabler1r)rurrhappendrQrX)rlrefounditemrrr __getitem__s    zFieldStorage.__getitem__cCs8||kr0||}t|tr(dd|DS|jSn|SdS)z8Dictionary style get() method, including 'value' lookup.cSsg|] }|jqSrrirLxrrr sz)FieldStorage.getvalue..Nr5rurirlredefaultrirrrgetvalues  zFieldStorage.getvaluecCs4||kr,||}t|tr$|djS|jSn|SdS)z! Return the first value received.rNrrrrrgetfirsts   zFieldStorage.getfirstcCs:||kr2||}t|tr(dd|DS|jgSngSdS)z Return list of received values.cSsg|] }|jqSrrrrrrr.sz(FieldStorage.getlist..Nr)rlrerirrrrK)s   zFieldStorage.getlistcCs*|jdkrtdttdd|jDS)zDictionary style keys() method.Nrcss|] }|jVqdSrrhrLrrrr 8sz$FieldStorage.keys..)rursetrnrrrr4s zFieldStorage.keyscs*|jdkrtdtfdd|jDS)z%Dictionary style __contains__ method.Nrc3s|]}|jkVqdSrrrrerrr>sz,FieldStorage.__contains__..)rurany)rlrerrr __contains__:s zFieldStorage.__contains__cCs t|S)z Dictionary style len(x) support.)rXrrnrrr__len__@szFieldStorage.__len__cCs|jdkrtdt|jS)NzCannot be converted to bool.)rurboolrnrrr__bool__Ds zFieldStorage.__bool__c Cs|j|j}t|ts0td|jt|jf||j |j }|j rT|d|j 7}t j j||j|j|j |j |j|jd}dd|D|_|dS)z+Internal: read data in query string format.%s should return bytes, got %sr&r'rJrr,cSsg|]\}}t||qSrrrLrerirrrrVsz0FieldStorage.read_urlencoded..N)r>r:rr5rr9rvrpr;r'rJrr=r parse_qslr@rArr,ru skip_lines)rlrDqueryrrrrIs& zFieldStorage.read_urlencodedc CsL|j}t|std|fg|_|jrftjj|j|j|j |j |j |j |j d}|jdd|D|jpp|j}|j}t|tstd|jt|jf|jt|7_|d|jkr|r|j}|jt|7_q|j }|dk r|t|j8}t} d} |j} | | 7} | s q0q | s:q@|jt| 7_| | |j |j | } d | krz| d =|jdkrdn |j|j} ||j| ||||| |j |j ||j }|dk r|d 8}|jr|t|j8}|d krtd |j|j7_|j||j s@|j|j!kr4d krnnq@q|"dS) z/Internal: read a part that is itself multipart.z&Invalid boundary in multipart form: %rrcss|]\}}t||VqdSrrrrrrrfsz*FieldStorage.read_multi..r--Nr{r}r1rzMax number of fields exceeded)#rvalid_boundaryr9rurr=r rr@rAr'rJrr,extendFieldStorageClass __class__r>r~r5rrvrprrXrYrZfeedr;r$rrrrr)rlr?r@rAZibrklassZ first_linerparserZhdr_textdatarIrpartrrrr[s            (zFieldStorage.read_multicCs4|jdkr||n||jddS)zInternal: read an atomic part.rN)r read_binaryr read_linesrwrrnrrrrs   zFieldStorage.read_singlei cCs||_|j}|dkr|dkr|jt||j}t|tsVt d|jt |j f|j t |7_ |std|_q|j||t |}qdS)zInternal: read binary data.rrr_N) make_filerwrr>r:minbufsizer5rr9rvrprrXrr")rlZtodorrrrrs   zFieldStorage.read_binarycCs@|jrt|_|_nt|_|_|jr4|n|dS)z0Internal: read lines until EOF or outerboundary.N)rrrw_FieldStorage__filerrread_lines_to_outerboundaryread_lines_to_eofrnrrrrs  zFieldStorage.read_linescCsv|jdk rF|jt|dkrF||_|j}|j|d|_|jrZ|j|n|j||j |j dS)z line is always bytes, not stringNi) rtellrXrrwrr"rr;r'rJ)rlrcrrrrZ__writes    zFieldStorage.__writecCs:|jd}|jt|7_|s*d|_q6||qdS)zInternal: read lines until EOF.r_N)r>r~rrXr_FieldStorage__write)rlrcrrrrs  zFieldStorage.read_lines_to_eofc CsJd|j}|d}d}d}d}|jdk rFd|jkr>|krFnnqF|jd}|jt|7_|t|7}|s~d|_qF|dkr||}d}|dr|r|}||krqF||krd |_qF|}| d rd }|dd }d}nL| d r d }|dd}d}n*| dr.d}|dd}d }nd}d }| ||qdS)zInternal: read lines until outerboundary. Data is read as bytes: boundaries and line ends must be converted to bytes for comparisons. rr{TrNrr_ r1s  F) rrr>r~rrXr startswithrstripendswithr) rl next_boundary last_boundaryZdelimlast_line_lfendZ_readrc strippedlineZodelimrrrrsN $        z(FieldStorage.read_lines_to_outerboundarycCs|jr |jrdSd|j}|d}d}|jd}|jt|7_|sPd|_q|dr|r|}||krpq||krd|_q|d}q&dS)z5Internal: skip lines until outer boundary if defined.NrTrr_r1r)rrr>r~rrXrrY)rlrrrrcrrrrrs$   zFieldStorage.skip_linescCs&|jrtdStjd|jddSdS)aOverridable: return a readable & writable file. The file will be used as follows: - data is written to it - seek(0) - data is read from it The file is opened in binary mode for files, in text mode for other fields This version opens a temporary file for reading and writing, and immediately deletes (unlinks) it. The trick (on Unix!) is that the file can still be used, but it can't be opened by another process, and it will automatically be deleted when it is closed or when the current process terminates. If you want a more permanent file, you derive a class which overrides this method. If you want a visible temporary file that is nevertheless automatically deleted when the script terminates, try defining a __del__ method in a derived class which unlinks the temporary files you have created. zwb+zw+r!)r'newlineN)rtempfileZ TemporaryFiler'rnrrrr(s  zFieldStorage.make_file)N)N)!rprqrrrsosr?rmrrrrorrrrrrKrrrrrrrrrrrrrrrrrrrrr sL) &   E   2cCstdttjt_zNt}ttt|t|t dd}|fdd}td|Wnt YnXtdda z&t}ttt|t|Wnt YnXd S) zRobust test CGI script, usable as main program. Write minimal HTTP headers and dump all information provided to the script in HTML form. zContent-type: text/htmlcSs tddS)Nz,testing print_exception() -- italics?)execrrrrr\[sztest..fcSs |dSrr)r\rrrg]sztest..gz9

What follows is a test, not an actual exception:

z*

Second try with a small maxlen...

2N) printr2stdoutstderrr rrrrrrr8)r?formr\rrrrr Js4    c Csx|dkrt\}}}ddl}ttd||||||}tdtd|ddt|df~dS)Nrz+

Traceback (most recent call last):

z
%s%s
rr_) r2exc_info tracebackr format_tbformat_exception_onlyhtmlescapejoin)rvritbrrrurrrrqs   c Cs\t|}ttdtd|D]"}tdt|dt||q&tdtdS)z#Dump the shell environment as HTML.z

Shell Environment:





N)sortedrrrr)r?rrerrrrs  cCst|}ttd|s&tdtd|D]Z}tdt|ddd||}tdttt|d td tt|q2td td S) z$Dump the contents of a form as HTML.z

Form Contents:

z

No form fields.rr: )r[zzrrN)rrrrrreprrv)rrrerirrrrs c Csjttdz t}Wn6tk rP}ztdtt|W5d}~XYnXtt|tdS)z#Dump the current directory as HTML.z#

Current Working Directory:

zOSError:N)rrgetcwdrrrstr)pwdmsgrrrrs &cCs(ttdtttjtdS)Nz

Command Line Arguments:

)rr2r<rrrrrs  cCs tddS)z9Dump a list of environment variables used by CGI as HTML.a

These environment variables could have been set:

  • AUTH_TYPE
  • CONTENT_LENGTH
  • CONTENT_TYPE
  • DATE_GMT
  • DATE_LOCAL
  • DOCUMENT_NAME
  • DOCUMENT_ROOT
  • DOCUMENT_URI
  • GATEWAY_INTERFACE
  • LAST_MODIFIED
  • PATH
  • PATH_INFO
  • PATH_TRANSLATED
  • QUERY_STRING
  • REMOTE_ADDR
  • REMOTE_HOST
  • REMOTE_IDENT
  • REMOTE_USER
  • REQUEST_METHOD
  • SCRIPT_NAME
  • SERVER_NAME
  • SERVER_PORT
  • SERVER_PROTOCOL
  • SERVER_ROOT
  • SERVER_SOFTWARE
In addition, HTTP headers sent by the server may be passed in the environment as well. Here are some common variable names:
  • HTTP_ACCEPT
  • HTTP_CONNECTION
  • HTTP_HOST
  • HTTP_PRAGMA
  • HTTP_REFERER
  • HTTP_USER_AGENT
N)rrrrrrscCs(ddl}t|trd}nd}|||S)Nrs^[ -~]{0,200}[!-~]$z^[ -~]{0,200}[!-~]$)rer5rmatch)rZrZ _vb_patternrrrrs  r__main__)rErFr&)NNNN),rs __version__iorrrZcollections.abcrr2rZ urllib.parser=Z email.parserrZ email.messagerrrr__all__rrr rrr%rr8r?r r r]r rr r rrrrrrrrprrrr sh   #  F  :'   /