%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python3.8/__pycache__/
Upload File :
Create Path :
Current File : //usr/local/lib/python3.8/__pycache__/pydoc.cpython-38.pyc

U

na@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)dirsZnormdirsdirnormdirr!/usr/local/lib/python3.8/pydoc.pypathdirsQs

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)doclinesrrrsplitdocbs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	classnameks
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	isroutineZisframeZistracebackZiscoderrrrisdatarsr/cGs.|r*|d||d}|dd}q|S)z/Do a series of global replacements on a string.rrrN)r"r )textZpairsrrrreplacexsr1cCsXt||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)r0maxlenpreZpostrrrcrams
$r7z at 0x[0-9a-f]{6,16}(>+)$cCstd|S)z>Remove the hexadecimal id from a Python object representation.z\1)_re_stripidrr0rrrstripidsr:cCs<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

rAcCs^i}t|tjD]\}}d||<q|jD]}|t|q*|D]}t||||<qF|SNr)r
getmembersr-	__bases__update
allmethodskeysr>)clmethodskeyvaluebaserrrrFs

rFcCs8g}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	predicateZyesnoxrrr_split_listsrRcCs\|dkrdS|dr$|dr$dS|dr<t|dr<dS|dk	rL||kS|dSdS)	z3Decide whether to show documentation on a variable.>__doc____credits__
__author____file__	__slots____spec____qualname__
__cached____version__r&__builtins____date__
__loader__r'__package____path__r__r__fieldsTN)
startswithendswithhasattr)r)allobjrrrvisiblenamesricCsXg}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)kindclsrKrrrrls
rlcs\t|dgzfddtDWntk
r>iYnXfdd}|j|ddS)zGSort the attrs list in-place by _fields and then alphabetically by namerccsi|]\}}||tqSr)r!).0ir))fieldsrr
<dictcomp>sz#sort_attributes.<locals>.<dictcomp>cs|dd|dfSNr)get)attr)field_orderrr<lambda>z!sort_attributes.<locals>.<lambda>rJN)r>	enumerate	TypeErrorsort)attrsrZkeyfuncr)r{rvrsort_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"""r2"""\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_mtimeryretuple	importlib	machineryBYTECODE_SUFFIXESSourcelessFileLoaderEXTENSION_SUFFIXESExtensionFileLoadertokenizeopenOSErrorrutilspec_from_file_location
_bootstrap_loadrmodulesrS
splitlines)
filenamecachemtimeZ
lastupdaterZ
loader_clsrrspecmodulerrrsynopsiss6



rc@s eZdZdZddZddZdS)ErrorDuringImportzEErrors that occurred while trying to import something to document it.cCs||_|\|_|_|_dSN)rexcrKtb)r@rexc_inforrrr$szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)rr&rrK)r@rrrr__str__(szErrorDuringImport.__str__N)r&r'rYrSrrrrrrr"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)rd)rtmrrr
<listcomp>Rszsafeimport.<locals>.<listcomp>Nrr)rrbuiltin_module_names
__import__rrrVSyntaxErrorr
issubclassImportErrorr)r r>AttributeError)r	forceloadrZsubsrJrrrKrinfopartrrr
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-
docroutinerrmdocdatadocother)r@rr)argsrrrdocumentts




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
exceptionsgcZimpmarshalposixsignalr_threadZ	zipimportz
site-packages)z	xml.etreeztest.pydoc_mod)zhttp://zhttps://z%s/%s/.htmlN)r
getabsfilerr	environryrrrrnrr&rdr"rlower)r@rZbasedirrdoclocrrr	getdoclocs(

z
Doc.getdocloc)N)N)r&r'rYr	rryrversion_inforrrrrrrdocpropertyr	sysconfigZget_pathrrrrrrns

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;)r1r@r0rrrescapeszHTMLRepr.escapecCst||Sr)rrr@rrrrrsz
HTMLRepr.reprcCsZtt|dr@ddt|j}t||r@t||||S|ttt	||j
SNr&repr_rb)rfrr"r&r r>rr7r:rrr@rQlevelZ
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>)r7rrr1rrrr@rQrtestZtestreprrrrrepr_stringszHTMLRepr.repr_stringcCs@z|ttt||jWS|d|jjYSXdSNz
<%s instance>)rr7r:rr	__class__r&r@rQrrrr
repr_instanceszHTMLRepr.repr_instanceN)r&r'rYrSrrrrrrepr_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@r
fgcolbgcolextrasrrrheadingszHTMLDoc.headingNr
c	
Cs^|dkrdd|d}d|||f}	|r@|	d||||f}	n|	d|||f}	|	d|S)	z Format a section with a heading.Nz<tt>r
z</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@r
rrrwidthZpreludeZ
marginaliaZgaprrrrsections
zHTMLDoc.sectioncGsd|}|j|f|S)z$Format a section with a big heading.z<big><strong>%s</strong></big>)r)r@r
rrrr
bigsectionszHTMLDoc.bigsectionc
Cs&||}t|dddddddd	S)z!Format literal preformatted text.

