ROOTPLOIT
Server: LiteSpeed
System: Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: niphet (1079)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //lib64/python3.8/__pycache__/pydoc.cpython-38.opt-1.pyc
U

.e̠@sdZdgZdZdZdZddlZddlZddlZddl	Zddl
ZddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZdd	lmZd
dZdd
ZddZ ddZ!ddZ"ddZ#ddZ$e%dej&Z'ddZ(ddZ)ddZ*dd Z+dxd!d"Z,d#d$Z-d%d&Z.d'd(Z/d)d*Z0ifd+d,Z1Gd-d.d.e2Z3d/d0Z4difd1d2Z5Gd3d4d4Z6Gd5d6d6eZ7Gd7d8d8e6Z8Gd9d:d:eZ9Gd;d<d<e6Z:Gd=d>d>e:Z;d?d@a<dAdBZ=dCdDZ>dEdFZ?dGdHZ@dIdJZAdKdLZBdMdNZCdOdPZDdydQdRZEe:ZFe;ZGe8ZHdzdSdTZId{dVdWZJd|dXdYZKd}dZd[ZLd~d]d^ZMGd_d`d`ZNeNZOGdadbdbZPdcddZQdedfZRddhdiZSddjdkdldmdnZTdodpZUdqdrZVdsdtZWdudvZXeYdwkreXdS)aGenerate Python documentation in HTML or text for interactive use.

At the Python interactive prompt, calling help(thing) on a Python object
documents the object, and calling help() starts up an interactive
help session.

Or, at the shell command line outside of Python:

Run "pydoc <name>" to show documentation on something.  <name> may be
the name of a function, module, package, or a dotted reference to a
class or function within a module or module in a package.  If the
argument contains a path segment delimiter (e.g. slash on Unix,
backslash on Windows) it is treated as the path to a Python source file.

Run "pydoc -k <keyword>" to search for a keyword in the synopsis lines
of all available modules.

Run "pydoc -n <hostname>" to start an HTTP server with the given
hostname (default: localhost) on the local machine.

Run "pydoc -p <port>" to start an HTTP server on the given port on the
local machine.  Port number 0 can be used to get an arbitrary unused port.

Run "pydoc -b" to start an HTTP server on an arbitrary unused port and
open a Web browser to interactively browse documentation.  Combine with
the -n and -p options to control the hostname and port used.

Run "pydoc -w <name>" to write out the HTML documentation for a module
to a file named "<name>.html".

Module docs for core modules are assumed to be in

    https://docs.python.org/X.Y/library/

This can be overridden by setting the PYTHONDOCS environment variable
to a different URL or to a local directory containing the Library
Reference Manual pages.
helpzKa-Ping Yee <ping@lfw.org>z26 February 2001zGuido van Rossum, for an excellent programming language.
Tommy Burnette, the original creator of manpy.
Paul Prescod, for all his work on onlinehelp.
Richard Chamberlain, for the first implementation of textdoc.
N)deque)Repr)format_exception_onlycCs\g}g}tjD]H}tj|pd}tj|}||krtj|r||||q|S)zAConvert sys.path into a list of absolute, existing, unique paths..)syspathosabspathnormcaseisdirappend)dirsZnormdirsdirZnormdirr/usr/lib64/python3.8/pydoc.pypathdirsPs

rcCs.t|pt|}|r*tdd|p,dS)z-Get the doc string or comments for an object.z^ *
)inspectgetdocZgetcommentsresubrstrip)objectresultrrrr\srcCsf|d}t|dkr&|ddfSt|dkrX|dsX|dd|ddfSdd|fS)z>Split a doc string into a synopsis line (if any) and the rest.
rrN)stripsplitlenrjoin)doclinesrrrsplitdocasr$cCs"|j}|j|kr|jd|}|S)z@Get a class name and qualify it with a module name if necessary.r)__name__
__module__)rmodnamenamerrr	classnamejs
r)cCs>t|p:t|p:t|p:t|p:t|p:t|S)z>Check if an object is of a type that probably means it's data.)rismoduleisclass	isroutineZisframeZistracebackZiscoderrrrisdataqsr.cGs.|r*|d||d}|dd}q|S)z/Do a series of global replacements on a string.rrrN)r!r)textZpairsrrrreplacewsr0cCsXt||krTtd|dd}td|d|}|d|d|t||dS|S)zCOmit part of a string if needed to make it fit in a maximum length.rrN...)r max)r/maxlenZpreZpostrrrcram~s
$r5z at 0x[0-9a-f]{6,16}(>+)$cCstd|S)z>Remove the hexadecimal id from a Python object representation.z\1)_re_stripidrr/rrrstripidsr8cCs<t|rdSt|r8t|dd}t|p4|dkSdS)zo
    Returns True if fn is a bound method, regardless of whether
    fn was implemented in Python or in C.
    T__self__NF)rismethod	isbuiltingetattrr*)fnselfrrr_is_bound_methods

r?cCs^i}t|tjD]\}}d||<q|jD]}|t|q*|D]}t||||<qF|SNr)r
getmembersr,	__bases__update
allmethodskeysr<)clmethodskeyvaluebaserrrrDs

rDcCs8g}g}|D]"}||r$||q||q||fS)zSplit sequence s via predicate, and return pair ([true], [false]).

    The return value is a 2-tuple of lists,
        ([x for x in s if predicate(x)],
         [x for x in s if not predicate(x)])
    r
)s	predicateZyesZnoxrrr_split_listsrOcCs\|dkrdS|dr$|dr$dS|dr<t|dr<dS|dk	rL||kS|dSdS)	z3Decide whether to show documentation on a variable.>	__slots____date____path____qualname____builtins____credits____doc__
__author____version____file__r%
__cached__r&
__loader____spec____package__r__r__fieldsTN)
startswithendswithhasattr)r(allobjrrrvisiblenamesrfcCsXg}t|D]D\}}}}t|r@d}t|tr@|jdkr@d}|||||fq|S)zCWrap inspect.classify_class_attrs, with fixup for data descriptors.data descriptorNreadonly property)rclassify_class_attrsisdatadescriptor
isinstancepropertyfsetr
)rresultsr(kindclsrIrrrris
rics\t|dgzfddtDWntk
r>iYnXfdd}|j|ddS)zGSort the attrs list in-place by _fields and then alphabetically by namer`csi|]\}}||tqSr)r ).0ir()fieldsrr
<dictcomp>sz#sort_attributes.<locals>.<dictcomp>cs|dd|dfSNr)get)attr)field_orderrr<lambda>z!sort_attributes.<locals>.<lambda>rHN)r<	enumerate	TypeErrorsort)attrsrZkeyfuncr)rxrsrsort_attributess
rcCs:tj|r6dD]$}tjtj|d|rdSqdS)z3Guess whether a path refers to a package directory.)z.pyz.pyc__init__TF)r	rrisfiler!)rextrrr	ispackages
rcCs|}|dddks |s0|}|sq0q|}|dddkrT|dd}|dddkr|dd}|dddkr|dd}|s|}|sqq|dd	}nd}|S)
Nr#zr"""r1"""\r)readlinerr)filelinerrrrsource_synopsiss&rc
	Cs t|j}||d\}}|dks.||kr|ttjjrJtjj	}n |ttjj
rftjj}nd}|dkrzt
|}Wntk
rYdSX|t|}W5QRXn^|d|}tjjd||d}ztj|}	WnYdSXtjd=|	jr|	jdnd}||f||<|S)z.Get the one-line summary out of a module file.)NNNZ__temp__loaderr)r	statst_mtimervrbtuple	importlib	machineryBYTECODE_SUFFIXESSourcelessFileLoaderEXTENSION_SUFFIXESExtensionFileLoadertokenizeopenOSErrorrutilspec_from_file_location
_bootstrap_loadrmodulesrV
splitlines)
filenamecachemtimeZ
lastupdaterZ
loader_clsrrspecmodulerrrsynopsiss6



rc@s eZdZdZddZddZdS)ErrorDuringImportzEErrors that occurred while trying to import something to document it.cCs||_|\|_|_|_dSN)rexcrItb)r>rexc_inforrrr#szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)rr%rrI)r>rrrr__str__'szErrorDuringImport.__str__N)r%r&rSrVrrrrrrr!src		Cstjj}t|d}||t|k}W5QRXtj|}tj	|\}}|r`tj
||}ntj
||}tjj
|||d}ztj|WSt|tYnXdS)z<Import a Python source file or compiled file given its path.rbrN)rrMAGIC_NUMBERrreadr r	rbasenamesplitext_bootstrap_externalrSourceFileLoaderrrrrrr)	rmagicrZis_bytecoderr(rrrrrr
importfile+src	s z^|rTtjkrTtjkrTfddtjD}g|D]}tj|||<tj|=q8t}Wnzt\}}}}	tjkrttjj|	n>|tkrt|j|	n(t	|t
r|jkrYdSttYnXdddD].}
zt
||
}Wqtk
rYdSXq|S)aImport a module; handle errors; return None if the module isn't found.

    If the module *is* found but an exception occurs, it's wrapped in an
    ErrorDuringImport exception and reraised.  Unlike __import__, if a
    package path is specified, the module at the end of the path is returned,
    not the package at the beginning.  If the optional 'forceload' argument
    is 1, we reload the module from disk (unless it's a dynamic extension).csg|]}|dr|qS)r)ra)rqmrrr
<listcomp>Qszsafeimport.<locals>.<listcomp>Nrr)rrbuiltin_module_names
__import__rrrYSyntaxErrorr
issubclassImportErrorr(rr<AttributeError)r	forceloadrZsubsrHrrrIrinfopartrrr
safeimport=s.


