MINI MINI MANI MO

Path : /lib64/python3.6/__pycache__/
File Upload :
Current File : //lib64/python3.6/__pycache__/pydoc.cpython-36.pyc

3

 \1@sdZdgZdZdZdZddlZddlZddlZddl	Zddl
ZddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZdd	lmZd
dZdd
ZddZddZ ddZ!ddZ"ddZ#ej$dej%Z&ddZ'ddZ(ddZ)dd Z*d!d"Z+dud#d$Z,d%d&Z-d'd(Z.d)d*Z/d+d,Z0ifd-d.Z1Gd/d0d0e2Z3d1d2Z4difd3d4Z5Gd5d6d6Z6Gd7d8d8eZ7Gd9d:d:e6Z8Gd;d<d<eZ9Gd=d>d>e6Z:Gd?d@d@e:Z;dAdBa<dCdDZ=dEdFZ>dGdHZ?dIdJZ@dKdLZAdMdNZBdOdPZCdQdRZDdvdSdTZEe:ZFe;ZGe8ZHdwdUdVZIdxdXdYZJdydZd[ZKdzd\d]ZLd{d_d`ZMGdadbdbZNeNZOGdcddddZPdedfZQdgdhZRd|djdkZSd}dldmdndoZTdpdqZUdrdsZVeWdtkreVdS)~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 -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.  The -p option
can be used with the -b option to explicitly specify the server port.

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}xRtjD]H}tjj|p d}tjj|}||krtjj|r|j||j|qW|S)zAConvert sys.path into a list of absolute, existing, unique paths..)syspathosabspathnormcaseisdirappend)dirsZnormdirsdirZnormdirr/usr/lib64/python3.6/pydoc.pypathdirsLs
rcCs.tj|ptj|}|r*tjdd|jp,dS)z-Get the doc string or comments for an object.z^ *
)inspectgetdocZgetcommentsresubrstrip)objectresultrrrrXsrcCsh|jjd}t|dkr&|ddfSt|dkrZ|djrZ|ddj|ddfSddj|fS)z>Split a doc string into a synopsis line (if any) and the rest.
rrN)stripsplitlenrjoin)doclinesrrrsplitdoc]s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	classnamefs
r)cCs>tj|p:tj|p:tj|p:tj|p:tj|p:tj|S)z>Check if an object is of a type that probably means it's data.)rismoduleisclass	isroutineZisframeZistracebackZiscode)rrrrisdatamsr-cGs2x,|r,|dj|j|d}|dd}qW|S)z/Do a series of global replacements on a string.rrrN)r!r)textZpairsrrrreplacessr/cCsXt||krTtd|dd}td|d|}|d|d|t||dS|S)zCOmit part of a string if needed to make it fit in a maximum length.rrNz...)r max)r.maxlenZpreZpostrrrcramzs
$r3z at 0x[0-9a-f]{6,16}(>+)$cCstjd|S)z>Remove the hexadecimal id from a Python object representation.z\1)_re_stripidr)r.rrrstripidsr5cCs(tj|p&tj|p&tj|p&tj|S)N)r
isfunctionismethod	isbuiltinZismethoddescriptor)objrrr_is_some_methods


r:cCs<tj|rdStj|r8t|dd}tj|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)rr7r8getattrr*)fnselfrrr_is_bound_methods

r?cCshi}x tj|tD]\}}d||<qWx|jD]}|jt|q.Wx|jD]}t||||<qNW|S)Nr)r
getmembersr:	__bases__update
allmethodskeysr<)clmethodskeyvaluebaserrrrCsrCcCs<g}g}x*|D]"}||r&|j|q|j|qW||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	predicateyesnoxrrr_split_lists
rOcCs\|dkrdS|jdr$|jdr$dS|jdr<t|dr<dS|dk	rL||kS|jdSdS)z3Decide whether to show documentation on a variable.
__author____builtins__
__cached____credits____date____doc____file____spec__
__loader__r&r%__package____path____qualname__	__slots____version__r__r__fieldsTN>rUrYrQr%rSr&rTr]r[rVrPrWr\rRrXrZ)
startswithendswithhasattr)r(allr9rrrvisiblenamesrecCsDg}x:tj|D],\}}}}tj|r*d}|j||||fqW|S)zCWrap inspect.classify_class_attrs, with fixup for data descriptors.zdata descriptor)rclassify_class_attrsisdatadescriptorr
)rresultsr(kindclsrHrrrrfs
rfcs\t|dgyfddtDWntk
r>iYnXfdd}|j|ddS)zGSort the attrs list in-place by _fields and then alphabetically by namer`csi|]\}}|t|qSr)r ).0ir()fieldsrr
<dictcomp>sz#sort_attributes.<locals>.<dictcomp>csj|dd|dfS)Nr)get)attr)field_orderrr<lambda>sz!sort_attributes.<locals>.<lambda>)rGN)r<	enumerate	TypeErrorsort)attrsrZkeyfuncr)rqrmrsort_attributess
rwcCs<tjj|r8x*dD]"}tjjtjj|d|rdSqWdS)z3Guess whether a path refers to a package directory..py.pyc__init__TF)rxry)r	rrisfiler!)rextrrr	ispackages

r}cCs|j}x,|dddks$|jr4|j}|s
Pq
W|j}|dddkrZ|dd}|dddkr|dd}|d	ddkr|dd
}x|js|j}|sPqW|jddj}nd}|S)Nr#zr"""r0z"""\rr)readlinerr)filelinerrrrsource_synopsiss&
rc
Cstj|j}|j|d\}}|dks.||kr|jttjjrJtjj	}n |jttjj
rftjj}nd}|dkrytj
|}Wntk
rdSX|t|}WdQRXnZ|d|}tjjd||d}ytjj|}	Wn
dStjd=|	jr|	jjdnd}||f||<|S)z.Get the one-line summary out of a module file.NZ__temp__)loaderr)NN)r	statst_mtimerorbtuple	importlib	machineryBYTECODE_SUFFIXESSourcelessFileLoaderEXTENSION_SUFFIXESExtensionFileLoadertokenizeopenOSErrorrutilspec_from_file_location
_bootstrap_loadrmodulesrU
splitlines)
filenamecachemtimeZ
lastupdaterZ
loader_clsrrspecmodulerrrsynopsiss4



rc@s eZdZdZddZddZdS)ErrorDuringImportzEErrors that occurred while trying to import something to document it.cCs||_|\|_|_|_dS)N)rexcrHtb)r>rexc_inforrrrz#szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)rr%rrH)r>rrrr__str__'szErrorDuringImport.__str__N)r%r&r[rUrzrrrrrr!src	Cstjj}t|d}||jt|k}WdQRXtjj|}tjj	|\}}|r`tj
j||}ntj
j||}tjj
|||d}ytjj|St|tjYnXdS)z<Import a Python source file or compiled file given its path.rbN)r)rrMAGIC_NUMBERrreadr r	rbasenamesplitext_bootstrap_externalrSourceFileLoaderrrrrrr)	rmagicrZis_bytecoderr(r|rrrrr
importfile+srcs"yb|rXtjkrXtjkrXfddtjD}x(g|D]}tj|||<tj|=q:Wt}Wnxtj\}}}}	tjkrttjj|	n<|tkrt|j|	n&t	|t
r|jkrdSttjYnXx@jdddD]*}
yt
||
}Wqtk
rdSXqW|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|]}|jdr|qS)r)ra)rkm)rrr
<listcomp>Qszsafeimport.<locals>.<listcomp>Nrr)rrbuiltin_module_names
__import__rrrVSyntaxErrorr
issubclassImportErrorr(rr<AttributeError)r	forceloadrZsubsrGrrrHrinfopartr)rr
safeimport=s.