z
 
rr
r<br>
)r
expandtabsr1rrrr	preformats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@listformatZcolsrrowscolrurrrmulticolumns
zHTMLDoc.multicolumncCsd|S)Nz<font color="#909090">%s</font>rrrrrgreyr}z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&rrryr'rfr>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)rrshadowedurlr0rrr
modpkglink2s

zHTMLDoc.modpkglinkcCsd||fS)zMake a link to source file.z<a href="file:%s">%s</a>r)r@r(rrrrfilelinkAszHTMLDoc.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;r!z'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
groupsr1intr#r")r@r0rfuncsclassesrIrqherepatternmatchstartendrgZschemeZrfcZpepZselfdotr)r(rrrmarkupEs:

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>
)rr$r
r"
formattree)
r@treer(parentrentrycbasesparentsrLrrrr<ps&

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>rr[$Revision: $z
version %sr]z (%s)r:z-<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>
r`rzPackage Contentsz#aa55cccs|dSrB)r&trrrr|r}z#HTMLDoc.docmodule.<locals>.<lambda>ZModulescSsg|]\}}|qSrrrtrJrKrrrrsz%HTMLDoc.docmodule.<locals>.<listcomp>ZClasses#ee77aarZ	Functionsz#eeaa77ZDataz#55aa55rrUZAuthorrTZCredits)6r&__all__rr rr!r
r"rrurllibparsequoter*rrfstrr[rrr]rlocalsrrCr+r,	getmodulerirDr'rrryr>r-r=
isfunctionr/r9rrpkgutiliter_modulesr`rrr)rr<getclasstreerrUrT)#r@rr)modignoredrgpartsZlinksruZ
linkednameheadrr(r*rversionrrrr3ZcdictrJrKrLr(rr2Zfdictdatar#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|rx|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}|gkspt|}q\d#|	}	||krd$||f}nd%|||f}|rg}|D]}||j	q|d&d'|}d#}zt}Wntt
fk
rd(}YnX|rFt|}|rF|d)krF||d*}t}|rb||p^d#}|j}|od+|}|d,d-|	d.|S)/z.Produce HTML documentation for a class object.cs eZdZddZfddZdS)z(HTMLDoc.docclass.<locals>.HorizontalRulecSs
d|_dSrxZneedonerrrrrsz1HTMLDoc.docclass.<locals>.HorizontalRule.__init__cs|jrdd|_dS)Nz<hr>
rrbrpushrrmaybe
sz.HTMLDoc.docclass.<locals>.HorizontalRule.maybeNr&r'rYrrerrcrrHorizontalRulesrgrz&<dl><dt>Method resolution order:</dt>
z<dd>%s</dd>
</dl>
cst||\}}|r||D]d\}}}}zt|}Wn&tk
rf||YnX||dq&|S)NrrRrer>	ExceptionrrmsgrrOokr)rrhomeclsrKr3r2hrmdictrXrrdr@rrspills"
zHTMLDoc.docclass.<locals>.spillcsJt||\}}|rF||D]\}}}}||q&|SrrRrerrkrprXrdr@rrspilldescriptors,sz*HTMLDoc.docclass.<locals>.spilldescriptorsc
st||\}}|r||D]\}}}}t||}t|sXt|rft|dd}	nd}	|	dkrd|n0t|j	}	d|	}	d||	fdq&|S)NrSz<dl><dt>%s</dl>
z<dd><tt>%s</tt>z<dl><dt>%s%s</dl>
r)
rRrerr>callablerrmr9rr)
rlrrOrmr)rrrnrKrLr#rorr	spilldata5s(
z#HTMLDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|dr||||fqS)rhrirtr)rrrsrKr.rrrJs
z$HTMLDoc.docclass.<locals>.<listcomp>r-rcs|dkSNrrrI	thisclassrrr|cr}z"HTMLDoc.docclass.<locals>.<lambda>defined hereinherited from %sz:<br>
z
Methods %scSs|ddkSNrmethodrrIrrrr|sr}zClass methods %scSs|ddkSNrzclass methodrrIrrrr|ur}zStatic methods %scSs|ddkSNrz
static methodrrIrrrr|wr}zReadonly properties %scSs|ddkSNrrkrrIrrrr|yr}zData descriptors %scSs|ddkSNrrjrrIrrrr|{r}zData and other attributes %scSs|ddkSNrr]rrIrrrr|}r}rz*<a name="%s">class <strong>%s</strong></a>z/<strong>%s</strong> = <a name="%s">class %s</a>(%s)r:N()rz<tt>%s<br>&nbsp;</tt>z#000000z#ffc8d8r2)r&rDr
rrgetmror!rer$r'rlr>rjrpopleftrRbuiltinsrrAssertionErrorr"	signature
ValueErrorrQrrr9rr)r@rr)rXr2r3rYrealnamerArrgmrorLrrrurwrrJrrrnrKanchor	inheritedtagr
rBdeclrargspecr#r)	r3r2rprqrXrrdr@r~rrs

	