rc@sfeZdZejddejddZdddZ	d
ddZ
e
ZZZ
ZZZed	fd
dZdS)Doc
PYTHONDOCSz%https://docs.python.org/%d.%d/libraryNrcGs||f|}zFt|r$|j|WSt|r:|j|WSt|rP|j|WSWntk
rfYnXt|r||j	|S|j
|S)z%Generate documentation for an object.)rr*	docmoduler+docclassr,
docroutinerrjdocdatadocother)r>rr(argsrrrdocumentss




zDoc.documentcGs*d|odt|t|jf}t|dS)z+Raise an exception for unimplemented types.z.don't know how to document object%s of type %s N)reprtyper%r})r>rr(rmessagerrrfails
zDoc.failZstdlibcCszt|}Wntk
r&d}YnXtjd|j}tj|}t	|t
tr|jdksz||r|tj
|ds|jdkr|drd|d|jf}qtj
||jd	}nd
}|S)z*Return the location of module docs or None
(built-in)r)
errno
exceptionsZgcZimpmarshalposixsignalr_threadZ	zipimportz
site-packages)z	xml.etreeztest.pydoc_mod)zhttp://zhttps://z%s/%s/.htmlN)r
getabsfiler}r	environrvrrrrkrr%rar!rlower)r>rZbasedirrdoclocrrr	getdoclocs(

z
Doc.getdocloc)N)N)r%r&rSr	rrvrversion_inforrrrrrrdocpropertyr	sysconfigZget_pathrrrrrrms

rc@sHeZdZdZddZddZddZdd	Zd
dZeZ	dd
Z
eZdS)HTMLReprzBClass for safely making an HTML representation of a Python object.cCs,t|d|_|_d|_d|_|_dSN
drrmaxlistmaxtuplemaxdict	maxstringmaxotherr>rrrrs
zHTMLRepr.__init__cCst|ddddddS)N&z&amp;<z&lt;>z&gt;)r0r>r/rrrescapeszHTMLRepr.escapecCst||Sr)rrr>rrrrrsz
HTMLRepr.reprcCsZtt|dr@ddt|j}t||r@t||||S|ttt	||j
SNr%repr_r_)rcrr!r%rr<rr5r8rrr>rNlevelZ
methodnamerrrrepr1s

zHTMLRepr.repr1cCs^t||j}t|}d|krJdt|ddkrJd|d|||dStdd||S)Nr\\rrrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z<font color="#c040c0">\1</font>)r5rrr0rrrr>rNrZtestZtestreprrrrrepr_stringszHTMLRepr.repr_stringcCs@z|ttt||jWS|d|jjYSXdSNz
<%s instance>)rr5r8rr	__class__r%r>rNrrrr
repr_instanceszHTMLRepr.repr_instanceN)r%r&rSrVrrrrrrepr_strrZrepr_unicoderrrrrsrc@seZdZdZeZejZejZddZd1ddZ	d2d
dZ
dd
ZddZd3ddZ
ddZddZddZddZddZddZdiiifdd Zd4d!d"Zd5d#d$Zddiifd%d&Zd'd(Zddiiidfd)d*Zd6d+d,ZeZd7d-d.Zd8d/d0ZdS)9HTMLDocz'Formatter class for HTML documentation.cCsd||fS)Format an HTML page.z<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
%s
</body></html>r)r>titlecontentsrrrpageszHTMLDoc.pagercCsd|||||pdfS)zFormat a page heading.a'
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="%s">
<td valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">&nbsp;<br>%s</font></td
><td align=right valign=bottom
><font color="%s" face="helvetica, arial">%s</font></td></tr></table>
    &nbsp;r)r>rfgcolbgcolZextrasrrrheadingszHTMLDoc.headingNrc	
Cs^|dkrdd|d}d|||f}	|r@|	d||||f}	n|	d|||f}	|	d|S)	z Format a section with a heading.Nz<tt>rz</tt>z<p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="%s">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">%s</font></td></tr>
    zR
<tr bgcolor="%s"><td rowspan=2>%s</td>
<td colspan=2>%s</td></tr>
<tr><td>%s</td>z(
<tr><td bgcolor="%s">%s</td><td>%s</td>z'
<td width="100%%">%s</td></tr></table>r)
r>rr	r
rwidthZpreludeZ
marginaliaZgaprrrrsections
zHTMLDoc.sectioncGsd|}|j|f|S)z$Format a section with a big heading.z<big><strong>%s</strong></big>)r)r>rrrrr
bigsectionszHTMLDoc.bigsectionc
Cs&||}t|dddddddd	S)z!Format literal preformatted text.

z
 
rrr<br>
)r
expandtabsr0rrrr	preformat
szHTMLDoc.preformatrcCsd}t||d|}t|D]X}|dd|}t|||||D]$}|t|krJ||||d}qJ|d}q d|S)z0Format a list of items into a multi-column list.rrz<td width="%d%%" valign=top>rrz</td>z7<table width="100%%" summary="list"><tr>%s</tr></table>)r range)r>listformatZcolsrrowscolrrrrrmulticolumns
zHTMLDoc.multicolumncCsd|S)Nz<font color="#909090">%s</font>rrrrrgreyrzzHTMLDoc.greycGs*|D] }||krd|||fSq|S)z:Make a link for an identifier, given name-to-URL mappings.<a href="%s">%s</a>r)r>r(ZdictsdictrrrnamelinkszHTMLDoc.namelinkcCsN|jtj|j}}t||rDt|||krDd|j|t||fSt||S)zMake a link for a class.z<a href="%s.html#%s">%s</a>)r%rrrvr&rcr<r))r>rr'r(rrrr	classlink%szHTMLDoc.classlinkcCsd|j|jfS)zMake a link for a module.<a href="%s.html">%s</a>)r%rrrr
modulelink-szHTMLDoc.modulelinkcCsR|\}}}}|r||S|r,d||f}nd|}|rBd|}n|}d||fS)z;Make a link for a module or package to display in an index.z
%s.%s.htmlz%s.htmlz"<strong>%s</strong>&nbsp;(package)r)r)r>Z
modpkginfor(rrshadowedurlr/rrr
modpkglink1s

zHTMLDoc.modpkglinkcCsd||fS)zMake a link to source file.z<a href="file:%s">%s</a>r)r>r"rrrrfilelink@szHTMLDoc.filelinkcCs|p|j}g}d}td}|||}	|	s0qh|	\}
}|||||
|	\}}
}}}}|
r||dd}|d||fn|rdt|}|d|||fn|rdt|}|d|||fn|r"|||dd	kr|d
|	||n|d|n@|||dd	krP||	||||n||	|||}q||||dd
|S)zMark up some plain text, given a context of symbols to look for.
        Each context dictionary maps object names to anchor names.rzD\b((http|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?(\w+))"z&quot;rz'http://www.rfc-editor.org/rfc/rfc%d.txtz(http://www.python.org/dev/peps/pep-%04d/r(zself.zself.<strong>%s</strong>Nr)rrcompilesearchspanr
groupsr0intrr!)r>r/rfuncsclassesrGrnherepatternmatchstartendrdZschemeZrfcZpepZselfdotr(r"rrrmarkupDs:

zHTMLDoc.markupc
Csd}|D]}t|tdkr|\}}|d}||||}|r||fkrg}|D]}	|||	|qR|dd|d}|d}qt|tgkr|d||||}qd	|S)
zAProduce HTML for a class tree as given by inspect.getclasstree().rrz"<dt><font face="helvetica, arial">r&, )z
</font></dt>z
<dd>
%s</dd>
z
<dl>
%s</dl>
)rrr
r!
formattree)
r>treer'parentrentrycbasesparentsrJrrrr6os&