rc@s|eZdZejjddejddZd
ddZ	dddZ
e
ZZZ
ZZZejjejd	d
ejddfddZdS)Doc
PYTHONDOCSz%https://docs.python.org/%d.%d/libraryNrcGs||f|}tj|r |j|Stj|r4|j|Sy@tj|rJ|j|Stj|r^|j|Stj|rr|j	|SWnt
k
rYnXt|tr|j
|S|j|S)z%Generate documentation for an object.)risgetsetdescriptordocdataismemberdescriptorr*	docmoduler+docclassr,
docroutiner
isinstancepropertydocpropertydocother)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%rt)r>rr(rmessagerrrfailszDoc.faillibzpython%d.%dcCsytj|}Wntk
r&d}YnXtjjd|j}tjj|}t	|t
tr|jdks||j|r|jtjj
|d
r|jdkr|jdrd|jd|jjf}qtjj
||jjd}nd}|S)z*Return the location of module docs or Nonez
(built-in)rerrno
exceptionsgcimpmarshalposixsignalr_thread	zipimportz
site-packages	xml.etreetest.pydoc_modhttp://https://z%s/%s/z.htmlN)
rrrrrrrrrr)rr)rr)r
getabsfilertr	environrorrrrrr%rar!rlower)r>rZbasedirrdoclocrrr	getdoclocs$



z
Doc.getdocloc)N)N)r%r&r[r	rrorversion_inforrrrrrrrrrr!base_exec_prefixrrrrrrms

rc@sHeZdZdZddZddZddZdd	Zd
dZeZ	dd
Z
eZdS)HTMLReprzBClass for safely making an HTML representation of a Python object.cCs,tj|d|_|_d|_d|_|_dS)N
d)rrzmaxlistmaxtuplemaxdict	maxstringmaxother)r>rrrrzs
zHTMLRepr.__init__cCst|ddddddS)N&z&amp;<z&lt;>z&gt;)r/)r>r.rrrescapeszHTMLRepr.escapecCstj||S)N)rr)r>rrrrrsz
HTMLRepr.reprcCsZtt|dr@ddjt|jj}t||r@t||||S|jttt	||j
S)Nr%repr_r_)rcrr!r%rr<rr3r5rr)r>rNlevel
methodnamerrrrepr1s

zHTMLRepr.repr1cCs^t||j}t|}d|krJdt|ddkrJd|d|j||dStjdd|j|S)Nrz\\rrrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z<font color="#c040c0">\1</font>)r3rrr/rrr)r>rNrtesttestreprrrrrepr_stringszHTMLRepr.repr_stringcCs8y|jttt||jS|jd|jjSdS)Nz
<%s instance>)rr3r5rr	__class__r%)r>rNrrrr
repr_instanceszHTMLRepr.repr_instanceN)r%r&r[rUrzrrrrrepr_strrZrepr_unicoderrrrrsrc@seZdZdZeZejZejZddZd5ddZ	d6d
dZ
dd
ZddZd7ddZ
ddZddZddZddZddZddZdiiifdd Zd8d!d"Zd9d#d$Zddiifd%d&Zd'd(Zddiiidfd)d*Zd+d,Zd:d-d.Zd;d/d0Zd<d1d2Zd=d3d4ZdS)>HTMLDocz'Formatter class for HTML documentation.cCsd||fS)zFormat 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>
    z&nbsp;r)r>rfgcolbgcolZextrasrrrheadings	zHTMLDoc.headingN&nbsp;c	
Cs^|dkrdd|d}d|||f}	|r@|	d||||f}	n|	d|||f}	|	d|S)	z Format a section with a heading.Nz<tt>z&nbsp;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>rrrrwidthZpreludeZ
marginaliaZgaprrrrsectionszHTMLDoc.sectioncGsd|}|j|f|S)z$Format a section with a big heading.z<big><strong>%s</strong></big>)r)r>rrrrr
bigsection	szHTMLDoc.bigsectionc
Cs&|j|j}t|dddddddd	S)z!Format literal preformatted text.z

z
 
rz&nbsp;rz<br>
)r
expandtabsr/)r>r.rrr	preformatszHTMLDoc.preformatrcCsd}t||d|}xht|D]\}|dd|}x>t|||||D]$}|t|krN||||d}qNW|d}q"Wd|S)z0Format a list of items into a multi-column list.rrz<td width="%d%%" valign=top>rz<br>
z</td>z7<table width="100%%" summary="list"><tr>%s</tr></table>)r range)r>listformatZcolsrrowscolrlrrrmulticolumnszHTMLDoc.multicolumncCsd|S)Nz<font color="#909090">%s</font>r)r>r.rrrgrey szHTMLDoc.greycGs*x$|D]}||krd|||fSqW|S)z:Make a link for an identifier, given name-to-URL mappings.z<a href="%s">%s</a>r)r>r(Zdictsdictrrrnamelink"s
zHTMLDoc.namelinkcCsN|jtjj|j}}t||rDt|||krDd|j|t||fSt||S)zMake a link for a class.z<a href="%s.html#%s">%s</a>)r%rrror&rcr<r))r>rr'r(rrrr	classlink)s
zHTMLDoc.classlinkcCsd|j|jfS)zMake a link for a module.z<a href="%s.html">%s</a>)r%)r>rrrr
modulelink1szHTMLDoc.modulelinkcCsR|\}}}}|r|j|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)z<a href="%s">%s</a>)r)r>Z
modpkginfor(rr}shadowedurlr.rrr
modpkglink5s

zHTMLDoc.modpkglinkcCsd||fS)zMake a link to source file.z<a href="file:%s">%s</a>r)r>rrrrrfilelinkDszHTMLDoc.filelinkcCs|p|j}g}d}tjd}xL|j||}	|	s2P|	j\}
}|j||||
|	j\}}
}}}}|
r||jdd}|jd||fn|rdt|}|jd|||fn|rdt|}|jd|||fn|r$|||dd	kr|jd
|j	||n|jd|n@|||dd	krR|j|j	||||n|j|j	|||}q W|j|||dd
j
|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;z<a href="%s">%s</a>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
groupsr/intrr!)r>r.rfuncsclassesrFrhherepatternmatchstartendrdschemeZrfcZpepZselfdotr(rrrrmarkupHs<

zHTMLDoc.markupc
Csd}x|D]}t|tfkr|\}}|d}||j||}|r||fkrg}x|D]}	|j|j|	|qVW|ddj|d}|d}q
t|tgkr
|d|j|||}q
Wd|S)	zAProduce HTML for a class tree as given by inspect.getclasstree().rz"<dt><font face="helvetica, arial">rz, )z
</font></dt>z
<dd>
%s</dd>
z
<dl>
%s</dl>
)rrr
r!
formattree)
r>treer'parentrentrycbasesparentsrIrrrr(ss 