zHTMLDoc.docclasscCs|d||Sz)Format an argument default value as text.=)r rrrrrformatvalueszHTMLDoc.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.rr{r 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&rAr;rr$riscoroutinefunctionisasyncgenfunctiongetattr_staticr-rrrrQrr r9rr)r@rr)rXr2r3rIrHrrnoteskipdocsimclassasyncqualifierr
Zreallinkrrrr#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>
rhr)r
r9rrr"r@rr)rXrHrqrdr#rrrrszHTMLDoc.docdatacGs|rd|pd}|||S)z-Produce HTML documentation for a data object.z<strong>%s</strong> = rr)r@rr)rXrYZlhsrrrrszHTMLDoc.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)ordrtZchrrr	<genexpr>sz HTMLDoc.index.<locals>.<genexpr>rrrGrL)rUrVanyr
rrr)r)r@rr'r^r_r)r`rrrrindexs
z
HTMLDoc.index)r)rrNr
)r)N)NN)NNN)NN)N)r&r'rYrSr_repr_instancerrrrrrrrr r#r$r&r)r*r9r<rrrrrrrrrrrrrsH



+

y&
A

rc@s4eZdZdZddZddZddZeZdd	Zd
S)TextReprzAClass for safely making a text representation of a Python object.cCs,t|d|_|_d|_d|_|_dSrrrrrrrs
zTextRepr.__init__cCsTtt|dr@ddt|j}t||r@t||||Sttt||j	Sr)
rfrr"r&r r>r7r:rrrrrrrs