zHTMLDoc.formattreec#
s|j}z
|j}Wntk
r(d}YnX|d}g}tt|dD],}|dd|d|d||fqHd||dd}	d|	}
z&t	|}t
j|}
||}
Wntk
rd}
YnXg}t|dr6t|j}|dd	d
kr"|dddkr"|d	d}|d|t|d
rX|t|j|rp|
dd|}
|}|dk	rdt}nd}|
ddd|
|}t|tj}gi}}t|tjD]Z\}}|dk	st|p||krt|||r|||fd|||<||<q|D]\}}|jD]n}|j|j}}tj !|}||kr@|r@t||r@t"|||kr@||kr@|d|||<||<q@q2gi}}t|tj#D]p\}}|dk	st$|st||krt|||r|||fd|||<t%|r||||<qg}t|t&D]&\}}t|||rN|||fqN't(|j)||}|od|}|d|}t|drg}t*+|j,D]\}}} |||| dfq|-.|j/}!|0ddd|!}n.|r<.|fdd}!|0d dd|!}|rd!d"|D}"1t2|"d|g}!|D]"\}}|!3|||||qj|0d#dd$d%|!}|rg}!|D]"\}}|!3|||||q|0d&dd'd%|!}|r:g}!|D]\}}|!3||q|0d(dd)d*|!}t|d+rn't|j4j)}!|0d,dd|!}t|d-r't|j5j)}!|0d.dd|!}|S)/z/Produce HTML documentation for a module object.Nrrz5<a href="%s.html"><font color="#ffffff">%s</font></a>r)<big><big><strong>%s</strong></big></big>rrX$Revision: $z
version %srQz (%s)r4z-<br><a href="%(docloc)s">Module Reference</a>r#ffffff#7799eez<a href=".">index</a><br>rz.html#z#-z<tt>%s</tt>z
<p>%s</p>
rRrzPackage Contentsz#aa55cccs|dSr@)r trrrryrzz#HTMLDoc.docmodule.<locals>.<lambda>ZModulescSsg|]\}}|qSrrrqrHrIrrrrsz%HTMLDoc.docmodule.<locals>.<listcomp>ZClasses#ee77aarZ	Functionsz#eeaa77ZDataz#55aa55rrWZAuthorrUZCredits)6r%__all__rrrr r
r!rrurllibparseZquoter$r}rcstrrXrrrQrlocalsrrAr*r+	getmodulerfrBr&rrrvr<r,r;
isfunctionr.r3rrpkgutiliter_modulesrRr~rr#rr6getclasstreerrWrU)#r>rr(modignoredrdpartsZlinksrrZ
linkednameheadrr"r$rversionrrrr-ZcdictrHrIrJr'rr,Zfdictdatar"modpkgsimporterispkgr	classlistrrrrs*





$






 


zHTMLDoc.docmodulec	sj}|p|}j}g}	|	jGfddd}
|
tt}t|dkrd|D]}d|j	qddfdd}
fd	d
}fdd}fd
dt
D}i|D]n\}}}}d|d||<}zt|}Wntk
r4YnXz||<Wqt
k
rXYqXq|rj|rr|n|ddt|fdd\}}tjk	rtjkr|}q\n"krd}ndj	}|d7}t||
d||dd}|
d||dd}|
d||dd}|d||dd}|d||d d}|d!||d"d}|}q\d#|	}	||krd$||f}nd%|||f}|rg}|D]}||j	q|d&d'|}d#}zt}Wntt
fk
rd(}YnX|r8t|}|r8|d)kr8||d*}t}|rT||pPd#}|j}|otd+|}|d,d-|	d.|S)/z.Produce HTML documentation for a class object.cs eZdZddZfddZdS)z(HTMLDoc.docclass.<locals>.HorizontalRulecSs
d|_dSruZneedonerrrrrsz1HTMLDoc.docclass.<locals>.HorizontalRule.__init__cs|jrdd|_dS)Nz<hr>
rr[rpushrrmaybe	sz.HTMLDoc.docclass.<locals>.HorizontalRule.maybeNr%r&rSrr^rr\rrHorizontalRulesr`rz&<dl><dt>Method resolution order:</dt>
z<dd>%s</dd>
</dl>
cst||\}}|r||D]d\}}}}zt|}Wn&tk
rf||YnX||dq&|S)NrrOr^r<	ExceptionrrmsgrrMokr(rohomeclsrIr-r,hrmdictrQrr]r>rrspills"
zHTMLDoc.docclass.<locals>.spillcsJt||\}}|rF||D]\}}}}||q&|SrrOr^rrdrirQr]r>rrspilldescriptors+sz*HTMLDoc.docclass.<locals>.spilldescriptorsc
st||\}}|r||D]\}}}}t||}t|sXt|rft|dd}	nd}	|	dkrd|n0t|j	}	d|	}	d||	fdq&|S)NrVz<dl><dt>%s</dl>
z<dd><tt>%s</tt>z<dl><dt>%s%s</dl>
r)
rOr^rr<callablerrjr3rr)
rerrMrfr(rorgrIrJr"rhrr	spilldata4s(
z#HTMLDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|dr||||fqS)rerfrqr(rorprIr-rrrIs
z$HTMLDoc.docclass.<locals>.<listcomp>r-rcs|dkSNrrrC	thisclassrrrybrzz"HTMLDoc.docclass.<locals>.<lambda>defined hereinherited from %sz:<br>
z
Methods %scSs|ddkSNrmethodrrCrrrryrrzzClass methods %scSs|ddkSNrzclass methodrrCrrrrytrzzStatic methods %scSs|ddkSNrz
static methodrrCrrrryvrzzReadonly properties %scSs|ddkSNrrhrrCrrrryxrzzData descriptors %scSs|ddkSNrrgrrCrrrryzrzzData and other attributes %scSs|ddkSNrrVrrCrrrry|rzrz*<a name="%s">class <strong>%s</strong></a>z/<strong>%s</strong> = <a name="%s">class %s</a>(%s)r4N()rz<tt>%s<br>&nbsp;</tt>z#000000z#ffc8d8r1)r%rBr
rrgetmror r^rr&rir<rcr}popleftrObuiltinsrrr!	signature
ValueErrorrJrrr3rr)r>rr(rQr,r-rRrealnamer;rr`mrorJrkrnrprrHrorgrIanchor	inheritedtagrr<declrargspecr"r)	r-r,rirjrQrr]r>rwrrs

	












zHTMLDoc.docclasscCs|d||Sz)Format an argument default value as text.=)rrrrrrformatvalueszHTMLDoc.formatvaluec	Cs|j}|p|}|r|jpdd|}	d}
d}t|r|jj}|rZ||k	rd|||}
n0|jdk	rzd||jj|}
nd|||}
t|st|rd}
nd}
||krd	|	|f}nD|rt||g|krd
|jd||f}d}n|}d|	||f}d}t	|rlzt
|}Wnttfk
r>d}YnX|rlt
|}|d
krld|}|dd}|svd}|
||||
o|d|
}|rd|S|t||j|||}|od|}d||fSdS)z;Produce HTML documentation for a function or method object.rrtr from N method of %s instance unbound %s methodasync z$<a name="%s"><strong>%s</strong></a>z<a href="#%s">%s</a>rz)<a name="%s"><strong>%s</strong></a> = %s<lambda>z$<strong>%s</strong> <em>lambda</em> r(...)z'<font face="helvetica, arial">%s</font>z<dl><dt>%s</dt></dl>
z<dd><tt>%s</tt></dd>z<dl><dt>%s</dt>%s</dl>
)r%r?r9rrriscoroutinefunctionisasyncgenfunctiongetattr_staticr,rrr}rJrrr3rr)r>rr(rQr,r-rGrFrrnoteskipdocsimclassasyncqualifierrZreallinkrrrr"rrrrs|



zHTMLDoc.docroutinecCsNg}|j}|r|d||t||j}|r<|d||dd|S)z1Produce html documentation for a data descriptor.z!<dl><dt><strong>%s</strong></dt>
z<dd><tt>%s</tt></dd>
rar)r
r3rrr!r>rr(rQrFrnr]r"rrrrszHTMLDoc.docdatacGs|rd|pd}|||S)z-Produce HTML documentation for a data object.z<strong>%s</strong> = rr)r>rr(rQrRZlhsrrrrszHTMLDoc.docothercCsg}|dkri}t|gD]<\}}}tdd|Dr:q||d|||kfd||<q||||j}||dd|S)z2Generate an HTML index for a directory of modules.Ncss*|]"}dt|kodknVqdS)iiN)ordrqZchrrr	<genexpr>sz HTMLDoc.index.<locals>.<genexpr>rrrArF)rNrOanyr
r~rr#r)r>rr!rWrXr(rYrrrrindexs
z
HTMLDoc.index)r)rrNr)r)N)NN)NNN)NN)N)r%r&rSrVr_repr_instancerrrrrrrrrrrr r#r$r3r6rrrrrrrrrrrrrsH