zHTMLDoc.formattreec#s|j}y
|j}Wntk
r(d}YnX|jd}g}x@tt|dD],}|jddj|d|d||fqJWdj||d.d}	d|	}
y&tj	|}t
jj|}j
||}
Wntk
rd}
YnXg}t|dr:t|j}|ddd/kr&|d0dd	kr&|dd1j}|jdj|t|dr\|jjt|j|rt|
d
dj|}
j|}|dk	rdt}nd}j|
ddd|
|}tj|tj}gi}}xltj|tjD]Z\}}|dk	stj|p||krt|||r|j||fd|||<||<qWx|D]\}}xx|jD]n}|j|j}}tj j!|}||krL|rLt||rLt"|||krL||krL|d|||<||<qLWq<Wgi}}xtj|tj#D]p\}}|dk	stj$|stj||krt|||r|j||fd|||<tj%|r||||<qWg}x6tj|t&D]&\}}t|||rd|j||fqdWj't(|j)||}|od|}|d|}t|dr*g}x.t*j+|j,D]\}}} |j||| dfqW|j-j.|j/}!|j0ddd|!}n.|rXj.|fdd}!|j0ddd|!}|rd d!|D}"j1tj2|"d|g}!x*|D]"\}}|!jj3|||||qW|j0d"dd#d$j|!}|rg}!x*|D]"\}}|!jj3|||||qW|j0d%dd&d$j|!}|rbg}!x$|D]\}}|!jj3||q(W|j0d'dd(d)j|!}t|d*rj't|j4j)}!|j0d+dd|!}t|d,rʈj't|j5j)}!|j0d-dd|!}|S)2z/Produce HTML documentation for a module object.Nrrz5<a href="%s.html"><font color="#ffffff">%s</font></a>z)<big><big><strong>%s</strong></big></big>z
(built-in)r]$z
Revision: z
version %srTz (%s)z, z-<br><a href="%(docloc)s">Module Reference</a>rz#ffffffz#7799eez<a href=".">index</a><br>r~z.html#z#-z<tt>%s</tt>z
<p>%s</p>
rZrzPackage Contentsz#aa55cccsj|dS)Nr)r)t)r>rrrrsz#HTMLDoc.docmodule.<locals>.<lambda>ModulescSsg|]\}}|qSrr)rkrGrHrrrrsz%HTMLDoc.docmodule.<locals>.<listcomp>ZClassesz#ee77aarZ	Functionsz#eeaa77ZDataz#55aa55z<br>
rPZAuthorrSZCreditsrz$Revision: rr)6r%__all__rrrr r
r!rrurllibparseZquoterrtrcstrr]rrrTrlocalsrr@r*r+	getmodulererAr&rrror<r,r8r6r-r&rrpkgutiliter_modulesrZrur
rrr(getclasstreerrPrS)#r>rr(modignoredrdpartsZlinksrlZ
linkednameheadrrrrversionrrrrZcdictrGrHrIr'rrZfdictdatar"modpkgsimporterispkgr	classlistr)r>rrs


&


$




$

zHTMLDoc.docmodulecsj}|p|}j}g}	|	jGfddd}
|
ttj}t|dkrjdx"|D]}dj|j	qfWdfdd}
fd	d
}fdd}fd
dt
D}ixv|D]n\}}}}d|d||<}yt|}Wntk
r:YnXy||<Wqt
k
r^YqXqWx|rb|r||jn|ddt|fdd\}}tjkr|}qfn"krd}ndjj	}|d7}t||
d||dd}|
d||dd}|
d||dd}|d||dd}|d||d d}|gksZt|}qfWd!j|	}	||krd"||f}nd#|||f}|rg}x"|D]}|jj|j	qW|d$d%j|}jtj}|od&|}j|d'd(|	d)|S)*z.Produce HTML documentation for a class object.cs eZdZddZfddZdS)z(HTMLDoc.docclass.<locals>.HorizontalRulecSs
d|_dS)Nr)needone)r>rrrrzsz1HTMLDoc.docclass.<locals>.HorizontalRule.__init__cs|jrdd|_dS)Nz<hr>
r)rF)r>)pushrrmaybe
sz.HTMLDoc.docclass.<locals>.HorizontalRule.maybeN)r%r&r[rzrHr)rGrrHorizontalRule
srIrz&<dl><dt>Method resolution order:</dt>
z<dd>%s</dd>
z</dl>
cst||\}}|rj|xl|D]d\}}}}yt|}Wn&tk
rhj||YnXj||dq(W|S)Nr)rOrHr<	Exception_docdescriptorr)msgrvrKokr(rihomeclsrH)rrhrmdictr<rrGr>rrspillszHTMLDoc.docclass.<locals>.spillcsNt||\}}|rJj|x&|D]\}}}}j||q(W|S)N)rOrHrK)rLrvrKrMr(rirNrH)rOr<rGr>rrspilldescriptors/sz*HTMLDoc.docclass.<locals>.spilldescriptorsc
st||\}}|rj|x|D]\}}}}jt||}t|sZtj|rht|dd}	nd}	|	dkrd|n0jt|j	}	d|	}	d||	fdq(W|S)NrUz<dl><dt>%s</dl>
z<dd><tt>%s</tt>z<dl><dt>%s%s</dl>
r)
rOrHrr<callablerrgr&rr)
rLrvrKrMr(rirNrHrIr")rrrOrPr<rrGr>rr	spilldata8s"
z#HTMLDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|dr||||fqS))r9)re)rkr(rirjrH)rrrrMs
z$HTMLDoc.docclass.<locals>.<listcomp>r~-rcs|dkS)Nrr)r1)	thisclassrrrrfsz"HTMLDoc.docclass.<locals>.<lambda>zdefined herezinherited from %sz:<br>
z
Methods %scSs|ddkS)Nrmethodr)r1rrrrrvszClass methods %scSs|ddkS)Nrzclass methodr)r1rrrrrxszStatic methods %scSs|ddkS)Nrz
static methodr)r1rrrrrzszData descriptors %scSs|ddkS)Nrzdata descriptorr)r1rrrrr|szData and other attributes %scSs|ddkS)NrrAr)r1rrrrr~srz*<a name="%s">class <strong>%s</strong></a>z/<strong>%s</strong> = <a name="%s">class %s</a>z(%s)z, z<tt>%s<br>&nbsp;</tt>z#000000z#ffc8d8r0)r%rAr
rrgetmror rHrr&rfr<rJrtpopleftrObuiltinsrrwAssertionErrorr!r&rrr)r>rr(r<rrr=realnamer-rrImrorIrQrRrTrvrGrirNrHanchor	inheritedtagrr.r"r)	rrrOrPr<rrGr>rVrrs

	



















zHTMLDoc.docclasscCs|jd|j|S)z)Format an argument default value as text.=)rr)r>rrrrformatvalueszHTMLDoc.formatvaluecCs|j}|p|}|r|jpdd|}	d}
d}t|r|jj}|rZ||k	rd|j||}
n0|jdk	rzd|j|jj|}
nd|j||}
||krd|	|f}
nD|rtj||g|krd	|jd||f}d
}n|}d|	||f}
d}tj|rNytj|}Wnt	t
fk
r d}YnX|rNt|}|dkrNd
|}
|d
d}|sXd}|
|j||
ov|j
d|
}|rd|S|jt||j|||}|od|}d||fSdS)z;Produce HTML documentation for a function or method object.rrUrz from Nz method of %s instancez unbound %s methodz$<a name="%s"><strong>%s</strong></a>z<a href="#%s">%s</a>rz)<a name="%s"><strong>%s</strong></a> = %sz<lambda>z$<strong>%s</strong> <em>lambda</em> z(...)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%r?r;rrrgetattr_staticr,	signature
ValueErrorrtr6rrr&rr)r>rr(r<rrrFrEr\r^noteskipdocsimclassrZreallinkargspecrddeclr"rrrrsX


zHTMLDoc.docroutinecCsTg}|j}|r|d||jdk	rB|jt||j}|d||ddj|S)Nz!<dl><dt><strong>%s</strong></dt>
z<dd><tt>%s</tt></dd>
z</dl>
r)r
rUr&rrr!)r>r(rHr<rhrGr"rrrrKs
zHTMLDoc._docdescriptorcCs|j|||S)z*Produce html documentation for a property.)rK)r>rr(r<rErrrrszHTMLDoc.docpropertycGs|rd|pd}||j|S)z-Produce HTML documentation for a data object.z<strong>%s</strong> = r)r)r>rr(r<r=ZlhsrrrrszHTMLDoc.docothercCs|j|||S)z1Produce html documentation for a data descriptor.)rK)r>rr(r<rErrrrszHTMLDoc.docdatacCsg}|dkri}xLtj|gD]<\}}}tdd|Dr<q|j|d|||kfd||<qW|j|j||j}|j|dd|S)z2Generate an HTML index for a directory of modules.Ncss*|]"}dt|kodknVqdS)iiN)ord)rkchrrr	<genexpr>sz HTMLDoc.index.<locals>.<genexpr>rrz#ffffffz#ee77aa)r9r:anyr
rur
rr)r>rrrBrCr(rDrrrrindexsz
HTMLDoc.index)r)rrNr)r)N)NN)NNN)NN)NNN)N)r%r&r[rUr_repr_instancerrrrrrrr
rrrrrrr&r(rrrbrrKrrrrorrrrrs<



+

y:


rc@s4eZdZdZddZddZddZeZdd	Zd
S)TextReprzAClass for safely making a text representation of a Python object.cCs,tj|d|_|_d|_d|_|_dS)Nrrr)rrzrrrrr)r>rrrrzs
zTextRepr.__init__cCsTtt|dr@ddjt|jj}t||r@t||||Sttt||j	S)Nr%rr_)
rcrr!r%rr<r3r5rr)r>rNrrrrrrs