zTextRepr.repr1cCsHt||j}t|}d|krDdt|ddkrDd|d||dS|S)Nrrrrr)r7rrr1rrrrrs
zTextRepr.repr_stringcCs4zttt||jWSd|jjYSXdSr)r7r:rrrr&rrrrr&szTextRepr.repr_instanceN)	r&r'rYrSrrrrrrrrrrs	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)Nrrrrrr6szTextDoc.bold.<locals>.<genexpr>)r"rrrrbold4szTextDoc.bold    cs>|sdSfdd|dD}|r4|d|d<d|S)z6Indent text by prepending a given prefix to each line.rcsg|]}|qSrrrtrprefixrrr;sz"TextDoc.indent.<locals>.<listcomp>rr)r rr")r@r0rr$rrrindent8szTextDoc.indentcCs$||}||d|dS)z&Format a section with a given heading.rr)rrr)r@r
rZclean_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*)rtr@r(rrrNsz%TextDoc.formattree.<locals>.<genexpr>rr:rr)rr*r"r<)
r@r=r(r>rrr?r@rArBrrrr<Fs"
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 - rMNzMODULE 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.
ZDESCRIPTIONr`
 (package)zPACKAGE CONTENTSrrZ
SUBMODULEScSsg|]\}}|qSrrrKrrrrsz%TextDoc.docmodule.<locals>.<listcomp>rCLASSES	FUNCTIONSF)r5ZDATAr[rDrErrFVERSIONr]ZDATErUZAUTHORrTZCREDITSrFILE)%r&r%rrr>rrrCr,rSrir
r-r=r/setrfrUrVr`addrr"r+rdr<rWrrrQr[rr]rUrTrr)r@rr)rXZsynopdescrrgrr3rJrKr2r]r^Z
modpkgs_namesr_r(r`Z
submodulesrarr\rrrrrVs
	



$
zTextDoc.docmodulec	sZj}|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!}|gkst|}qd	|
}
|
s>|d	S|d	|
d0d	S)1z4Produce text documentation for a given class object.cSs
t||Srr)r@rrrrmakenamesz"TextDoc.docclass.<locals>.makenameclass z	 = class rr:NrrrzMethod resolution order:rrcss.|]&}|jds|jdkrt|jVqdS)rbrN)r&rdr'rQ)rtrsrrrrs
z#TextDoc.docclass.<locals>.<genexpr>r~rzBuilt-in subclasses:z    ... and z other subclassescs eZdZddZfddZdS)z(TextDoc.docclass.<locals>.HorizontalRulecSs
d|_dSrxrbrrrrrsz1TextDoc.docclass.<locals>.HorizontalRule.__init__cs|jrdd|_dS)NzF----------------------------------------------------------------------rrbrrcrrresz.TextDoc.docclass.<locals>.HorizontalRule.maybeNrfrrcrrrgsrgc
st||\}}|r~||D]V\}}}}zt|}Wn&tk
rf||Yq&X||q&|SrrirkrprXrrdr@rrrrszTextDoc.docclass.<locals>.spillcsJt||\}}|rF||D]\}}}}||q&|Srrsrkrtrrrusz*TextDoc.docclass.<locals>.spilldescriptorsc
	st||\}}|r||D]v\}}}}t|sDt|rNt|}nd}zt|}	Wntk
r~|j|}	YnXj	|	|d|ddq&|S)Nr)r5r#r)
rRrervrrmrr>r__dict__r)
rlrrOrmr)rrrnrKr#rhrrrrws 
z#TextDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|dr||||fqSrxryrzr.rrr,s
z$TextDoc.docclass.<locals>.<listcomp>rcs|dkSr|rrIr}rrr|5r}z"TextDoc.docclass.<locals>.<lambda>rrzMethods %s:
cSs|ddkSrrrIrrrr|Dr}zClass methods %s:
cSs|ddkSrrrIrrrr|Fr}zStatic methods %s:
cSs|ddkSrrrIrrrr|Hr}zReadonly properties %s:
cSs|ddkSrrrIrrrr|Jr}zData descriptors %s:
cSs|ddkSrrrIrrrr|Lr}zData and other attributes %s:
cSs|ddkSrrrIrrrr|Nr}z |  )r&rDr'rmapr"r
rrrrrQrrrr!sortedr__subclasses__rrlrrRrrr*rrrr)r@rr)rXrYrrArr
rBrrrr#rrLZ
subclassesZno_of_subclassesZMAX_SUBCLASSES_TO_DISPLAYZsubclassnamergrrrurwrrrr)rprXrrdr@r~rrs



	










zTextDoc.docclasscCsd||SrrrrrrrXszTextDoc.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&rAr;rr*rrrrrr-rrrrQrrr)r@rr)rXrHrrrrrr
rrrr#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.rrrNr3r)rr!rrrQ)
r@rr)rXr>r5r#rrZchoprrrrs
zTextDoc.docother)r)Nr)NN)NN)NNN)NNN)NNNNN)r&r'rYrSrrrrrrr<rrrrrrrrrrrr,s


e

7
rc@seZdZdZddZdS)
_PlainTextDocz2Subclass of TextDoc which overrides string stylingcCs|Srrrrrrrsz_PlainTextDoc.boldN)r&r'rYrSrrrrrrsrcCstat|dS)zCThe first time this is called, determine what kind of pager to use.N)getpagerpagerr9rrrrsrc	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
tempfilepagerplainr9Z	use_pagerrrr|r}zgetpager.<locals>.<lambda>ZTERM)ZdumbZemacscstt|Sr)	pipepagerrr9rrrr|r}cs
t|Srrr9rrrr|r}cSstt|dS)Nzmore <rr9rrrr|r}systemz(less) 2>/dev/nullrcSs
t|dS)NZlessrr9rrrr|r}Nz	more "%s"cSs
t|dS)NZmorerr9rrrr|r})rfrstdin
plainpagerstdoutrr	rryplatformrtempfilemkstempcloseunlinkttypager)rfdrrrrrs6


 rcCstdd|S)z%Remove boldface formatting from text.z.r)rrr9rrrrsrc	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)r0cmdrprocpiperrrrsrc
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+)rTemporaryDirectoryr	rr"rrrdevice_encodingrr)r0rrtempdirrrrrrrs
rcCs$ttjddpd}||d|S)Nrutf-8r)r>rrencodedecode)r0rrrr_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tjdSrB)rrrrrrrr|r}zttypager.<locals>.<lambda>cSstjddddS)Nrr)rrrrrrrr|r}LINESrz
-- more --)qQz
          
)
r)bB)rrr ttyrrfilenoZ	tcgetattrZ	setcbreakrrrUnsupportedOperationZ	tcsetattrZ	TCSAFLUSHr1r	rryrrrr"flush)
r0r$rroldZgetcharhrZincr@rrrr
sL








&rcCstjtt|dS)z>Simply print unformatted text.  This is the ultimate fallback.N)rrrrrr9rrrr6srcCst|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 r`zpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%srz	function zmethod )rr+r&rrrfr=Zisgetsetdescriptor__objclass__r'Zismemberdescriptorr,rTr<r)thingrrrdescribe:s6














r
c	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)rtrrrrrWszlocate.<locals>.<listcomp>rrxNr)r r!rr"rr>r)rrrZrnZ
nextmodulerrrrrlocateUs rcCsVt|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&)rnrQrrr>)r	rrr)rrrresolvens

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)
r0r
r
rrSrfindr&r+r,r-rmrr)r	r
rZrendererrr)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)r	r
routputrKrrrr#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)
r
htmlrr
rrrrrr)r	rrr)rrrKrrrwritedocsrrcCs2|dkri}t|g|D]\}}}t|qdS)zAWrite out HTML documentation for all modules in a directory tree.N)rU
walk_packagesr)rpkgpathdoner_r(r`rrr	writedocss

rcJ@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!)functionr)delBASICMETHODSif)elser!try)forzbreak continue whileimport)globalznonlocal NAMESPACES)r'
TRUTHVALUE)r+MODULES)inSEQUENCEMETHODS
COMPARISON)lambdar)nonlocalzglobal NAMESPACES)passr)raise
EXCEPTIONS)returnr)r)r6)whilezbreak continue if TRUTHVALUE)rz CONTEXTMANAGERS EXCEPTIONS yield)yieldr)#FalseNoneTrueandasrrrr r"r#defr%elifr(exceptfinallyr*fromr,r'r+r/isr2r3notorr4r5r7r)r8rr9cCsg|]}dD]}||qqS)'r+r)rtprrrrrszHelper.<listcomp>)rfrurH'''r+r)+r{***rz//%<<>>r|^~rr<=>===!=<>)rrrVrWrXrYrZ)r{rU)z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//=)rQrRrrSrTrU)jJ)STRINGS	OPERATORSr1UNARYAUGMENTEDASSIGNMENTBITWISECOMPLEXzOPERATORS FORMATTINGPOWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTSELLIPSISzSLICINGS DICTIONARYLITERALSz	def classr]PRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ
BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)rPrO,rr3:@rrbra`r,r;[]r)typeszRSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect)stringsz4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES)zstring-methodszSTRINGS FORMATTING)Z
formatstringsr^)rmz: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)rlz!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)Zobjectsro)ZspecialnameszbBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES)Z
customizationzhash repr str SPECIALMETHODS)zattribute-accesszATTRIBUTES SPECIALMETHODS)zcallable-typeszCALLS SPECIALMETHODS)sequence-typesz(SEQUENCES SEQUENCEMETHODS SPECIALMETHODS)rrzMAPPINGS 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)r"zDICTIONARIES LITERALS)zattribute-referencesz(getattr hasattr setattr ATTRIBUTEMETHODS)Z
subscriptionsr0)Zslicingsr0)Zcallsrq)Zpowerrq)Zunaryrq)binaryrq)Zshiftingrq)Zbitwiserq)ZcomparisonszEXPRESSIONS BASICMETHODS)ZbooleanszEXPRESSIONS TRUTHVALUEr)Z
assignmentr`)Z	augassign
NUMBERMETHODSr%r7)Zcompoundzfor while break continue)truthz if while and or not BASICMETHODS)ZdebuggerZpdb)zcontext-managersr)Iror]Z
STRINGMETHODSZ
FORMATTINGUNICODEZNUMBERSZINTEGERFLOATrbrtZMAPPINGSrZMETHODSZCODEOBJECTSZTYPEOBJECTSZFRAMEOBJECTSZ
TRACEBACKSNONErdZSPECIALATTRIBUTESrr.ZPACKAGESrqr^Z
PRECEDENCEZOBJECTSZSPECIALMETHODSr&ZATTRIBUTEMETHODSZCALLABLEMETHODSr0ZMAPPINGMETHODSrxZ	EXECUTIONrsZDYNAMICFEATURESZSCOPINGZFRAMESr6ZCONVERSIONSZIDENTIFIERSZSPECIALIDENTIFIERSreZLITERALSZTUPLESZ
TUPLELITERALSZLISTSrurnrvZ
ATTRIBUTESZ
SUBSCRIPTSrpZCALLSrcr_ZBINARYZSHIFTINGrar1rZ	ASSERTIONZ
ASSIGNMENTr`ZDELETIONZ	RETURNINGZ	IMPORTINGZCONDITIONALZLOOPINGr-Z	DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dSr)_input_output)r@inputrrrrr_szHelper.__init__cCs|jp
tjSr)r}rrrrrrrcszHelper.inputcCs|jp
tjSr)r~rrrrrrrgsz
Helper.outputcCs2tdddkr|dSd|jj|jjfS)Nrr2?rz<%s.%s instance>)rstackrr'rYrrrr__repr__ks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__ss

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