+

y&
A

rc@s4eZdZdZddZddZddZeZdd	Zd
S)TextReprzAClass for safely making a text representation of a Python object.cCs,t|d|_|_d|_d|_|_dSrrrrrrr
s
zTextRepr.__init__cCsTtt|dr@ddt|j}t||r@t||||Sttt||j	Sr)
rcrr!r%rr<r5r8rrrrrrrs

zTextRepr.repr1cCsHt||j}t|}d|krDdt|ddkrDd|d||dS|S)Nrrrrr)r5rrr0rrrrrs
zTextRepr.repr_stringcCs4zttt||jWSd|jjYSXdSr)r5r8rrrr%rrrrr%szTextRepr.repr_instanceN)	r%r&rSrVrrrrrrrrrrs	rc@s~eZdZdZeZejZddZdddZddZ	dddZ
dd
dZdddZddZ
dddZdddZeZdddZd	S) TextDocz'Formatter class for text documentation.cCsddd|DS)z(Format a string in bold by overstriking.rcss|]}|d|VqdS)Nrrrrrr5szTextDoc.bold.<locals>.<genexpr>)r!rrrrbold3szTextDoc.bold    cs>|sdSfdd|dD}|r4|d|d<d|S)z6Indent text by prepending a given prefix to each line.rcsg|]}|qSrrrqrprefixrrr:sz"TextDoc.indent.<locals>.<listcomp>rr)rrr!)r>r/rr#rrrindent7szTextDoc.indentcCs$||}||d|dS)z&Format a section with a given heading.rr)rrr)r>rrZclean_contentsrrrr>szTextDoc.sectionNrc
	sd}|D]}t|tdkrr|\}}||t|}|rh||fkrhfdd|D}	|dd|	}|d}qt|tgkr|||||d}q|S)	zBRender in text a class tree as returned by inspect.getclasstree().rrc3s|]}t|VqdSrr))rqr:r'rrrMsz%TextDoc.formattree.<locals>.<genexpr>rr4rr)rr)r!r6)
r>r7r'r8rrr9r:r;r<rrrr6Es"
zTextDoc.formattreec	Cs$|j}tt|\}}|d||o(d|}t|dd}||}|dk	r`||d|d}|rt||d|}g}	t|tjD]<\}
}|dk	st	|p||krt
|
||r|	|
|fqg}t|tjD]F\}
}|dk	st
|st	||krt
|
||r||
|fqg}
t|tD]&\}
}t
|
||r.|
|
|fq.g}t}t|drt|jD]6\}}}|||r||d	n
||qx|||d
d|}g}t|tjD]0\}
}|j|dr|
|kr||
q|r6|||d
d|}|	rdd|	D}|t|d|g}|	D]\}
}||||
|qd||dd|}|rg}|D]\}
}||||
|q||dd|}|
r&g}|
D]"\}
}||j||
|ddq||dd|}t|drt|j}|dddkrp|dddkrp|dd}||d|}t|dr||dt|j }t|dr||dt|j!}t|d r||d!t|j"}zt#|}Wnt$k
rd"}YnX||d#|}|S)$z5Produce text documentation for a given module object.NAME - rGNzMODULE REFERENCEa.

The following documentation is automatically generated from the Python
source files.  It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations.  When in doubt, consult the module reference at the
location listed above.
ZDESCRIPTIONrR
 (package)zPACKAGE CONTENTSrrZ
SUBMODULEScSsg|]\}}|qSrrrErrrrsz%TextDoc.docmodule.<locals>.<listcomp>rCLASSES	FUNCTIONSF)r4ZDATArXr>r?rr@ZVERSIONrQZDATErWZAUTHORrUZCREDITSrZFILE)%r%r$rrr<rrrAr+rLrfr
r,r;r.setrcrNrOrRaddr~r!r*rar6rPrrrJrXrrQrWrUrr})r>rr(rQZsynopdescrrdrr-rHrIr,rVrWZ
modpkgs_namesrXr'rYZ
submodulesrZrrUrrrrrUs
	



$
zTextDoc.docmodulec	sLj}|p|}j}jfdd}||kr:d|}n|d|}|rlt||}	|dd|	}g}
|
jzt}Wnt	t
fk
rd}YnX|rt|}|r|dkrʈ||d	t}
|
r|
d	t
t}t|d
kr*d|D]}d||q
d
tddtDtjd}t|}d}|rd|d|D]}d|qn||krdt||dd
Gfddd}|fdd}fdd}fdd}fddtD}|r|r*|n|dd
t|fd d!\}}tjk	rntjkrn|}qn kr~d"}nd#tj}t||d$||d%d!}|d&||d'd!}|d(||d)d!}|d*||d+d!}|d,||d-d!}|d.||d/d!}|}qd	|
}
|
s0|d	S|d	|
d0d	S)1z4Produce text documentation for a given class object.cSs
t||Srr)r:rrrrmakenamesz"TextDoc.docclass.<locals>.makenameclass z	 = class rr4NrrrzMethod resolution order:rrcss.|]&}|jds|jdkrt|jVqdS)r_rN)r%rar&rJ)rqrprrrrs
z#TextDoc.docclass.<locals>.<genexpr>r{rzBuilt-in subclasses:z    ... and z other subclassescs eZdZddZfddZdS)z(TextDoc.docclass.<locals>.HorizontalRulecSs
d|_dSrur[rrrrrsz1TextDoc.docclass.<locals>.HorizontalRule.__init__cs|jrdd|_dS)NzF----------------------------------------------------------------------rr[rr\rrr^sz.TextDoc.docclass.<locals>.HorizontalRule.maybeNr_rr\rrr`sr`c
st||\}}|r~||D]V\}}}}zt|}Wn&tk
rf||Yq&X||q&|SrrbrdrirQrr]r>rrrkszTextDoc.docclass.<locals>.spillcsJt||\}}|rF||D]\}}}}||q&|Srrlrdrmrrrnsz*TextDoc.docclass.<locals>.spilldescriptorsc
	st||\}}|r||D]v\}}}}t|sDt|rNt|}nd}zt|}	Wntk
r~|j|}	YnXj	|	|d|ddq&|S)Nr)r4r"r)
rOr^rorrjrr<r__dict__r)
rerrMrfr(rorgrIr"rerrrrps 
z#TextDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|dr||||fqSrqrrrsr-rrr+s
z$TextDoc.docclass.<locals>.<listcomp>rcs|dkSrurrCrvrrry4rzz"TextDoc.docclass.<locals>.<lambda>rxryzMethods %s:
cSs|ddkSrzrrCrrrryCrzzClass methods %s:
cSs|ddkSr|rrCrrrryErzzStatic methods %s:
cSs|ddkSr}rrCrrrryGrzzReadonly properties %s:
cSs|ddkSr~rrCrrrryIrzzData descriptors %s:
cSs|ddkSrrrCrrrryKrzzData and other attributes %s:
cSs|ddkSrrrCrrrryMrzz |  )r%rBr&rmapr!r
rrrr}rJrrrr sortedr__subclasses__rrirrOrrr)rrr)r>rr(rQrRrr;rrr<rrrr"rrJZ
subclassesZno_of_subclassesZMAX_SUBCLASSES_TO_DISPLAYZsubclassnamer`rkrnrprrrr)rirQrr]r>rwrrs



	