zTextRepr.repr1cCsHt||j}t|}d|krDdt|ddkrDd|d||dS|S)Nrz\\rrr)r3rrr/)r>rNrrrrrrr
s
zTextRepr.repr_stringc
Cs,yttt||jSd|jjSdS)Nz
<%s instance>)r3r5rrrr%)r>rNrrrrrszTextRepr.repr_instanceN)	r%r&r[rUrzrrrrrrrrrqs	rqc@seZdZdZeZejZddZdddZddZ	dddZ
dd
dZd ddZddZ
d!ddZddZd"ddZd#ddZd$ddZd	S)%TextDocz'Formatter class for text documentation.cCsdjdd|DS)z(Format a string in bold by overstriking.rcss|]}|d|VqdS)Nr)rkrlrrrrm(szTextDoc.bold.<locals>.<genexpr>)r!)r>r.rrrbold&szTextDoc.bold    cs>|sdSfdd|jdD}|r4|dj|d<dj|S)z6Indent text by prepending a given prefix to each line.rcsg|]}|qSrr)rkr)prefixrrr-sz"TextDoc.indent.<locals>.<listcomp>rrrr)rrr!)r>r.rvr#r)rvrindent*szTextDoc.indentcCs$|j|j}|j|d|dS)z&Format a section with a given heading.rz

)rwrrt)r>rrZclean_contentsrrrr1szTextDoc.sectionNrc
sd}x|D]}t|tfkrt|\}}||t|}|rj||fkrjfdd|D}	|ddj|	}|d}q
t|tgkr
||j|||d}q
W|S)zBRender in text a class tree as returned by inspect.getclasstree().rc3s|]}t|VqdS)N)r))rkr,)r'rrrm@sz%TextDoc.formattree.<locals>.<genexpr>z(%s)z, rz    )rr)r!r()
r>r)r'r*rvrr+r,r-r.r)r'rr(8s

zTextDoc.formattreecCsD|j}tt|\}}|jd||o(d|}t|dd}|j|}|dk	r`||jd|d}|rt||jd|}g}	xNtj|tjD]<\}
}|dk	stj	|p||krt
|
||r|	j|
|fqWg}xXtj|tjD]F\}
}|dk	stj
|stj	||krt
|
||r|j|
|fqWg}
x6tj|tD]&\}
}t
|
||r8|
j|
|fq8Wg}t}t|drxFtj|jD]6\}}}|j||r|j|d	n
|j|qW|j||jd
dj|}g}xBtj|tjD]0\}
}|jj|dr|
|kr|j|
qW|rJ|j||jd
dj|}|	rdd|	D}|jtj|d|g}x&|	D]\}
}|j|j||
|qzW||jddj|}|rg}x&|D]\}
}|j|j||
|qW||jddj|}|
rFg}x*|
D]"\}
}|j|j||
|ddq
W||jddj|}t|drt|j}|ddd#kr|d$ddkr|dd%j}||jd|}t|dr||jdt|j }t|dr||jdt|j!}t|dr||jd t|j"}ytj#|}Wnt$k
r.d!}YnX||jd"|}|S)&z5Produce text documentation for a given module object.NAMEz - r3NzMODULE 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.
ZDESCRIPTIONrZz
 (package)zPACKAGE CONTENTSrrZ
SUBMODULEScSsg|]\}}|qSrr)rkrGrHrrrrsz%TextDoc.docmodule.<locals>.<listcomp>rCLASSES	FUNCTIONSF)r2ZDATAr]r/r0z
Revision: VERSIONrTZDATErPZAUTHORrSZCREDITSz
(built-in)ZFILEz$Revision: rr)%r%r$rrr<rrr@r+r8rer
r,r8r-setrcr9r:rZaddrur!r*rar(r;rrr6r]rrTrPrSrrt)r>rr(r<ZsynopdescrrdrrrGrHrrArBZ
modpkgs_namesrCr'rDZ
submodulesrErr@rrrrrHs





$
zTextDoc.docmodulecsfj}|p|}j}jfdd}||kr:dj|}nj|d|}|rlt||}	|ddj|	}t}
|
r|
dgpg}|jtt	j
}t|dkrԈd	x|D]}
d
||
qWdGfdd
d
}|fdd}fdd}fdd}fddtD}x|r0|rT|j
n|ddt|fdd\}}tjkr|}q>n krd}ndtj}t||d||dd}|d||dd}|d||d d}|d!||d"d}|d#||d$d}|gks(t|}q>Wdj|}|sJ|dS|dj|jd%dS)&z4Produce text documentation for a given class object.cSs
t||S)N)r))r,rrrrmakenamesz"TextDoc.docclass.<locals>.makenamezclass z	 = class z(%s)z, rrzMethod resolution order:z    rcs eZdZddZfddZdS)z(TextDoc.docclass.<locals>.HorizontalRulecSs
d|_dS)Nr)rF)r>rrrrzsz1TextDoc.docclass.<locals>.HorizontalRule.__init__cs|jrddd|_dS)NrUr{r)rF)r>)rGrrrHsz.TextDoc.docclass.<locals>.HorizontalRule.maybeN)r%r&r[rzrHr)rGrrrIsrIcst||\}}|rj|x^|D]V\}}}}yt|}Wn&tk
rhj||Yq(Xj||q(W|S)N)rOrHr<rJrKr)rLrvrKrMr(rirNrH)rOr<rrGr>rrrQszTextDoc.docclass.<locals>.spillcsNt||\}}|rJj|x&|D]\}}}}j||q(W|S)N)rOrHrK)rLrvrKrMr(rirNrH)rOr<rGr>rrrRsz*TextDoc.docclass.<locals>.spilldescriptorsc
st||\}}|rj|x~|D]v\}}}}t|sFtj|rPt|}nd}yt|}	Wntk
r|j|}	YnXj	|	|d|ddq(W|S)Nr{)r2r"r)
rOrHrSrrgrr<r__dict__r)
rLrvrKrMr(rirNrHr"r9)rOr<rrGr>rrrTs
z#TextDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|dr||||fqS))r9)re)rkr(rirjrH)rrrrs
z$TextDoc.docclass.<locals>.<listcomp>rcs|dkS)Nrr)r1)rVrrrr	sz"TextDoc.docclass.<locals>.<lambda>zdefined herezinherited from %szMethods %s:
cSs|ddkS)NrrWr)r1rrrrrszClass methods %s:
cSs|ddkS)Nrzclass methodr)r1rrrrrszStatic methods %s:
cSs|ddkS)Nrz
static methodr)r1rrrrrszData descriptors %s:
cSs|ddkS)Nrzdata descriptorr)r1rrrrrszData and other attributes %s:
cSs|ddkS)NrrAr)r1rrrrr sz |  )r%rAr&rtmapr!rr
rrrXr rfrYrOrZrr)rwr[rwr)r>rr(r<r=r\r-rrr.r"rr]rIrIrQrRrTrvr_r`r)rOr<rrGr>rVrrsn

	
