,
zHelper.interactcCs8|jtjkrt|S|j||j|jSdS)z.Read one line, using input() when appropriate.N)rrrrrrr)r@promptrrrrs

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
listtopicslistmodulesr r
showsymbolr#evalr	showtopicrr~rQrnrrrrrrrrs6






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)rrrrrrrrrrs
zHelper.introrPc	
Cstt|}||}t||d|}t|D]v}t|D]\}|||}|t|kr<|j||||dkr<|jdd|dt||q<|jdq0dS)Nrrr)rrr!rrr)	r@itemscolumnsrZcolwrrowrrurrrrs&zHelper.listcCs |jd||jdS)NzN
Here is a list of the Python keywords.  Enter any keyword to get more help.

)rrrrrGrrrrrs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.

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

)rrrrrGrrrrrs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: r:Hz
%s
)pydoc_data.topicsrrrrryrrrrKeyErrorrtextwrapr"r wrapr)r@topic
more_xrefs
pydoc_datatargetlabelxrefsr#rr0Z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)	rrrryrrrnrQ	_gettopic)r@rrrrrrr#rrrrs	
zHelper._gettopiccCs*|j|}|d\}}}|||dS)Nr)r	partitionr)r@symbolrrrbrrrrr"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(rrrrrcallback5sz$Helper.listmodules.<locals>.callbackcsd|ddSrrrrrronerror:sz#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
ModuleScannerrunrrG)r@rJrrrrrr's