zTextDoc.docclasscCsd||SrrrrrrrWszTextDoc.formatvaluec	Cs|j}|p|}d}d}t|rn|jj}|rB||k	rndt||}n,|jdk	r`dt|jj|}ndt||}t|st|rd}	nd}	||kr||}
n,|rt	||g|krd}||d	|}
d}t
|r<zt|}Wntt
fk
rd}YnX|r<t|}|d
kr<||d}
|dd}|sFd
}|	|
||}
|rd|
dSt|ppd}|
d|o||dSdS)z;Produce text documentation for a function or method object.rrrNrrrr = rz lambda rrr)r%r?r9rr)rrrrrr,rrr}rJrrr)r>rr(rQrFrrrrrrrrrr"rrrr[sV



zTextDoc.docroutinecCsTg}|j}|r$||||dt|p.d}|rJ||||dd|S)z1Produce text documentation for a data descriptor.rr)r
rrrr!rrrrrszTextDoc.docdatac
Cs||}|rF|r|dpd|}|t|}	|	dkrF|d|	d}|rX||dpZd|}|dk	r~|d|t|7}|S)z-Produce text documentation for a data object.rrrNr2r)rr rrrJ)
r>rr(rQr8r4r"rrZchoprrrrs
zTextDoc.docother)r)Nr)NN)NN)NNN)NNN)NNNNN)r%r&rSrVrrrrrrr6rrrrrrrrrrrr+s


e

7
rc@seZdZdZddZdS)
_PlainTextDocz2Subclass of TextDoc which overrides string stylingcCs|Srrrrrrrsz_PlainTextDoc.boldN)r%r&rSrVrrrrrrsrcCstat|dS)zCThe first time this is called, determine what kind of pager to use.N)getpagerpagerr7rrrrsrc	s@ttjdstSttjds tStjr4tjs8tStjdpNtjdrtj	dkrjfddStjddkrfd	dSfd
dStjddkrtStj	dkrddSttdrt
d
dkrddSddl}|\}}t
|z8ttdr$t
d|dkr$ddWStWSW5t|XdS)z2Decide what method to use for paging through text.isattyZMANPAGERZPAGERwin32cstt|Sr
tempfilepagerplainr7Z	use_pagerrrryrzzgetpager.<locals>.<lambda>ZTERM)ZdumbZemacscstt|Sr)	pipepagerrr7rrrryrzcs
t|Srrr7rrrryrzcSstt|dS)Nzmore <rr7rrrryrzsystemz(less) 2>/dev/nullrcSs
t|dS)NZlessrr7rrrryrzNz	more "%s"cSs
t|dS)NZmorerr7rrrryrz)rcrstdin
plainpagerstdoutrr	rrvplatformrtempfileZmkstempcloseunlinkttypager)rfdrrrrrs6


 rcCstdd|S)z%Remove boldface formatting from text.z.r)rrr7rrrrsrc	Csddl}|j|d|jd}zDtj|jdd*}z||Wntk
rPYnXW5QRXWntk
rrYnXz|	WqWqttk
rYqtXqtdS)z3Page through text by feeding it to another program.rNT)shellrbackslashreplace)errors)

subprocessPopenPIPEio
TextIOWrapperrwriteKeyboardInterruptrwait)r/cmdrprocpiperrrrsrc
Cs~ddl}|d}tj|d}t|ddtjdkr<tdndd}|	|W5QRXt
|d|d	W5QRXdS)
z<Page through text by invoking a program on a temporary file.rNz	pydoc.outwrr)rencodingz "r%)rZTemporaryDirectoryr	rr!rrrdevice_encodingrr)r/rrZtempdirrrrrrrs
rcCs$ttjddpd}||d|S)Nrutf-8r)r<rrencodedecode)r/rrrr_escape_stdoutsrc
Cstt|d}z2ddl}tj}||}||dd}Wn(t	t
tjfk
rld}dd}YnXz0zttjdd}Wntk
rd}YnX|dkrd	}|d}}tjd|d|d||drtjd
tj|}	|	dkrtjdqn,|	d
krJtjd||d|d}q|	dkrn|||}|dkrnd}tjdd||||d||}qW5|r|
||j|XdS)z%Page through text on a text terminal.rrNcSstjdSr@)rrrrrrrryrzzttypager.<locals>.<lambda>cSstjddddS)Nrr)rrrrrrrryrzZLINESrz
-- more --)qQz
          
)
r)bB)rrrttyrrfilenoZ	tcgetattrZ	setcbreakrrrUnsupportedOperationZ	tcsetattrZ	TCSAFLUSHr+r	rrvrrrr!flush)
r/r#rroldZgetcharhrZincr:rrrr	sL








&rcCstjtt|dS)z>Simply print unformatted text.  This is the ultimate fallback.N)rrrrrr7rrrr5srcCst|r>|jtjkr d|jSt|dr4d|jSd|jSt|rRd|jSt|rtd|jj	|jj|jfSt
|rd|jj	|jj|jfSt|rd|jSt|rd	|jSt
|rd
|jSt|jS)z/Produce a short description of the given thing.zbuilt-in module rRzpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%srz	function zmethod )rr*r%rrrcr;Zisgetsetdescriptor__objclass__r&Zismemberdescriptorr+rMr:r)thingrrrdescribe9s6














rc	Csdd|dD}d\}}|t|kr\td|d|d|}|r\||d}}qq\q|rf|}nt}||dD],}zt||}Wqvtk
rYdSXqv|S)z@Locate an object by name or dotted path, importing as necessary.cSsg|]}|r|qSrr)rqrrrrrVszlocate.<locals>.<listcomp>rruNr)rr rr!rr<r)rrrSrnZ
nextmodulerrrrrlocateTs rcCsVt|tr0t||}|dkr(td|||fSt|dd}|t|trL|ndfSdS)zDGiven an object or a path to an object, get the object and its name.Nz~No Python documentation found for %r.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.r%)rkrJrrr<)rrrr(rrrresolvems

r Python Library Documentation: %scCs|dkrt}t||\}}t|}t|}|rTd|krT|d|d|d7}n|rn||k	rn|d|j7}t|st|st	|st
|st|}|d7}||d|||S)zBRender text documentation, given an object or a path to an object.Nrz in z in module z objectr)
r/rrrrLrfindr%r*r+r,rjrr)rrrZrendererrr(rrrrr
render_doc{s&

rc
Csfz2|dkrtt|||n|t|||tWn.ttfk
r`}zt|W5d}~XYnXdS)zCDisplay text documentation, given an object or a path to an object.N)rrr	plaintextrrprint)rrroutputrIrrrr"sr"c
Csz`t||\}}tt|t||}t|dddd}||W5QRXtd|dWn.tt	fk
r}zt|W5d}~XYnXdS)z<Write HTML documentation to a file in the current directory.rrr)rZwroteN)
rhtmlrrrrrrrr)rrrr(rrrIrrrwritedocsrrcCs2|dkri}t|g|D]\}}}t|qdS)zAWrite out HTML documentation for all modules in a directory tree.N)rN
walk_packagesr)rpkgpathZdonerXr'rYrrr	writedocss

r
cJ@s"eZdZddddddddddd	d
ddd
ddddddddddddddddddddd#Zd d!d"DZded'd(d)d*d+d,d-Zd.d/d0d1d2d3d4d5d6d7d8d9d9d:d:d;ZeD]:\ZZ	e	D],Z
ee
eZeekred<eZeee
<qqd=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdLdMdNdOdPdQddRdSdSdTdUdVdWdXdYdZd[d\d]d^d_d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{ddd|d}d~ddIZdddZ
eddZeddZddZeZefddZddZddZddZddZdddZddZddZddZdddZdddZddZdddZ dS)HelperrBOOLEANwith)assertr)asyncr)awaitr)break	while for)classzCLASSES SPECIALMETHODS)continuer)Zfunctionr)delBASICMETHODSif)elsertry)forzbreak continue whileimport)globalznonlocal NAMESPACES)r
TRUTHVALUE)rMODULES)inSEQUENCEMETHODS
COMPARISON)lambdar)nonlocalzglobal NAMESPACES)passr)raise
EXCEPTIONS)returnr)rr&)whilezbreak continue if TRUTHVALUE)r
z CONTEXTMANAGERS EXCEPTIONS yield)yieldr)#FalseNoneTrueandasrrrrrrdefrelifrexceptfinallyrfromrrrrisr"r#notorr$r%r'rr(r
r)cCsg|]}dD]}||qqS)'r%r)rqprrrrrszHelper.<listcomp>)rfrur8'''r%r)+rt***rz//%<<>>r|^~rr<=>===!=<>)rrrFrGrHrIrJ)rtrE)z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//=)rArBrrCrDrE)jJ)STRINGS	OPERATORSr!UNARYAUGMENTEDASSIGNMENTBITWISECOMPLEXzOPERATORS FORMATTINGPOWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTSELLIPSISzSLICINGS DICTIONARYLITERALSz	def classrMPRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ
BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)r@r?,rr2:@rr_r^`r&r5[]r)typeszRSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect)stringsz4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES)zstring-methodszSTRINGS FORMATTING)Z
formatstringsrN)r]z:encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPES)ZnumberszINTEGER FLOAT COMPLEX TYPES)Zintegersz	int range)Zfloatingz
float math)Z	imaginaryz
complex cmath)Ztypesseqz$STRINGMETHODS FORMATTING range LISTSDICTIONARIES)Ztypesfunctionsz	def TYPES)Ztypesmethodszclass def CLASSES TYPES)zbltin-code-objectszcompile FUNCTIONS TYPES)zbltin-type-objectsztypes TYPESTYPES)zbltin-null-objectr)zbltin-ellipsis-objectSLICINGS)Zspecialattrsr)r\z!class SPECIALMETHODS PRIVATENAMES)Ztypesmodulesr)zoperator-summaryzlambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIESEXPRESSIONS)Zobjectsr_)ZspecialnameszbBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES)Z
customizationzhash repr str SPECIALMETHODS)zattribute-accesszATTRIBUTES SPECIALMETHODS)zcallable-typeszCALLS SPECIALMETHODS)sequence-typesz(SEQUENCES SEQUENCEMETHODS SPECIALMETHODS)rbzMAPPINGS SPECIALMETHODS)z
numeric-typesz*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS)Z	execmodelz%NAMESPACES DYNAMICFEATURES EXCEPTIONS)Znamingz3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES)zdynamic-featuresr
NAMESPACES)rztry except finally raise)Zconversionsr)Zidentifierszkeywords SPECIALIDENTIFIERS)z
id-classesr)zatom-identifiersr)z
atom-literalsz=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS	SEQUENCES)Z	exprlistszTUPLES LITERALS)ztypesseq-mutableLISTLITERALS)ZlistszLISTS LITERALS)ZtypesmappingDICTIONARYLITERALS)rzDICTIONARIES LITERALS)zattribute-referencesz(getattr hasattr setattr ATTRIBUTEMETHODS)Z
subscriptionsr )Zslicingsr )Zcallsra)Zpowerra)Zunaryra)Zbinaryra)Zshiftingra)Zbitwisera)ZcomparisonszEXPRESSIONS BASICMETHODS)ZbooleanszEXPRESSIONS TRUTHVALUEr)Z
assignmentrP)Z	augassign
NUMBERMETHODSrr')Zcompoundzfor while break continue)truthz if while and or not BASICMETHODS)ZdebuggerZpdb)zcontext-managersr
)Ir_rMZ
STRINGMETHODSZ
FORMATTINGUNICODEZNUMBERSZINTEGERZFLOATrRrdZMAPPINGSrZMETHODSZCODEOBJECTSZTYPEOBJECTSZFRAMEOBJECTSZ
TRACEBACKSZNONErTZSPECIALATTRIBUTESrrZPACKAGESrarNZ
PRECEDENCEZOBJECTSZSPECIALMETHODSrZATTRIBUTEMETHODSZCALLABLEMETHODSr ZMAPPINGMETHODSrgZ	EXECUTIONrcZDYNAMICFEATURESZSCOPINGZFRAMESr&ZCONVERSIONSZIDENTIFIERSZSPECIALIDENTIFIERSrUZLITERALSZTUPLESZ
TUPLELITERALSZLISTSrer^rfZ
ATTRIBUTESZ
SUBSCRIPTSr`ZCALLSrSrOZBINARYZSHIFTINGrQr!rZ	ASSERTIONZ
ASSIGNMENTrPZDELETIONZ	RETURNINGZ	IMPORTINGZCONDITIONALZLOOPINGrZ	DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dSr)_input_output)r>inputrrrrr^szHelper.__init__cCs|jp
tjSr)rjrrrrrrrlbszHelper.inputcCs|jp
tjSr)rkrrrrrrrfsz
Helper.outputcCs2tdddkr|dSd|jj|jjfS)Nrr1?rz<%s.%s instance>)rstackrr&rSrrrr__repr__jszHelper.__repr__cCs6||jk	r||n|||jddS)Na
You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)".  Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.
)_GoInteractiverintrointeractrrr>Zrequestrrr__call__rs

zHelper.__call__c	Cs|jdz|d}|s WqWnttfk
r>YqYnX|}t|dkr|d|dkrpdkrnn |d|ddkr|dd}|dkrq|d	kr|q|	|qdS)
Nrzhelp> rrrr7r)rquitr)
rrgetlinerEOFErrorrr rrqrrsrrrrrs"

,
zHelper.interactcCs8|jtjkrt|S|j||j|jSdS)z.Read one line, using input() when appropriate.N)rlrrrrrr)r>promptrrrrvs

zHelper.getlinecCs<t|tdkr|}|dkr,|n|dkr>|n|dkrP|n|dkrb|n|dddkr||dn||jkr||nj|d	krt	t
|d
nR||jkr||n<||j
kr||n&|rt	|d
|jdnt	td
|jdn$t|tr|nt	|d
|jd|jddS)
Nrkeywordssymbolstopicsrzmodules r)r,r*r+zHelp on %s:)rr)rrlistkeywordslistsymbols
listtopicslistmodulesrrz
showsymbolr"evalry	showtopicr{rkrJrkrrrrsrrrrs6






zHelper.helpcCs$|jddtjdddS)Na
Welcome to Python {0}'s help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/{0}/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".
z%d.%dr)rrrrrrrrrrqs
zHelper.introrPc	
Cstt|}||}t||d|}t|D]v}t|D]\}|||}|t|kr<|j||||dkr<|jdd|dt||q<|jdq0dS)Nrrr)rrr rrr)	r>itemscolumnsr
Zcolwrrowrrrrrrrs&zHelper.listcCs |jd||jdS)NzN
Here is a list of the Python keywords.  Enter any keyword to get more help.

)rrrryrErrrrr}szHelper.listkeywordscCs |jd||jdS)Nzx
Here is a list of the punctuation symbols which Python assigns special meaning
to. Enter any symbol to get more help.

)rrrrzrErrrrr~szHelper.listsymbolscCs |jd||jdS)NzN
Here is a list of available topics.  Enter any topic name to get more help.

)rrrr{rErrrrrszHelper.listtopicscCs0zddl}Wn"tk
r.|jdYdSX|j||j|}|sb|jdt|dSt|tdkr~|	||S|\}}z|jj|}Wn*t
k
r|jdt|YdSX|d}|r|pdd|}|r$ddl}dd
|d}	||	d	}
|d
d
|
7}t|dS)Nrt
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
zno documentation found for %s
rrrRelated help topics: r4Hz
%s
)pydoc_data.topicsrrrr{rvryrrrKeyErrorrtextwrapr!rZwrapr)r>topic
more_xrefs
pydoc_datatargetlabelxrefsr"rr/Zwrapped_textrrrrs4zHelper.showtopiccCszddl}Wntk
r"YdSX|j||j|}|sFtdt|tr\|||S|\}}|jj|}|r|pzdd|}||fS)a*Return unbuffered tuple of (topic, xrefs).

        If an error occurs here, the exception is caught and displayed by
        the url handler.

        This function duplicates the showtopic method but returns its
        result directly so it can be formatted for display in an html page.
        rN)rrzcould not find topicrr)	rrr{rvryrrkrJ	_gettopic)r>rrrrrrr"rrrrs	
zHelper._gettopiccCs*|j|}|d\}}}|||dS)Nr)rz	partitionr)r>symbolrrr_rrrrr!s
zHelper.showsymbolcsv|r |jd|t|nR|jdi}|fddfdd}tj|d|||jddS)	Nzy
Here is a list of modules whose name or summary contains '{}'.
If there are any, enter a module name to get more help.

zI
Please wait a moment while I gather a list of all available modules...

cSs>|r$|dddkr$|ddd}|ddkr:d||<dS)N	.__init__rrrr)find)rr'rrrrrcallback4sz$Helper.listmodules.<locals>.callbackcsd|ddSrrrrrronerror9sz#Helper.listmodules.<locals>.onerrorrz
Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".
)rrrapropos
ModuleScannerrunrrE)r>rHrrrrrr&s

zHelper.listmodules)r8r<r%r)NN)rr)r)r)r)!r%r&rSryZ_strprefixesZ_symbols_inverserzrrZsymbols_rrvr{rrlrlrrorrprtrrrvrrqrr}r~rrrrrrrrrrsB'W



	


 
rc@seZdZdZdddZdS)rz7An interruptible scanner that searches module synopses.Nc	Cs
|r|}d|_i}tjD]p}|dkrd||<|dkrF|d|dqt|jpRd}|dd}|d|}||dkr|d||qtj	|dD]\\}	}}
|jrq|dkr|d|dqzt
|	|}Wntk
rYqYnX|j}t
|d	rnz||}
Wn(tk
r:|r2||YqYnXtt|
pNd}t
|d
rh||}nd}n`ztj|}Wn(tk
r|r||YqYnX|jr|jdnd}t|dd}|d|}||dkr||||q|r|dS)NF__main__rrrrrr
get_sourceget_filenamerY)rrurrrrVrrrNr	_get_specrrrcrrcrrStringIOrrrrrrr<)r>rrHZ	completerrseenr'r(rrXrYrrsourcerrrrrrGs`