zTextDoc.docclasscCsd|j|S)z)Format an argument default value as text.ra)r)r>rrrrrb*szTextDoc.formatvaluecCsr|j}|p|}d}d}t|rn|jj}|rB||k	rndt||}n,|jdk	r`dt|jj|}ndt||}||kr|j|}	n,|rtj||g|krd}|j|d|}	d}
tj|rytj	|}Wnt
tfk
rd}YnX|rt|}
|d	kr|j|d
}	|
dd
}
|
s&d}
|	|
|}|r@|dSt
|pLd}
|d|
oj|j|
jdSdS)z;Produce text documentation for a function or method object.rrz from Nz method of %s instancez unbound %s methodrz = z<lambda>z lambda z(...)rr)r%r?r;rr)rtrrcr,rdrertr6rrwr)r>rr(r<rEr\rfrgrhrrirdrjr"rrrr.sH


zTextDoc.docroutinecCsTg}|j}|r$||j||dt|p.d}|rJ||j||ddj|S)Nrr)r
rtrrwr!)r>r(rHr<rhrGr"rrrrK_szTextDoc._docdescriptorcCs|j|||S)z*Produce text documentation for a property.)rK)r>rr(r<rErrrrlszTextDoc.docpropertycCs|j|||S)z1Produce text documentation for a data descriptor.)rK)r>rr(r<rErrrrpszTextDoc.docdatac
Cs|j|}|rF|r|dpd|}|t|}	|	dkrF|d|	d}|rX|j|dpZd|}|dk	r~|d|jt|7}|S)z-Produce text documentation for a data object.z = rrNz...r)rr rtrwr6)
r>rr(r<r*r2r"rrZchoprrrrts
zTextDoc.docother)ru)Nr)NN)NN)NNN)NNN)NNN)NNNNN)r%r&r[rUrqrprrtrwrr(rrrbrrKrrrrrrrrrs


e
}
1

rrc@seZdZdZddZdS)
_PlainTextDocz2Subclass of TextDoc which overrides string stylingcCs|S)Nr)r>r.rrrrtsz_PlainTextDoc.boldN)r%r&r[rUrtrrrrrsrcCstat|dS)zCThe first time this is called, determine what kind of pager to use.N)getpagerpager)r.rrrrsrcs<ttjdstSttjds tStjjs8tjjr<tStjjdpRtjjdrtj	dkrnfddStjjddkrfd
dSfddStjjddkrtStj	dkrddSttd
rtj
ddkrddSddl}|j\}}tj
|z0ttd
r$tj
d|dkr$ddStSWdtj|XdS)z2Decide what method to use for paging through text.isattyZMANPAGERZPAGERZwin32cstt|S)N)
tempfilepagerplain)r.)	use_pagerrrrrszgetpager.<locals>.<lambda>ZTERMdumbemacscstt|S)N)	pipepagerr)r.)rrrrrscs
t|S)N)r)r.)rrrrrscSstt|dS)Nzmore <)rr)r.rrrrrssystemz(less) 2>/dev/nullrcSs
t|dS)NZless)r)r.rrrrrsNz	more "%s"cSs
t|dS)NZmore)r)r.rrrrrs)rr)rr)rcrstdin
plainpagerstdoutrr	rroplatformrtempfileZmkstempclosettypagerunlink)rfdrr)rrrs6


 rcCstjdd|S)z%Remove boldface formatting from text.z.r)rr)r.rrrrsrc Csddl}|j|d|jd}yDtj|jdd*}y|j|Wntk
rPYnXWdQRXWntk
rrYnXx(y|j	PWqvtk
rYqvXqvWdS)z3Page through text by feeding it to another program.rNT)shellrbackslashreplace)errors)

subprocessPopenPIPEio
TextIOWrapperrwriteKeyboardInterruptrwait)r.cmdrprocpiperrrrs rcCs`ddl}|j}t|ddd}|j|WdQRXztj|d|dWdtj|XdS)z<Page through text by invoking a program on a temporary file.rNwr)rz "r)rZmktemprrr	rr)r.rrrrrrrrsrcCs$ttjddpd}|j|dj|S)Nencodingzutf-8r)r<rrencodedecode)r.rrrr_escape_stdoutsrc
Cstt|jd}y2ddl}tjj}|j|}|j|dd}Wn(t	t
tjfk
rld}dd}YnXz2yt
tjjdd}Wntk
rd}YnX|dkrd	}|d}}tjjdj|d|dx||drtjjd
tjj|}	|	dkrtjjd
Pn,|	dkrJtjjd
||d|d}q|	dkrn|||}|dkrnd}tjjddj||||d||}qWWd|r|j||j|XdS)z%Page through text on a text terminal.rrNcSstjjdS)Nr)rrrrrrrrrszttypager.<locals>.<lambda>cSstjjddddS)Nrr)rrrrrrrrrsZLINESrz
-- more --qQz
          

bB)rr)rr)rrr)rrrttyrrfilenoZ	tcgetattrZ	setcbreakrrrUnsupportedOperationrr	rrorerrr!flushZ	tcsetattrZ	TCSAFLUSH)
r.r#rroldZgetcharhrZincr,rrrrsL








&rcCstjjtt|dS)z>Simply print unformatted text.  This is the ultimate fallback.N)rrrrr)r.rrrrsrcCstj|r>|jtjkr d|jSt|dr4d|jSd|jStj|rRd|jStj|rtd|jj	|jj|jfStj
|rd|jj	|jj|jfStj|rd|jStj|rd	|jStj
|rd
|jSt|jS)z/Produce a short description of the given thing.zbuilt-in module rZzpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%szclass z	function zmethod )rr*r%rrrcr8r__objclass__r&rr+r6r7r)thingrrrdescribe
s.
