zHelper.listmodules)rHrLr+r)NN)rr)r)r)r)!r&r'rYrZ_strprefixesZ_symbols_inverserrrZsymbols_rryrrrorrrrrrrrrrrrrrrrrrrrrrrsB'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_filenamerV)rrrrrrSr rrUr	_get_specrrrfrrjrrStringIOrrrrrrr>)r@rrJZ	completerrseenr(r)rr_r`rrsourcerrrrrrHs`



zModuleScanner.run)NNN)r&r'rYrSrrrrrrEsrc	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)rJrrrrrrs


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)	rreZ
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'rYrrrrrr
DocHandlersrcs(eZdZddZfddZddZdS)z _start_server.<locals>.DocServercSs6||_|j|f|_||_|j||j|jd|_dSNF)hostaddressrrLrhandlerr)r@rportrrrrrs
z)_start_server.<locals>.DocServer.__init__cs>|js2|jgggd\}}}|r|q|dSrB)rselectsocketrZhandle_requestZserver_close)r@Zrdwrexrrrserve_until_quits

z1_start_server.<locals>.DocServer.serve_until_quitcSs |j||jr||dSr)rLserver_activaterrrrrrsz0_start_server.<locals>.DocServer.server_activateN)r&r'rYrrrrrrr	DocServersrcs:eZdZfddZfddZddZddZd	S)
z#_start_server.<locals>.ServerThreadcs2||_||_t||_j|d|_d|_dSr)rrr1rThreadrservingerror)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
HTTPServerrLrrZMessageZMessageClassstaticmethodrrrready	docserverrrjr)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)rrr"rr(rrrrstop	s
z(_start_server.<locals>.ServerThread.stopN)r&r'rYrrrrr)rrrrrrrServerThreads
rg{Gz?)
Zhttp.serverZ
email.messagerrrZBaseHTTPRequestHandlerrrr7rrtimesleep)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)r	zpydoc_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@r
rcss_pathZcss_linkhtml_navbarrrr3	sz#_url_handler.<locals>._HTMLDoc.pageN)r&r'rYrrrrr_HTMLDoc1	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)r\rrrrC	s
z!_url_handler.<locals>.html_navbarcsdd}ddd}ddtjD}||}|dd	dd
|g}i}tjD]}|||qT|ddd
|fS)zModule Index page.cSsd||fSNr%rr)rrr	bltinlinka	sz3_url_handler.<locals>.html_index.<locals>.bltinlinkz7<big><big><strong>Index of Modules</strong></big></big>rGrHcSsg|]}|dkr|qS)rr)rtr)rrrrg	sz4_url_handler.<locals>.html_index.<locals>.<listcomp>z<p>zBuilt-in ModulesrLz|<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|fdSrrMrZ
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>rGrHzkey = %srL<br>zSearch Results)	rrrrrrr
rr")	rJrrrrqrr)rrrrrhtml_searchw	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>rGrHZTopicsrL)rrrrrGrr)rrrrrrrhtml_topics	sz!_url_handler.<locals>.html_topicscsLddd}ttj}dd}||}|ddd|}d|fS)zIndex of keywords.rrGrHcSsd||fSrrrrrrr	sz6_url_handler.<locals>.html_keywords.<locals>.bltinlinkZKeywordsrL)rrrrrGrr)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.ZKEYWORDZTOPICrCrGrHz
<pre>%s</pre>rLcSsd||fSrrrrrrr	sz7_url_handler.<locals>.html_topicpage.<locals>.bltinlinkrz%s %sr)
rrrrrrr9rrr rrr")rbufZhtmlhelprrr
rrrrrhtml_topicpage	s2