zModuleScanner.run)NNN)r%r&rSrVrrrrrrDsrc	CsDdd}dd}t"tdtj|||dW5QRXdS)zAPrint all the one-line module summaries that contain a substring.cSs6|dddkr |ddd}t||o.d|dSNrrrz- )rrr'rrrrrszapropos.<locals>.callbackcSsdSrrrrrrrszapropos.<locals>.onerrorignorerN)warningscatch_warningsfilterwarningsrr)rHrrrrrrs


rcsddlddlddlddlGdddjjGfdddjjGfdddj}||||}||j	s|j
std	q~|S)
aAStart an HTTP server thread on a specific port.

    Start an HTML/text server thread, so HTML or text documents can be
    browsed dynamically and interactively with a Web browser.  Example use:

        >>> import time
        >>> import pydoc

        Define a URL handler.  To determine what the client is asking
        for, check the URL and content_type.

        Then get or generate some text or HTML code and return it.

        >>> def my_url_handler(url, content_type):
        ...     text = 'the URL sent was: (%s, %s)' % (url, content_type)
        ...     return text

        Start server thread on port 0.
        If you use port 0, the server will pick a random port number.
        You can then use serverthread.port to get the port number.

        >>> port = 0
        >>> serverthread = pydoc._start_server(my_url_handler, port)

        Check that the server is really started.  If it is, open browser
        and get first page.  Use serverthread.url as the starting page.

        >>> if serverthread.serving:
        ...    import webbrowser

        The next two lines are commented out so a browser doesn't open if
        doctest is run on this module.

        #...    webbrowser.open(serverthread.url)
        #True

        Let the server do its thing. We just need to monitor its status.
        Use time.sleep so the loop doesn't hog the CPU.

        >>> starttime = time.monotonic()
        >>> timeout = 1                    #seconds

        This is a short timeout for testing purposes.

        >>> while serverthread.serving:
        ...     time.sleep(.01)
        ...     if serverthread.serving and time.monotonic() - starttime > timeout:
        ...          serverthread.stop()
        ...          break

        Print any errors that may have occurred.

        >>> print(serverthread.error)
        None
   rNc@seZdZddZddZdS)z!_start_server.<locals>.DocHandlercSsX|jdrd}nd}|d|dd|||j||j|ddS)	zProcess a request from an HTML browser.

            The URL received is in self.path.
            Get an HTML page from self.urlhandler and send it.
            z.csstext/css	text/htmlzContent-Typez%s; charset=UTF-8rN)	rrbZ