rcCsdd|jdD}d\}}xB|t|kr^tdj|d|d|}|rZ||d}}qPqW|rj|}nt}x8||dD](}yt||}Wq|tk
rdSXq|W|S)z@Locate an object by name or dotted path, importing as necessary.cSsg|]}|r|qSrr)rkrrrrr'szlocate.<locals>.<listcomp>rNrr)Nr)rr rr!rZr<r)rrr>rnZ
nextmodulerrrrrlocate%s 
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%)rr6rrr<)rrrr(rrrresolve>s


r Python Library Documentation: %scCs|dkrt}t||\}}t|}tj|}|rTd|krT|d|d|jd7}n|rn||k	rn|d|j7}tj|ptj|ptj	|ptj
|ptj|pt|t
st|}|d7}||d|j||S)zBRender text documentation, given an object or a path to an object.Nrz in z in module z objectz

)r.rrrr8rfindr%r*r+r,rrrrrr)rrrZrendererrr(rrrrr
render_docLs$






rcCsfy2|dkrtt|||n|jt|||tWn.ttfk
r`}zt|WYdd}~XnXdS)zCDisplay text documentation, given an object or a path to an object.N)rrr	plaintextrrprint)rrroutputrHrrrr"esr"cCsy`t||\}}tjt|tj||}t|dddd}|j|WdQRXtd|dWn.tt	fk
r}zt|WYdd}~XnXdS)z<Write HTML documentation to a file in the current directory.z.htmlrzutf-8)rNZwrote)
rhtmlrrrrrrrr)rrrr(rrrHrrrwritedocpsrrcCs6|dkri}x$tj|g|D]\}}}t|qWdS)zAWrite out HTML documentation for all modules in a directory tree.N)r9
walk_packagesr)rpkgpathdonerCr'rDrrr	writedocs{s
rcJ@seZdZdddddddddddd
dddddddddddddddddddddd&!Zd'd(dDZdedddd	d
ddSZdTdUdVdWdXdYdZd[d\d]d^d_d_d`d`daZxPejD]D\ZZ	x8e	D]0Z
eje
eZeekredbeZeee
<qWqWdd
dddddddddvdddddddddddddddd d!d"d#d$d%d&d'd(d)d*ddd+d,d-d.d/d0dd1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@ddAdBdd!dd
dCdDdEdFdʜIZdGdd̈́Z
eddτZeddτZdd҄ZeZefddԄZddքZdd؄ZddڄZdd܄ZdHddZddZddZddZdIddZdJddZddZdKddZ dS(LHelperrBOOLEANwithassertbreak	while forclassCLASSES SPECIALMETHODScontinuefunctiondelBASICMETHODSifelsetryforbreak continue whileimportglobalnonlocal NAMESPACES
TRUTHVALUEMODULESinSEQUENCEMETHODS
COMPARISONlambdarznonlocalglobal NAMESPACESpassraise
EXCEPTIONSreturnwhilebreak continue if TRUTHVALUE CONTEXTMANAGERS EXCEPTIONS yieldyield)!FalseNoneTrueandasrrrrdefrelifrexceptfinallyrfromrrrrisrrnotorrrrrrrrcCsg|]}dD]}||qqS)'r)rrr)rkprrrrrszHelper.<listcomp>rfrur'''r"""+rU***r//%<<>>r|^~rr<=>===!=<>+=-=*=/=%=&=|=^=<<=>>=**=//=jJ)STRINGS	OPERATORSrUNARYAUGMENTEDASSIGNMENTBITWISECOMPLEXzOPERATORS FORMATTINGPOWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTSELLIPSISzSLICINGS DICTIONARYLITERALSz	def classrPRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ
BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)rz**,rz...:@rr_r^`rr'[]rtypesRSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspectstrings4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPESstring-methodsSTRINGS FORMATTING
formatstringsr:encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPESnumbersINTEGER FLOAT COMPLEX TYPESintegers	int rangefloating
float math	imaginary
complex cmathtypesseq$STRINGMETHODS FORMATTING range LISTSDICTIONARIEStypesfunctions	def TYPEStypesmethodsclass def CLASSES TYPESbltin-code-objectscompile FUNCTIONS TYPESbltin-type-objectstypes TYPESTYPESbltin-null-objectbltin-ellipsis-objectSLICINGSspecialattrs!class SPECIALMETHODS PRIVATENAMEStypesmodulesoperator-summarylambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIESEXPRESSIONSobjectsspecialnamesbBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES
customizationhash repr str SPECIALMETHODSattribute-accessATTRIBUTES SPECIALMETHODScallable-typesCALLS SPECIALMETHODSsequence-types(SEQUENCES SEQUENCEMETHODS SPECIALMETHODSMAPPINGS SPECIALMETHODS
numeric-types*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS	execmodel%NAMESPACES DYNAMICFEATURES EXCEPTIONSnaming3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURESdynamic-features
NAMESPACESrtry except finally raiseconversionsidentifierskeywords SPECIALIDENTIFIERS
id-classesatom-identifiers
atom-literals=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS	SEQUENCES	exprlistsTUPLES LITERALStypesseq-mutableLISTLITERALSlistsLISTS LITERALStypesmappingDICTIONARYLITERALSrDICTIONARIES LITERALSattribute-references(getattr hasattr setattr ATTRIBUTEMETHODS
subscriptionsslicingscallspowerunarybinaryshiftingbitwisecomparisonsEXPRESSIONS BASICMETHODSbooleansEXPRESSIONS TRUTHVALUE
assignmentr 	augassign
NUMBERMETHODScompoundfor while break continuetruth if while and or not BASICMETHODSdebuggerpdbcontext-managers)IrGrZ
STRINGMETHODSZ
FORMATTINGUNICODEZNUMBERSZINTEGERZFLOATr"rmZMAPPINGSrzZMETHODSZCODEOBJECTSZTYPEOBJECTSZFRAMEOBJECTSZ
TRACEBACKSZNONEr$ZSPECIALATTRIBUTESryrZPACKAGESrPrZ
PRECEDENCEZOBJECTSZSPECIALMETHODSrZATTRIBUTEMETHODSZCALLABLEMETHODSrZMAPPINGMETHODSrZ	EXECUTIONrdZDYNAMICFEATURESZSCOPINGZFRAMESrZCONVERSIONSZIDENTIFIERSZSPECIALIDENTIFIERSr%ZLITERALSZTUPLESZ
TUPLELITERALSZLISTSrqr>ruZ
ATTRIBUTESZ
SUBSCRIPTSrJZCALLSr#rZBINARYZSHIFTINGr!rrZ	ASSERTIONZ
ASSIGNMENTr ZDELETIONZ	RETURNINGZ	IMPORTINGZCONDITIONALZLOOPINGrZ	DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dS)N)_input_output)r>inputrrrrrz/szHelper.__init__cCs|jp
tjS)N)rrr)r>rrrrr3szHelper.<lambda>cCs|jp
tjS)N)rrr)r>rrrrr4scCs2tjdddkr|dSd|jj|jjfS)Nrr0?rz<%s.%s instance>)rstackrr&r[)r>rrr__repr__6s
zHelper.__repr__cCs6||jk	r|j|n|j|j|jjddS)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.
)_GoInteractiverintrointeractrr)r>requestrrr__call__>s
zHelper.__call__cCs|jjdxy|jd}|s PWnttfk
r<PYnX|j}t|dkr|d|dkoldknr|d|dd
kr|dd}|jdkrP|d
kr|jq|j	|qWdS)Nrzhelp> rrrrrrquitrr)rrrr)rr)
rrgetlinerEOFErrorrr rrr)r>rrrrrKs"
,
zHelper.interactcCs8|jtjkrt|S|jj||jj|jjSdS)z.Read one line, using input() when appropriate.N)rrrrrrr)r>promptrrrr`s

zHelper.getlinecCs<t|tdkr|j}|dkr,|jn|dkr>|jn|dkrP|jn|dkrb|jn|dddkr|j|jdn||jkr|j|nj|dkrt	t
|dnR||jkr|j|n<||j
kr|j|n&|rt	|d|jd
nt	td|jd
n$t|tr|nt	|d|jd
|jjddS)Nrkeywordssymbolstopicsrzmodules rrrrzHelp on %s:)rr)rrr)rrlistkeywordslistsymbols
listtopicslistmodulesrr
showsymbolr"evalr	showtopicrrr6rrrr)r>rrrrris6






zHelper.helpcCs$|jjdjdtjdddS)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)rrr
rr)r>rrrr~szHelper.introrPc		Cstt|}||}t||d|}xt|D]z}xht|D]\}|||}|t|kr@|jj||||dkr@|jjdd|dt||q@W|jjdq2WdS)Nrrr)r	sortedr rrr)	r>itemscolumnsrZcolwrrowrrlrrrr	s(zHelper.listcCs |jjd|j|jjdS)NzN
Here is a list of the Python keywords.  Enter any keyword to get more help.

)rrr	rrD)r>rrrrszHelper.listkeywordscCs |jjd|j|jjdS)Nzx
Here is a list of the punctuation symbols which Python assigns special meaning
to. Enter any symbol to get more help.

)rrr	rrD)r>rrrrszHelper.listsymbolscCs |jjd|j|jjdS)NzN
Here is a list of available topics.  Enter any topic name to get more help.

)rrr	rrD)r>rrrrszHelper.listtopicscCs,yddl}Wn tk
r,|jjddSX|jj||jj|}|s`|jjdt|dSt|tdkr||j	||S|\}}y|jj|}Wn(t
k
r|jjdt|dSX|jd}|r|pdd|}|r ddl}ddj
|jd}	|j|	d	}
|d
dj
|
7}t|dS)Nrzt
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
zno documentation found for %s
rrrzRelated help topics: z, Hz
%s
)pydoc_data.topicsrrrrrorrrrKeyErrorrtextwrapr!rZwrapr)r>topic
more_xrefs
pydoc_datatargetlabelxrefsr"rr.Zwrapped_textrrrrs6zHelper.showtopiccCsyddl}Wntk
r dSX|jj||jj|}|sDtdt|trZ|j||S|\}}|jj|}|r|pxdd|}||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.
        rNt
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
rzcould not find topicr)rr)	rrrrorrerr6	_gettopic)r>rrrrrrr"rrrrs	
zHelper._gettopiccCs*|j|}|jd\}}}|j||dS)Nr)r	partitionr)r>symbolrrr_rrrrrs
zHelper.showsymbolcsv|r |jjdj|t|nR|jjdi}|fddfdd}tj|d|j|j|jjddS)	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}|jddkr:d||<dS)	N	z	.__init__z
 (package)rrrii)find)rr'rrrrrcallbacksz$Helper.listmodules.<locals>.callbackcsd|ddS)Nr)r')rrronerrorsz#Helper.listmodules.<locals>.onerror)rz
Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".
)rrr
apropos
ModuleScannerrunr	rD)r>rGrrr)rrrs
zHelper.listmodules)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rrz)rr)rr)rr)rrz)rr)rr)rr)rr)rrrr)rrrr)rrUrrrrrrrrrrr	rrr
rrr
r)rrr
rrr
r)rUr	)rrrrrrrrrrrr)rrrrrr	)rr)r,r-)r.r/)r0r1)r2r)r.r3)r4r5)r6r7)r8r9)r:r;)r<r=)r?r@)rArB)rCrD)rErF)rHr)rIrJ)rKr)r,rL)rMr)rNrO)rQrG)rRrS)rTrU)rVrW)rXrY)rZr[)rZr\)r]r^)r_r`)rarb)rcr)rre)rfr)rgrh)rir)rjr)rkrl)rnro)rprq)rrrs)rtru)rrv)rwrx)ryr)rzr)r{rP)r|rP)r}rP)r~rP)rrP)rrP)rr)rr)rr )rr)rr)rr)rr)rr)NN)rr)r)r)r)!r%r&r[rZ_strprefixesZ_symbols_inverserrrZsymbols_rrorrzrrrrrrrrrrrr	rrrrrrrrrrrrs6





	
 rc@seZdZdZdddZdS)rz7An interruptible scanner that searches module synopses.NcCs
|r|j}d|_i}xztjD]p}|dkrd||<|dkrH|d|dqt|jpTd}|jdd}|d|}|jj|dkr|d||qWxdtj	|dD]R\}	}}
|jrP|dkr|d|dqytj
|	|}Wntk
rwYnX|j}t
|d	rny|j|}
Wn&tk
r:|r4||wYnXttj|
pNd}t
|d
rh|j|}nd}n^ytjj|}Wn&tk
r|r||wYnX|jr|jjdnd}t|dd}|d|}|jj|dkr||||qW|r|dS)NF__main__rrrrz - )r
get_sourceget_filenamerV)rrrrrrUrrr9r	_get_specrrrcrrJrrStringIOrrrrrrr<)r>rrGZ	completerrseenr'r(rrCrDrrsourcerrrrrrs`zModuleScanner.run)NNN)r%r&r[rUrrrrrrsrcCsDdd}dd}tj"tjdtj|||dWdQRXdS)zAPrint all the one-line module summaries that contain a substring.cSs6|dddkr |ddd}t||o.d|dS)Nrz	.__init__z
 (package)z- ii)r)rr'rrrrrOszapropos.<locals>.callbackcSsdS)Nr)r'rrrrSszapropos.<locals>.onerrorignore)rN)warningscatch_warningsfilterwarningsrr)rGrrrrrrMs


rcsddlddlddlddlGdddjjGfdddjjGfdddj}|||}|jx|j	r|j
rtjd	q~W|S)
a7Start 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.time()
        >>> timeout = 1                    #seconds

        This is a short timeout for testing purposes.

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

        Print any errors that may have occurred.

        >>> print(serverthread.error)
        None
   rNc@seZdZddZddZdS)z!_start_server.<locals>.DocHandlercSsX|jjdrd}nd}|jd|jdd||j|jj|j|j|jddS)	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.cssztext/cssz	text/htmlzContent-Typez%s; charset=UTF-8zutf-8N)	rrbZ
send_responseZsend_headerZend_headersZwfiler
urlhandlerr)r>content_typerrrdo_GETs

z(_start_server.<locals>.DocHandler.do_GETcWsdS)Nr)r>rrrrlog_messagesz-_start_server.<locals>.DocHandler.log_messageN)r%r&r[rrrrrr
DocHandlersrcs(eZdZddZfddZddZdS)z _start_server.<locals>.DocServercSs6d|_|j|f|_||_|jj||j|jd|_dS)NZ	localhostF)hostZaddressrrIrzhandlerr)r>portrrrrrzs
z)_start_server.<locals>.DocServer.__init__csBx4|js4j|jjgggd\}}}|r|jqW|jdS)Nr)rselectZsocketrZhandle_requestZserver_close)r>ZrdwrZex)rrrserve_until_quits
z1_start_server.<locals>.DocServer.serve_until_quitcSs |jj||jr|j|dS)N)rIserver_activater)r>rrrrsz0_start_server.<locals>.DocServer.server_activateN)r%r&r[rzrrr)rrr	DocServersrcs:eZdZfddZfddZddZddZd	S)
z#_start_server.<locals>.ServerThreadcs,||_t||_jj|d|_d|_dS)NF)rrrThreadrzservingerror)r>rr)	threadingrrrzs

z,_start_server.<locals>.ServerThread.__init__cstyFjj__jj_t|j_|j	|j
}||_|jWn(t
k
rn}z||_WYdd}~XnXdS)zStart the server.N)server
HTTPServerrIrrZMessageZMessageClassstaticmethodrrready	docserverrrJr)r>Zdocsvre)rremailhttprrrs

z'_start_server.<locals>.ServerThread.runcSs,d|_|j|_|j|_d|j|jf|_dS)NTz
http://%s:%d/)rrZserver_portrr)r>rrrrrsz)_start_server.<locals>.ServerThread.readycSs&d|j_|jd|_d|_d|_dS)z&Stop the server and this thread nicelyTNF)rrr!rr)r>rrrstops
z(_start_server.<locals>.ServerThread.stopN)r%r&r[rzrrrr)rrrrrrrServerThreads
rg{Gz?)
Zhttp.serverZ
email.messagerrrZBaseHTTPRequestHandlerrrr#rrtimeZsleep)rrrZthreadr)rrrrrrr
_start_server[s8&
r	text/htmlcs*Gfdddt}|fddfddfddfd	d
fdd	fd
dfddfddfdd	f	dd}|jdr|dd}|dkrtjjtjjt}tjj||}t|}dj|j	SQRXn|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.
    cs eZdZfddZddZdS)z_url_handler.<locals>._HTMLDoccsd}d|}d|||fS)zFormat an HTML page.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>rrcss_pathZcss_link)html_navbarrrrsz#_url_handler.<locals>._HTMLDoc.pagecSsd||fS)Nz<a href="getfile?key=%s">%s</a>r)r>rrrrrr
	sz'_url_handler.<locals>._HTMLDoc.filelinkN)r%r&r[rrr)rrr_HTMLDocs
rcs>jdtjtjdtjf}d|jtjddfS)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@)rrrr	s
z!_url_handler.<locals>.html_navbarcsdd}jddd}ddtjD}j||}|djd	dd
|g}i}x tjD]}|jj||qVW|jddd
j|fS)zModule Index page.cSsd||fS)Nz<a href="%s.html">%s</a>r)r(rrr	bltinlink.	sz3_url_handler.<locals>.html_index.<locals>.bltinlinkz7<big><big><strong>Index of Modules</strong></big></big>z#ffffffz#7799eecSsg|]}|dkr|qS)rr)rkr(rrrr4	sz4_url_handler.<locals>.html_index.<locals>.<listcomp>z<p>zBuilt-in Modulesz#ee77aaz|<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)	rrrr
rrr
ror!)rrnamesrrr)rrr
html_index+	sz _url_handler.<locals>.html_indexc	sgfdd}tj*tjddd}tj|||dWdQRXdd	}g}jd
dd}x"D]\}}|j|||qhW|jd
|dddj|}d|fS)zSearch results page.cs:|dddkr |ddd}j||o0d|fdS)Nrz	.__init__z
 (package)z- ii)r
)rr'r)
search_resultrrrI	sz3_url_handler.<locals>.html_search.<locals>.callbackrcSsdS)Nr)r'rrrrP	sz2_url_handler.<locals>.html_search.<locals>.onerror)rNcSsd||fS)Nz<a href="%s.html">%s</a>r)r(rrrrU	sz4_url_handler.<locals>.html_search.<locals>.bltinlinkz5<big><big><strong>Search Results</strong></big></big>z#ffffffz#7799eezkey = %sz#ee77aaz<br>zSearch Results)	rrrrrrr
rr!)	rGrrrrhrr(rr)r)rrhtml_searchD	s 

z!_url_handler.<locals>.html_searchc
sjtjj|}tj|}j|j}WdQRXd|}jddd}|jd|dd|}d||fS)	z-Get and display a source file listing safely.Nz
<pre>%s</pre>z3<big><big><strong>File Listing</strong></big></big>z#ffffffz#7799eezFile: %sz#ee77aaz
getfile %s)	r4r5Zunquoterrrrrr)rfpr#Zbodyrr)rrrhtml_getfileb	sz"_url_handler.<locals>.html_getfilecsLdd}jddd}ttjj}j||}|jddd|}d|fS)zIndex of topic texts available.cSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrrr	sz4_url_handler.<locals>.html_topics.<locals>.bltinlinkz,<big><big><strong>INDEX</strong></big></big>z#ffffffz#7799eeZTopicsz#ee77aa)rrrrrDr
r)rrrr)rrrhtml_topicso	sz!_url_handler.<locals>.html_topicscsLjddd}ttjj}dd}j||}|jddd|}d|fS)zIndex of keywords.z,<big><big><strong>INDEX</strong></big></big>z#ffffffz#7799eecSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr	sz6_url_handler.<locals>.html_keywords.<locals>.bltinlinkZKeywordsz#ee77aa)rrrrrDr
r)rrrr)rrr
html_keywords	sz#_url_handler.<locals>.html_keywordscstj}t||}|j|\}}||jkr0d}nd}jd|dd}dj|}j|dd|}|rt|j	}dd	}j
||}jd
dd|}d||fdj|||ffS)
zTopic or keyword help page.ZKEYWORDZTOPICz)<big><big><strong>%s</strong></big></big>z#ffffffz#7799eez
<pre>%s</pre>z#ee77aacSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr	sz7_url_handler.<locals>.html_topicpage.<locals>.bltinlinkzRelated help topics: z%s %sr)
rrrrrrr&rrrr
rr!)rZbufZhtmlhelprrrrr)rrrhtml_topicpage	s&



z$_url_handler.<locals>.html_topicpagecs@t|dd}|dkr$|dkr$tdt|}j||}||fS)Nr)rrzcould not find object)rrerr)rr9rcontent)rrrhtml_getobj	sz!_url_handler.<locals>.html_getobjcsPjddd}djfddtt||D}|j|dd|}d||fS)	Nz,<big><big><strong>Error</strong></big></big>z#ffffffz#7799eez<br>c3s|]}j|VqdS)N)r)rkr)rrrrm	sz3_url_handler.<locals>.html_error.<locals>.<genexpr>z#bb0000z
Error - %s)rr!rrr)rrrr)rrr
html_error	sz _url_handler.<locals>.html_errorcs|}|jdr|dd}y2|dkr4\}}n|dkrJ\}}n|dkr^\}}nd|kr@|jd\}}}|d	kr|\}}n|d
kr|\}}n|dkry|\}}Wn tk
r|\}}YnXn^|dkr6|dkr\}}n4y|\}}Wn"tk
r2|\}}YnXntd
n|\}}Wn2tk
r}z||\}}WYdd}~XnXj||S)zGenerate an HTML page for url.z.htmlNrrorrraz
search?keyzgetfile?keyz	topic?keyzget?keyz
bad pydoc url)rro)rro)rbrrerJr)rZcomplete_urlrropr_r)	rrrrrrrrrrr
get_html_page	sB




 z#_url_handler.<locals>.get_html_pagerrNztext/cssrz	text/htmlz"unknown content type %r for url %s)rrar	rdirnamerealpathrVr!r	readlinesrt)rrrrZ	path_hererrr)
rrrrrrrrrrr_url_handlers,	

*



rT)open_browsercCsddl}tt|}|jr&t|jdS|jrd}|r@|j|jzy^td|jt|xD|jrtd}|j	}|dkr|PqZ|dkr|j|jqZt|qZWWnt
tfk
rtYnXWd|jr|j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 ready atzserver> rrzServer stopped)
webbrowserrrrrrrrrrrrr)rrrZserverthreadZserver_help_msgrrrrbrowse	s2

rcCst|to|jtjdkS)Nr)rr6rr	sep)rNrrrispath
sr
cCsddl}Gdddt}dtjkrXtjjtjd}|tjkrJtjj|tjjddyp|jtjddd\}}d	}d	}d	}d}xP|D]H\}	}
|	d
krd}d}|	dkrt	|
dS|	d
krd}|
}|	dkrd}qW|r|dkrd}t
||ddS|s|x|D]}t|r4tjj|r4t
d|Py`t|rVtjj|rVt|}|rt|r~tjj|r~t|nt|n
tj|Wn,tk
r}zt
|WYdd}~XnXqWWnN|j|fk
rtjjtjjtjdd}
t
dj|
tjdYnXdS)z@Command-line interface (looks at sys.argv to decide what to do).rNc@seZdZdS)zcli.<locals>.BadUsageN)r%r&r[rrrrBadUsage
srrrrzbk:p:wFz-bTz-kz-pz-w)rzfile %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} -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.  The -p option can be used with
    the -b option to explicitly specify the server port.

{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	)getoptrJrrr	rargvremoveinsertrrr
existsrr{rrrrrrrrrr
r	)rrZ	scriptdirZoptsrZwritingZstart_serverrroptvalargrHrrrrcli
sd




$rr)NN)r)r)rrN)rrN)r)rN)r)r)XrUr3rPrTrSrZZimportlib._bootstraprZimportlib._bootstrap_externalimportlib.machineryimportlib.utilrrr	r9rrrrrZurllib.parser4rcollectionsrreprlibr	tracebackrrrr$r)r-r/r3r
IGNORECASEr4r5r:r?rCrOrerfrwr}rrrJrrrrrrrqrrrrrrrrrrrrrr.rrrrr"rrrrrrrrrr
rr%rrrr<module>#s		


	'
0>*- d",






=
%V


OHA YOOOO