z$_url_handler.<locals>.html_topicpagecs@t|dd}|dkr$|dkr$tdt|}||}||fS)Nr)rr;zcould not find object)rrr
r)r(rhr
contentrrrhtml_getobj	sz!_url_handler.<locals>.html_getobjcsPddd}dfddtt||D}||dd|}d||fS)	Nz,<big><big><strong>Error</strong></big></big>rGrHrc3s|]}|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)rrrrrz
search?keyz	topic?keyzget?keyz
bad pydoc url)rerrrjr)r(Zcomplete_urlr
roprbr)rrrrrrrrrr
get_html_page	s>



 z#_url_handler.<locals>.get_html_pagerrNrrrz"unknown content type %r for url %s)rrdr	rdirnamerealpathrVr"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(rrrrr)rr	rr
ZserverthreadZserver_help_msgrrrrbrowse
s2
rcCst|to|tjdkSrx)rnrQrr	sep)rQrrrispath:
sr
cCsvd|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	curdirgetcwdrrrVcopysamefileremoveinsert)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_pathY
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'rYrrrrBadUsagef
srrzbk:n:p:wFrz-bTz-kz-pz-wz-n)rr	zfile %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)getoptrjrrrrrr
r	rexistsrrrrrrrrrrrrr)rrZoptsrwritingZstart_serverr	rroptvalargrKrrrrclic
sd

 rr)NN)r)r)rrN)rrN)r)rN)r)r)ZrSrMrUr]rTrZimportlib._bootstraprZimportlib._bootstrap_externalZimportlib.machineryimportlib.utilrrr	rUrrrrrrZurllib.parserNrcollectionsrreprlibr	tracebackrrrr%r*r/r1r7r-
IGNORECASEr8r:rArFrRrirlrrrrrjrrrrrrrrrrrrrrrrrr
rr0rrr
rr#rrrrrrrrrr
rrrr&rrrr<module>s&
	


'
0:*> ",





=
n%
U


Zerion Mini Shell 1.0