send_responseZsend_headerZend_headersZwfiler
urlhandlerr)r>content_typerrrdo_GETs

z(_start_server.<locals>.DocHandler.do_GETcWsdSrr)r>rrrrlog_messagesz-_start_server.<locals>.DocHandler.log_messageN)r%r&rSrrrrrr
DocHandlersrcs(eZdZddZfddZddZdS)z _start_server.<locals>.DocServercSs6||_|j|f|_||_|j||j|jd|_dSNF)hostZaddressrrJrhandlerru)r>rportrrrrrs
z)_start_server.<locals>.DocServer.__init__cs>|js2|jgggd\}}}|r|q|dSr@)ruselectZsocketrZhandle_requestZserver_close)r>ZrdZwrZexrrrserve_until_quits

z1_start_server.<locals>.DocServer.serve_until_quitcSs |j||jr||dSr)rJserver_activaterrrrrrsz0_start_server.<locals>.DocServer.server_activateN)r%r&rSrrrrrrr	DocServersrcs:eZdZfddZfddZddZddZd	S)
z#_start_server.<locals>.ServerThreadcs2||_||_t||_j|d|_d|_dSr)rrr+rThreadrservingerror)r>rrr)	threadingrrrs
z,_start_server.<locals>.ServerThread.__init__c
sxzJjj__jj_t|j_|j	|j
|j}||_|
Wn(tk
rr}z
||_W5d}~XYnXdS)zStart the server.N)server
HTTPServerrJrrZMessageZMessageClassstaticmethodrrrready	docserverrrcr)r>Zdocsvre)rremailhttprrr	s

z'_start_server.<locals>.ServerThread.runcSs,d|_|j|_|j|_d|j|jf|_dS)NTz
http://%s:%d/)rrZserver_portrr")r>rrrrr	sz)_start_server.<locals>.ServerThread.readycSs&d|j_|d|_d|_d|_dS)z&Stop the server and this thread nicelyTNF)rrur!rr"rrrrstop	s
z(_start_server.<locals>.ServerThread.stopN)r%r&rSrrrrr)rrrrrrrServerThreads
rg{Gz?)
Zhttp.serverZ
email.messagerrrZBaseHTTPRequestHandlerrrr1rrtimesleep)rhostnamerrthreadr)rrrrrrr
_start_servers8'rrc
s(Gfdddt}|fddfddfddfd	d
fddfd
dfddfddfdd}|dr|dd}|dkrtjtjt}tj||}t|}d|	W5QRSQRXn|dkr||St
d||fdS)aThe pydoc url handler for use with the pydoc server.

    If the content_type is 'text/css', the _pydoc.css style
    sheet is read and returned if it exits.

    If the content_type is 'text/html', then the result of
    get_html_page(url) is returned.
    cseZdZfddZdS)z_url_handler.<locals>._HTMLDoccsd}d|}d|||fS)rzpydoc_data/_pydoc.cssz1<link rel="stylesheet" type="text/css" href="%s">a<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Pydoc: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
%s</head><body bgcolor="#f0f0f8">%s<div style="clear:both;padding-top:.5em;">%s</div>
</body></html>r)r>rrcss_pathZcss_linkhtml_navbarrrr2	sz#_url_handler.<locals>._HTMLDoc.pageN)r%r&rSrrrrr_HTMLDoc0	srcs>dttdtf}d|tjddfS)Nz%s [%s, %s]raZ
            <div style='float:left'>
                Python %s<br>%s
            </div>
            <div style='float:right'>
                <div style='text-align:center'>
                  <a href="index.html">Module Index</a>
                  : <a href="topics.html">Topics</a>
                  : <a href="keywords.html">Keywords</a>
                </div>
                <div>
                    <form action="get" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Get">
                    </form>&nbsp;
                    <form action="search" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Search">
                    </form>
                </div>
            </div>
            T)Zterse)rrZpython_versionZpython_buildZpython_compiler)rUrrrrB	s
z!_url_handler.<locals>.html_navbarcsdd}ddd}ddtjD}||}|dd	dd
|g}i}tjD]}|||qT|ddd
|fS)zModule Index page.cSsd||fSNrrr(rrr	bltinlink`	sz3_url_handler.<locals>.html_index.<locals>.bltinlinkz7<big><big><strong>Index of Modules</strong></big></big>rArBcSsg|]}|dkr|qS)rr)rqr(rrrrf	sz4_url_handler.<locals>.html_index.<locals>.<listcomp>z<p>zBuilt-in ModulesrFz|<p align=right><font color="#909090" face="helvetica,arial"><strong>pydoc</strong> by Ka-Ping Yee&lt;ping@lfw.org&gt;</font>zIndex of Modulesr)	rrrrrrr
rr!)rrnamesrrrrrr
html_index]	s*
z _url_handler.<locals>.html_indexc		sgfdd}t*tddd}tj|||dW5QRXdd}g}d	d
d}D]\}}||||qf|d|d
d
d|}d|fS)zSearch results page.cs:|dddkr |ddd}||o0d|fdSrrKrZ
search_resultrrr{	sz3_url_handler.<locals>.html_search.<locals>.callbackrcSsdSrrrrrrr	sz2_url_handler.<locals>.html_search.<locals>.onerrorrcSsd||fSrrrrrrr	sz4_url_handler.<locals>.html_search.<locals>.bltinlinkz5<big><big><strong>Search Results</strong></big></big>rArBzkey = %srF<br>zSearch Results)	rrrrrrr
rr!)	rHrrrrnrr(rrrrrhtml_searchv	s,

z!_url_handler.<locals>.html_searchcsLdd}ddd}ttj}||}|ddd|}d|fS)zIndex of topic texts available.cSsd||fSNz<a href="topic?key=%s">%s</a>rrrrrr	sz4_url_handler.<locals>.html_topics.<locals>.bltinlink,<big><big><strong>INDEX</strong></big></big>rArBZTopicsrF)rrrr{rErr)rrrrrrrhtml_topics	sz!_url_handler.<locals>.html_topicscsLddd}ttj}dd}||}|ddd|}d|fS)zIndex of keywords.rrArBcSsd||fSrrrrrrr	sz6_url_handler.<locals>.html_keywords.<locals>.bltinlinkZKeywordsrF)rrrryrErr)rrrrrrr
html_keywords	sz#_url_handler.<locals>.html_keywordscst}t||}||\}}||jkr0d}nd}d|dd}d|}|dd|}|rt|	}dd	}
||}d
dd|}d||fd|||ffS)
zTopic or keyword help page.ZKEYWORDZTOPICr=rArBz
<pre>%s</pre>rFcSsd||fSrrrrrrr	sz7_url_handler.<locals>.html_topicpage.<locals>.bltinlinkrz%s %sr)
rrrrryrr3rrrrrr!)rZbufZhtmlhelprrrrrrrrhtml_topicpage	s2


z$_url_handler.<locals>.html_topicpagecs@t|dd}|dkr$|dkr$tdt|}||}||fS)Nr)rr+zcould not find object)rrrr)r"rercontentrrrhtml_getobj	sz!_url_handler.<locals>.html_getobjcsPddd}dfddtt||D}||dd|}d||fS)	Nz,<big><big><strong>Error</strong></big></big>rArBrc3s|]}|VqdSr)rrrrrr	sz3_url_handler.<locals>.html_error.<locals>.<genexpr>z#bb0000z
Error - %s)rr!rrr)r"rrrrrr
html_error	sz _url_handler.<locals>.html_errorc
sr|}|dr|dd}z|dkr2\}}n|dkrF\}}n|dkrZ\}}nd|kr$|d\}}}|dkr|\}}n|d	krz|\}}Wn tk
r|\}}YnXn\|d
kr|dkr\}}n4z|\}}Wn"tk
r|\}}YnXntdn|\}}Wn2tk
rd}z||\}}W5d}~XYnX||S)zGenerate an HTML page for url.rN)rrr{ryrz
search?keyz	topic?keyzget?keyz
bad pydoc url)rbrrrcr)r"Zcomplete_urlrropr_r)rrrrrrrrrr
get_html_page	s>



 z#_url_handler.<locals>.get_html_pagerrNrrrz"unknown content type %r for url %s)rrar	rdirnamerealpathrYr!r	readlinesr})r"rrrZ	path_hererfpr)	rrrrrrrrrr_url_handler'	s*	
(


"
rT	localhost)open_browserrc	Csddl}tt||}|jr(t|jdS|jrd}|rB||jz~zZtd|jt||jrt	d}|
}|dkr|qqZ|dkr||jqZt|qZWnttfk
rtYnXW5|jr|tdXdS)	zStart the enhanced pydoc Web server and open a Web browser.

    Use port '0' to start the server on an arbitrary port.
    Set open_browser to False to suppress opening a browser.
    rNz"Server commands: [b]rowser, [q]uitzServer stoppedzServer ready atzserver> rr)
webbrowserrrrrrrr"rrlrrrw)rrrrZserverthreadZserver_help_msgrrrrbrowse
s2
rcCst|to|tjdkSru)rkrJrr	sep)rNrrrispath9
srcCsvd|kstj|kst|kr"dStjt}tj|}|}||krbtj||sb|||	dt|S)zEnsures current directory is on returned path, and argv0 directory is not

    Exception: argv0 dir is left alone if it's also pydoc's directory.

    Returns a new path entry list, or None if no adjustment is needed.
    rNr)
r	curdirgetcwdrrrYcopysamefileremoveinsert)Z
given_pathZargv0Z
stdlib_dirZ
script_dirrevised_pathrrr_get_revised_path<
s

rcCs,ttjtjd}|dk	r(|tjdd<dS)zEnsures current directory is on sys.path, and __main__ directory is not.

    Exception: __main__ dir is left alone if it's also pydoc's directory.
    rN)rrrargv)rrrr_adjust_cli_sys_pathX
srcCsddl}Gdddt}tzv|tjddd\}}d}d}d}d}d}|D]\\}	}
|	d	krld
}d
}|	dkrt|
WdS|	dkrd
}|
}|	d
krd
}|	dkrTd
}|
}qT|rt|||dWdS|s||D]}t|rtj	
|std|qz`t|r&tj	|r&t
|}|rXt|rNtj	|rNt|nt|n
t|Wqtk
r}zt|W5d}~XYqXqWnN|j|fk
rtj	tj	tjdd}
tdj|
tjdYnXdS)z@Command-line interface (looks at sys.argv to decide what to do).rNc@seZdZdS)zcli.<locals>.BadUsageN)r%r&rSrrrrBadUsagee
srrzbk:n:p:wFrz-bTz-kz-pz-wz-n)rrzfile %r does not existapydoc - the Python documentation tool

{cmd} <name> ...
    Show text documentation on something.  <name> may be the name of a
    Python keyword, topic, function, module, or package, or a dotted
    reference to a class or function within a module or module in a
    package.  If <name> contains a '{sep}', it is used as the path to a
    Python source file to document. If name is 'keywords', 'topics',
    or 'modules', a listing of these things is displayed.

{cmd} -k <keyword>
    Search for a keyword in the synopsis lines of all available modules.

{cmd} -n <hostname>
    Start an HTTP server with the given hostname (default: localhost).

{cmd} -p <port>
    Start an HTTP server on the given port on the local machine.  Port
    number 0 can be used to get an arbitrary unused port.

{cmd} -b
    Start an HTTP server on an arbitrary unused port and open a Web browser
    to interactively browse documentation.  This option can be used in
    combination with -n and/or -p.

{cmd} -w <name> ...
    Write out the HTML documentation for a module to a file in the current
    directory.  If <name> contains a '{sep}', it is treated as a filename; if
    it names a directory, documentation is written for all the contents.
)rr)getoptrcrrrrrrr	rexistsrrrrr
rrrrrrrr)rrZoptsrZwritingZstart_serverrrroptvalargrIrrrrclib
sd

 rr)NN)r)r)rrN)rrN)r)rN)r)r)ZrVrGrWrQrUrZimportlib._bootstraprZimportlib._bootstrap_externalimportlib.machineryimportlib.utilrrr	rNrrrrrrZurllib.parserHrcollectionsrreprlibr	tracebackrrrr$r)r.r0r5r'
IGNORECASEr6r8r?rDrOrfrirrrrrcrrrrrrrrrrrrrrrrrrrr/rrrrr"rr
rrrrrrrrrrrr%rrrr<module>s&
	


'
0:*> ",





=
n%
U