HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //usr/lib/python3.7/__pycache__/pydoc.cpython-37.pyc
B

{a@sdZdgZdZdZdZddlZddlZddlZddl	Zddl
ZddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZdd	lmZd
dZdd
ZddZddZ ddZ!ddZ"ddZ#e$dej%Z&ddZ'ddZ(ddZ)dd Z*d!d"Z+dzd#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@dKdLZAdMdNZBdOdPZCdQdRZDd{dSdTZEe:ZFe;ZGe8ZHd|dUdVZId}dXdYZJd~dZd[ZKdd\d]ZLdd_d`ZMGdadbdbZNeNZOGdcddddZPdedfZQdgdhZRddjdkZSddldmdndodpZTdqdrZUdsdtZVdudvZWdwdxZXeYdykreXdS)a^Generate 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

    /usr/share/doc/pythonX.Y/html/library

if the pythonX.Y-doc package is installed or 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}tj|p d}tj|}||krtj|r||||qW|S)zAConvert sys.path into a list of absolute, existing, unique paths..)syspathosabspathnormcaseisdirappend)dirsZnormdirsdirZnormdirr/usr/lib/python3.7/pydoc.pypathdirsTs
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)doclinesrrrsplitdoces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	classnamens
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	isroutineZisframeZistracebackZiscode)rrrrisdatausr-cGs2x,|r,|d||d}|dd}qW|S)z/Do a series of global replacements on a string.rrrN)r!r)textZpairsrrrreplace{sr/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.maxlenZpreZpostrrrcrams
$r3z at 0x[0-9a-f]{6,16}(>+)$cCstd|S)z>Remove the hexadecimal id from a Python object representation.z\1)_re_stripidr)r.rrrstripidsr5cCs(t|p&t|p&t|p&t|S)N)r
isfunctionismethod	isbuiltinZismethoddescriptor)objrrr_is_some_methods


r: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)rr7r8getattrr*)fnselfrrr_is_bound_methods

r?cCshi}x t|tD]\}}d||<qWx|jD]}|t|q.Wx|D]}t||||<qNW|S)Nr)r
getmembersr:	__bases__update
allmethodskeysr<)clmethodskeyvaluebaserrrrCsrCcCs<g}g}x*|D]"}||r&||q||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	predicateZyesZnoxrrr_split_lists
rMcCs\|dkrdS|dr$|dr$dS|dr<t|dr<dS|dk	rL||kS|dSdS)	z3Decide whether to show documentation on a variable.>__version____file__r&__path__
__loader__
__cached__
__author__	__slots____doc____date____package____credits____spec____builtins____qualname__r%r__r__fieldsTN)
startswithendswithhasattr)r(allr9rrrvisiblenamesrccCsDg}x:t|D],\}}}}t|r*d}|||||fqW|S)zCWrap inspect.classify_class_attrs, with fixup for data descriptors.zdata descriptor)rclassify_class_attrsisdatadescriptorr
)rresultsr(kindclsrHrrrrds
rdcs\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>cs|dd|dfS)Nr)get)attr)field_orderrr<lambda>z!sort_attributes.<locals>.<lambda>)rGN)r<	enumerate	TypeErrorsort)attrsrZkeyfuncr)rorkrsort_attributess
rvcCs<tj|r8x*dD]"}tjtj|d|rdSqWdS)z3Guess whether a path refers to a package directory.)z.pyz.pyc__init__TF)r	rrisfiler!)rextrrr	ispackages

rzcCs|}x*|dddks"|s2|}|s
Pq
W|}|dddkrX|dd}|dddkr|dd}|dddkr|dd}x|s|}|sPqW|dd	}nd}|S)
Nr#zr"""r0z"""\r)readlinerr)filelinerrrrsource_synopsiss&
rc
	Cst|j}||d\}}|dks.||kr|ttjjrJtjj	}n |ttjj
rftjj}nd}|dkryt
|}Wntk
rdSX|t|}WdQRXnZ|d|}tjjd||d}ytj|}	Wn
dStjd=|	jr|	jdnd}||f||<|S)z.Get the one-line summary out of a module file.)NNNZ__temp__)loaderr)r	statst_mtimermr`tuple	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_inforrrrw+szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)rr%rrH)r>rrrr__str__/szErrorDuringImport.__str__N)r%r&r[rUrwrrrrrr)src		Cstjj}t|d}||t|k}WdQRXtj|}tj	|\}}|r`tj
||}ntj
||}tjj
|||d}ytj|St|tYnXdS)z<Import a Python source file or compiled file given its path.rbN)r)rrMAGIC_NUMBERrreadr r	rbasenamesplitext_bootstrap_externalrSourceFileLoaderrrrrrr)	rmagicrZis_bytecoderr(ryrrrrr
importfile3src	s"yb|rXtjkrXtjkrXfddtjD}x(g|D]}tj|||<tj|=q:Wt}Wnxt\}}}}	tjkrttjj|	n<|tkrt|j|	n&t	|t
r|jkrdSttYnXx@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|]}|dr|qS)r)r_)rim)rrr
<listcomp>Yszsafeimport.<locals>.<listcomp>Nrr)rrbuiltin_module_names
__import__rrrOSyntaxErrorr
issubclassImportErrorr(rr<AttributeError)r	forceloadrZsubsrGrrrHrinfopartr)rr
safeimportEs.


rc@s|eZdZejddejddZd
ddZ	dddZ
e
ZZZ
ZZZejejd	d
ejddfddZdS)Doc
PYTHONDOCSz%https://docs.python.org/%d.%d/libraryNrcGs||f|}t|r |j|St|r4|j|Sy@t|rJ|j|St|r^|j|St|rr|j	|SWnt
k
rYnXt|tr|j
|S|j|S)z%Generate documentation for an object.)risgetsetdescriptordocdataismemberdescriptorr*	docmoduler+docclassr,
docroutiner
isinstancepropertydocpropertydocother)r>rr(argsrrrdocument{s"










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%rs)r>rr(rmessagerrrfailszDoc.failZlibzpython%d.%dcCsyt|}Wntk
r&d}YnXtjd|j}tj|}t	|t
tr|jdks||r|tj
|ds|tj
|ds|jdkr|drd|d	|jf}qtj
||jd
}nd}|S)z*Return the location of module docs or Nonez
(built-in)r)
errno
exceptionsZgcZimpmarshalposixsignalr_threadZ	zipimportz
dist-packagesz
site-packages)z	xml.etreeztest.pydoc_mod)zhttp://zhttps://z%s/%s/z.htmlN)r
getabsfilersr	environrmrrrrrr%r_r!rlower)r>rZbasedirrdoclocrrr	getdoclocs"




z
Doc.getdocloc)N)N)r%r&r[r	rrmrversion_inforrrrrrrrrrr!base_exec_prefixrrrrrrus

rc@sHeZdZdZddZddZddZdd	Zd
dZeZ	dd
Z
eZdS)HTMLReprzBClass for safely making an HTML representation of a Python object.cCs,t|d|_|_d|_d|_|_dS)N
d)rrwmaxlistmaxtuplemaxdict	maxstringmaxother)r>rrrrws
zHTMLRepr.__init__cCst|ddddddS)N&z&amp;<z&lt;>z&gt;)r/)r>r.rrrescapeszHTMLRepr.escapecCst||S)N)rr)r>rrrrrsz
HTMLRepr.reprcCsZtt|dr@ddt|j}t||r@t||||S|ttt	||j
S)Nr%repr_r])rarr!r%rr<rr3r5rr)r>rLlevel
methodnamerrrrepr1s

zHTMLRepr.repr1cCs^t||j}t|}d|krJdt|ddkrJd|d|||dStdd||S)Nr~z\\rrrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z<font color="#c040c0">\1</font>)r3rrr/rrr)r>rLrtesttestreprrrrrepr_stringszHTMLRepr.repr_stringcCs8y|ttt||jS|d|jjSdS)Nz
<%s instance>)rr3r5rr	__class__r%)r>rLrrrr
repr_instanceszHTMLRepr.repr_instanceN)r%r&r[rUrwrrrrrepr_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
bigsectionszHTMLDoc.bigsectionc
Cs&||}t|dddddddd	S)z!Format literal preformatted text.z

z
 
rz&nbsp;rz<br>
)r
expandtabsr/)r>r.rrr	preformatszHTMLDoc.preformatr|cCsd}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>listformatZcolsrrowscolrjrrrmulticolumnszHTMLDoc.multicolumncCsd|S)Nz<font color="#909090">%s</font>r)r>r.rrrgrey)rqz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|jtj|j}}t||rDt|||krDd|j|t||fSt||S)zMake a link for a class.z<a href="%s.html#%s">%s</a>)r%rrrmr&rar<r))r>rr'r(rrrr	classlink2s
zHTMLDoc.classlinkcCsd|j|jfS)zMake a link for a module.z<a href="%s.html">%s</a>)r%)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)z<a href="%s">%s</a>)r)r>Z
modpkginfor(rrzshadowedurlr.rrr
modpkglink>s

zHTMLDoc.modpkglinkcCsd||fS)zMake a link to source file.z<a href="file:%s">%s</a>r)r>r	rrrrfilelinkMszHTMLDoc.filelinkcCs|p|j}g}d}td}xL|||}	|	s2P|	\}
}|||||
|	\}}
}}}}|
r||dd}|d||fn|rdt|}|d|||fn|rdt|}|d|||fn|r$|||dd	kr|d
|	||n|d|n@|||dd	krR||	||||n||	|||}q W||||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;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.rfuncsclassesrFrfherepatternmatchstartendrbZschemeZrfcZpepZselfdotr(r	rrrmarkupQs<

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


zHTMLDoc.formattreec#
s|j}y
|j}Wntk
r(d}YnX|d}g}x@tt|dD],}|dd|d|d||fqJWd||dd}	d|	}
y&t	|}t
j|}
||}
Wntk
rd}
YnXg}t|dr:t|j}|dd	d
kr&|dddkr&|d	d}|d|t|d
r\|t|j|rt|
dd|}
|}|dk	rdt}nd}|
ddd|
|}t|tj}gi}}xlt|tjD]Z\}}|dk	st|p||krt|||r|||fd|||<||<qWx|D]\}}xx|jD]n}|j|j}}tj !|}||krL|rLt||rLt"|||krL||krL|d|||<||<qLWq<Wgi}}xt|tj#D]p\}}|dk	st$|st||krt|||r|||fd|||<t%|r||||<qWg}x6t|t&D]&\}}t|||rd|||fqdW't(|j)||}|od|}|d|}t|dr*g}x.t*+|j,D]\}}} |||| dfqW|-.|j/}!|0ddd|!}n.|rX.|fdd}!|0d dd|!}|rd!d"|D}"1t2|"d|g}!x*|D]"\}}|!3|||||qW|0d#dd$d%|!}|rg}!x*|D]"\}}|!3|||||qW|0d&dd'd%|!}|rbg}!x$|D]\}}|!3||q(W|0d(dd)d*|!}t|d+r'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}z)<big><big><strong>%s</strong></big></big>z
(built-in)rNz$Revision: $z
version %srVz (%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>
rPrzPackage Contentsz#aa55cccs|dS)Nr)r)t)r>rrrprqz#HTMLDoc.docmodule.<locals>.<lambda>ZModulescSsg|]\}}|qSrr)rirGrHrrrrsz%HTMLDoc.docmodule.<locals>.<listcomp>ZClassesz#ee77aarZ	Functionsz#eeaa77ZDataz#55aa55z<br>
rSZAuthorrXZCredits)6r%__all__rrrr r
r!rrurllibparseZquoterrsrastrrNrrrVrlocalsrr@r*r+	getmodulercrAr&rrrmr<r,r8r6r-rrrpkgutiliter_modulesrPrtrr
rrgetclasstreerrSrX)#r>rr(modignoredrbpartsZlinksrjZ
linkednameheadrr	rrversionrrrrZcdictrGrHrIr'rrZfdictdatar"modpkgsimporterispkgr	classlistr)r>rrs


&


$




$

zHTMLDoc.docmodulec	sj}|p|}j}g}	|	jGfddd}
|
tt}t|dkrdx"|D]}d|j	qfWdfdd}
fd	d
}fdd}fd
dt
D}ixv|D]n\}}}}d|d||<}yt|}Wntk
r:YnXy||<Wqt
k
r^YqXqWx|rb|r||n|ddt|fdd\}}tjkr|}qfn"krd}ndj	}|d7}t||
d||dd}|
d||dd}|
d||dd}|d||dd}|d||d d}|gksZt|}qfWd!|	}	||krd"||f}nd#|||f}|rg}x"|D]}||j	qW|d$d%|}d!}yt}Wntt
fk
rd&}YnX|r6t|}|r6|d'kr6||d(}t}|rR||pNd!}|j}|ord)|}|d*d+|	d,|S)-z.Produce HTML documentation for a class object.cs eZdZddZfddZdS)z(HTMLDoc.docclass.<locals>.HorizontalRulecSs
d|_dS)Nr)needone)r>rrrrwsz1HTMLDoc.docclass.<locals>.HorizontalRule.__init__cs|jrdd|_dS)Nz<hr>
r)r9)r>)pushrrmaybesz.HTMLDoc.docclass.<locals>.HorizontalRule.maybeN)r%r&r[rwr;r)r:rrHorizontalRulesr<rz&<dl><dt>Method resolution order:</dt>
z<dd>%s</dd>
z</dl>
cst||\}}|r|xl|D]d\}}}}yt|}Wn&tk
rh||YnX||dq(W|S)Nr)rMr;r<	Exception_docdescriptorr)msgrurKokr(rghomeclsrH)rrhrmdictr/rr:r>rrspill&szHTMLDoc.docclass.<locals>.spillcsNt||\}}|rJ|x&|D]\}}}}||q(W|S)N)rMr;r>)r?rurKr@r(rgrArH)rBr/r:r>rrspilldescriptors8sz*HTMLDoc.docclass.<locals>.spilldescriptorsc
st||\}}|r|x|D]\}}}}t||}t|sZt|rht|dd}	nd}	|	dkrd|n0t|j	}	d|	}	d||	fdq(W|S)NrUz<dl><dt>%s</dl>
z<dd><tt>%s</tt>z<dl><dt>%s%s</dl>
r)
rMr;rr<callablerrerrr)
r?rurKr@r(rgrArHrIr")rrrBrCr/rr:r>rr	spilldataAs"
z#HTMLDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|dr||||fqS))r9)rc)rir(rgrhrH)rrrrVs
z$HTMLDoc.docclass.<locals>.<listcomp>r{-rcs|dkS)Nrr)r%)	thisclassrrrporqz"HTMLDoc.docclass.<locals>.<lambda>zdefined herezinherited from %sz:<br>
z
Methods %scSs|ddkS)Nrmethodr)r%rrrrprqzClass methods %scSs|ddkS)Nrzclass methodr)r%rrrrprqzStatic methods %scSs|ddkS)Nrz
static methodr)r%rrrrprqzData descriptors %scSs|ddkS)Nrzdata descriptorr)r%rrrrprqzData and other attributes %scSs|ddkS)Nrr4r)r%rrrrprqrz*<a name="%s">class <strong>%s</strong></a>z/<strong>%s</strong> = <a name="%s">class %s</a>z(%s)z, Nz()z

z<tt>%s<br>&nbsp;</tt>z#000000z#ffc8d8r0)r%rAr
rrgetmror r;rr&rdr<r=rspopleftrMbuiltinsrrvAssertionErrorr!	signature
ValueErrorr)rrrrr)r>rr(r/rrr0realnamer!rr<mrorIrDrErGrurGrgrArHanchor	inheritedtagrr"declrOargspecr"r)	rrrBrCr/rr:r>rIrrs

	




















zHTMLDoc.docclasscCs|d||S)z)Format an argument default value as text.=)rr)r>rrrrformatvalueszHTMLDoc.formatvaluec	Cs|j}|p|}|r|jpdd|}	d}
d}t|r|jj}|rZ||k	rd|||}
n0|jdk	rzd||jj|}
nd|||}
||krd|	|f}
nD|rt||g|krd	|jd||f}d
}n|}d|	||f}
d}t|rNyt|}Wnt	t
fk
r d}YnX|rNt|}|dkrNd
|}
|d
d}|sXd}|
|||
ov|
d|
}|rd|S|t||j|||}|od|}d||fSdS)z;Produce HTML documentation for a function or method object.rrHrz 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> r}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;rrrgetattr_staticr,rOrPrsr)rrrrr)r>rr(r/rrrFrErQrSnoteskipdocsimclassrZreallinkrWrOrVr"rrrrsX


zHTMLDoc.docroutinecCsTg}|j}|r|d||jdk	rB|t||j}|d||dd|S)Nz!<dl><dt><strong>%s</strong></dt>
z<dd><tt>%s</tt></dd>
z</dl>
r)r
rUrrrr!)r>r(rHr/rfr:r"rrrr>s
zHTMLDoc._docdescriptorcCs||||S)z*Produce html documentation for a property.)r>)r>rr(r/rErrrrszHTMLDoc.docpropertycGs|rd|pd}|||S)z-Produce HTML documentation for a data object.z<strong>%s</strong> = r)r)r>rr(r/r0ZlhsrrrrszHTMLDoc.docothercCs||||S)z1Produce html documentation for a data descriptor.)r>)r>rr(r/rErrrrszHTMLDoc.docdatacCsg}|dkri}xLt|gD]<\}}}tdd|Dr<q||d|||kfd||<qW||||j}||dd|S)z2Generate an HTML index for a directory of modules.Ncss*|]"}dt|kodknVqdS)iiN)ord)richrrr	<genexpr>	sz HTMLDoc.index.<locals>.<genexpr>rrz#ffffffz#ee77aa)r,r-anyr
rtrr
r)r>rrr5r6r(r7rrrrindexsz
HTMLDoc.index)r)rrNr)r|)N)NN)NNN)NN)NNN)N)r%r&r[rUr_repr_instancerrrrrrrrrrrrr
rrrrrrYrr>rrrrbrrrrrs<



+

y$:


rc@s4eZdZdZddZddZddZeZdd	Zd
S)TextReprzAClass for safely making a text representation of a Python object.cCs,t|d|_|_d|_d|_|_dS)Nrrr)rrwrrrrr)r>rrrrws
zTextRepr.__init__cCsTtt|dr@ddt|j}t||r@t||||Sttt||j	S)Nr%rr])
rarr!r%rr<r3r5rr)r>rLrrrrrrs

zTextRepr.repr1cCsHt||j}t|}d|krDdt|ddkrDd|d||dS|S)Nr~z\\rrr)r3rrr/)r>rLrrrrrrr$s
zTextRepr.repr_stringcCs,yttt||jSd|jjSdS)Nz
<%s instance>)r3r5rrrr%)r>rLrrrrr/szTextRepr.repr_instanceN)	r%r&r[rUrwrrrrrrrrrds	rdc@seZdZdZeZejZddZdddZddZ	dddZ
dd
dZd ddZddZ
d!ddZddZd"ddZd#ddZd$ddZd	S)%TextDocz'Formatter class for text documentation.cCsddd|DS)z(Format a string in bold by overstriking.rcss|]}|d|VqdS)Nr)rir_rrrr`?szTextDoc.bold.<locals>.<genexpr>)r!)r>r.rrrbold=szTextDoc.bold    cs>|sdSfdd|dD}|r4|d|d<d|S)z6Indent text by prepending a given prefix to each line.rcsg|]}|qSrr)rir)prefixrrrDsz"TextDoc.indent.<locals>.<listcomp>rr})rrr!)r>r.rir#r)ririndentAszTextDoc.indentcCs$||}||d|dS)z&Format a section with a given heading.rz

)rjrrg)r>rrZclean_contentsrrrrHszTextDoc.sectionNrc
	sd}x|D]}t|tdkrt|\}}||t|}|rj||fkrjfdd|D}	|dd|	}|d}q
t|tgkr
|||||d}q
W|S)	zBRender in text a class tree as returned by inspect.getclasstree().rrc3s|]}t|VqdS)N)r))rir )r'rrr`Wsz%TextDoc.formattree.<locals>.<genexpr>z(%s)z, rz    )rr)r!r)
r>rr'rrirrr r!r"r)r'rrOs

zTextDoc.formattreec	CsD|j}tt|\}}|d||o(d|}t|dd}||}|dk	r`||d|d}|rt||d|}g}	xNt|tjD]<\}
}|dk	st	|p||krt
|
||r|	|
|fqWg}xXt|tjD]F\}
}|dk	st
|st	||krt
|
||r||
|fqWg}
x6t|tD]&\}
}t
|
||r8|
|
|fq8Wg}t}t|drxFt|jD]6\}}}|||r||d	n
||qW|||d
d|}g}xBt|tjD]0\}
}|j|dr|
|kr||
qW|rJ|||d
d|}|	rdd|	D}|t|d|g}x&|	D]\}
}||||
|qzW||dd|}|rg}x&|D]\}
}||||
|qW||dd|}|
rFg}x*|
D]"\}
}||j||
|ddq
W||dd|}t|drt|j}|dddkr|dddkr|dd}||d|}t|dr||dt|j }t|dr||dt|j!}t|d r||d!t|j"}yt#|}Wnt$k
r.d"}YnX||d#|}|S)$z5Produce text documentation for a given module object.NAMEz - r&NzMODULE 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.
ZDESCRIPTIONrPz
 (package)zPACKAGE CONTENTSrrZ
SUBMODULEScSsg|]\}}|qSrr)rirGrHrrrrsz%TextDoc.docmodule.<locals>.<listcomp>rCLASSES	FUNCTIONSF)r2ZDATArNr#z$Revision: r}r$ZVERSIONrVZDATErSZAUTHORrXZCREDITSz
(built-in)ZFILE)%r%r$rrr<rrr@r+r+rcr
r,r8r-setrar,r-rPaddrtr!r*r_rr.rrr)rNrrVrSrXrrs)r>rr(r/ZsynopdescrrbrrrGrHrr4r5Z
modpkgs_namesr6r'r7Z
submodulesr8rr3rrrrr_s





$
zTextDoc.docmodulec	sj}|p|}j}jfdd}||kr:d|}n|d|}|rlt||}	|dd|	}g}
|
jyt}Wnt	t
fk
rd}YnX|rt|}|r|dkrʈ||d	t}
|
r|
d	t
t}t|d
kr.dx|D]}d||qWd
Gfddd}|fdd}fdd}fdd}fddtD}x|r|r|n|dd
t|fdd\}}tjkr|}qn krd}ndtj}t||d||dd}|d||d d}|d!||d"d}|d#||d$d}|d%||d&d}|gkst|}qWd	|
}
|
s|d	S|d	|
d'd	S)(z4Produce text documentation for a given class object.cSs
t||S)N)r))r rrrrmakenamesz"TextDoc.docclass.<locals>.makenamezclass z	 = class z(%s)z, Nz()rrzMethod resolution order:z    rcs eZdZddZfddZdS)z(TextDoc.docclass.<locals>.HorizontalRulecSs
d|_dS)Nr)r9)r>rrrrwsz1TextDoc.docclass.<locals>.HorizontalRule.__init__cs|jrdd|_dS)NzF----------------------------------------------------------------------r)r9)r>)r:rrr;sz.TextDoc.docclass.<locals>.HorizontalRule.maybeN)r%r&r[rwr;r)r:rrr<sr<c
st||\}}|r|x^|D]V\}}}}yt|}Wn&tk
rh||Yq(X||q(W|S)N)rMr;r<r=r>r)r?rurKr@r(rgrArH)rBr/rr:r>rrrDszTextDoc.docclass.<locals>.spillcsNt||\}}|rJ|x&|D]\}}}}||q(W|S)N)rMr;r>)r?rurKr@r(rgrArH)rBr/r:r>rrrEsz*TextDoc.docclass.<locals>.spilldescriptorsc
	st||\}}|r|x~|D]v\}}}}t|sFt|rPt|}nd}yt|}	Wntk
r|j|}	YnXj	|	|d|ddq(W|S)Nrn)r2r"r)
rMr;rFrrerr<r__dict__r)
r?rurKr@r(rgrArHr"r9)rBr/rr:r>rrrGs
z#TextDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|dr||||fqS))r9)rc)rir(rgrhrH)rrrr#s
z$TextDoc.docclass.<locals>.<listcomp>rcs|dkS)Nrr)r%)rIrrrp,rqz"TextDoc.docclass.<locals>.<lambda>zdefined herezinherited from %szMethods %s:
cSs|ddkS)NrrJr)r%rrrrp;rqzClass methods %s:
cSs|ddkS)Nrzclass methodr)r%rrrrp=rqzStatic methods %s:
cSs|ddkS)Nrz
static methodr)r%rrrrp?rqzData descriptors %s:
cSs|ddkS)Nrzdata descriptorr)r%rrrrpArqzData and other attributes %s:
cSs|ddkS)Nrr4r)r%rrrrpCrqz |  )r%rAr&rgmapr!r
rrOrPrsr)rrrKr rdrLrMrMrr)rvrNrjr)r>rr(r/r0rQr!rrrr"rrOrWr"rRrIr<rDrErGrurTrUr)rBr/rr:r>rIrrs


	
















zTextDoc.docclasscCsd||S)z)Format an argument default value as text.rX)r)r>rrrrrYMszTextDoc.formatvaluec	Csr|j}|p|}d}d}t|rn|jj}|rB||k	rndt||}n,|jdk	r`dt|jj|}ndt||}||kr||}	n,|rt||g|krd}||d|}	d}
t|ryt	|}Wnt
tfk
rd}YnX|rt|}
|d	kr||d
}	|
dd}
|
s&d}
|	|
|}|r@|d
St
|pLd}
|d
|
oj||
d
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 r}z(...)r)r%r?r;rr)rgrrZr,rOrPrsr)rrjr)r>rr(r/rErQr[r\r]rrWrOrVr"rrrrQsH


zTextDoc.docroutinecCsTg}|j}|r$||||dt|p.d}|rJ||||dd|S)Nrr)r
rgrrjr!)r>r(rHr/rfr:r"rrrr>szTextDoc._docdescriptorcCs||||S)z*Produce text documentation for a property.)r>)r>rr(r/rErrrrszTextDoc.docpropertycCs||||S)z1Produce text documentation for a data descriptor.)r>)r>rr(r/rErrrrszTextDoc.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.z = rrNz...r)rr rgrjr))
r>rr(r/rr2r"rrZchoprrrrs
zTextDoc.docother)rh)Nr)NN)NN)NNN)NNN)NNN)NNNNN)r%r&r[rUrdrcrrgrjrrrrrYrr>rrrrrrrre5s 


e


1

rec@seZdZdZddZdS)
_PlainTextDocz2Subclass of TextDoc which overrides string stylingcCs|S)Nr)r>r.rrrrgsz_PlainTextDoc.boldN)r%r&r[rUrgrrrrrusrucCstat|dS)zCThe first time this is called, determine what kind of pager to use.N)getpagerpager)r.rrrrwsrwc	sXttjdstSttjds tStjr4tjs8tStjdpNtjdrtj	dkrjfddStjddkrfd	dSfd
dStjddkrtStj	dkrddSttdrt
d
dkrddSttdrt
ddkrddSddl}|\}}t
|z0ttdr@t
d|dkr@ddStSWdt|XdS)z2Decide what method to use for paging through text.isattyZMANPAGERZPAGERZwin32cstt|S)N)
tempfilepagerplain)r.)	use_pagerrrrprqzgetpager.<locals>.<lambda>ZTERM)ZdumbZemacscstt|S)N)	pipepagerrz)r.)r{rrrprqcs
t|S)N)r|)r.)r{rrrprqcSstt|dS)Nzmore <)ryrz)r.rrrrprqsystemz(pager) 2>/dev/nullrcSs
t|dS)Nrw)r|)r.rrrrprqz(less) 2>/dev/nullcSs
t|dS)NZless)r|)r.rrrrprqNz	more "%s"cSs
t|dS)NZmore)r|)r.rrrrprq)rarstdin
plainpagerstdoutrxr	rrmplatformr}tempfileZmkstempclosettypagerunlink)rfdrr)r{rrvs:


 rvcCstdd|S)z%Remove boldface formatting from text.z.r)rr)r.rrrrzsrzc	Csddl}|j|d|jd}yDtj|jdd*}y||Wntk
rPYnXWdQRXWntk
rrYnXx(y|	PWqvtk
rYqvXqvWdS)z3Page through text by feeding it to another program.rNT)shellr~backslashreplace)errors)

subprocessPopenPIPEio
TextIOWrapperr~writeKeyboardInterruptrwait)r.cmdrprocpiperrrr|s r|c	Cs`ddl}|}t|ddd}||WdQRXzt|d|dWdt|XdS)z<Page through text by invoking a program on a temporary file.rNwr)rz "r)rZmktemprrr	r}r)r.rrrrrrrrysrycCs$ttjddpd}||d|S)Nencodingzutf-8r)r<rrencodedecode)r.rrrr_escape_stdoutsrc
Cstt|d}y2ddl}tj}||}||dd}Wn(t	t
tjfk
rld}dd}YnXz2yt
tjdd}Wntk
rd}YnX|dkrd	}|d}}tjd|d|dx||drtjd
tj|}	|	dkrtjdPn,|	d
krJtjd||d|d}q|	dkrn|||}|dkrnd}tjdd||||d||}qWWd|r|||j|XdS)z%Page through text on a text terminal.rrNcSstjdS)Nr)rr~rrrrrrprqzttypager.<locals>.<lambda>cSstjddddS)Nr}r)rr~rrrrrrp
rqZLINESrz
-- more --)qQz
          
)
r)bB)rzrrttyrr~filenoZ	tcgetattrZ	setcbreakrrrUnsupportedOperationrr	rrmrPrrr!flushZ	tcsetattrZ	TCSAFLUSH)
r.r#rroldZgetcharhrZincr rrrrsL








&rcCstjtt|dS)z>Simply print unformatted text.  This is the ultimate fallback.N)rrrrzr)r.rrrr+srcCst|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 rPzpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%szclass z	function zmethod )rr*r%rrrar8r__objclass__r&rr+r6r7r)thingrrrdescribe/s.
















rc	Csdd|dD}d\}}xB|t|kr^td|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)rirrrrrLszlocate.<locals>.<listcomp>r)NrNr)rr rr!rMr<r)rrr1rnZ
nextmodulerrrrrlocateJs 
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%)rr)rrr<)rrrr(rrrresolvecs


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|st|t
st|}|d7}||d|||S)zBRender text documentation, given an object or a path to an object.Nrz in z in module z objectz

)r.rrrr+rfindr%r*r+r,rrrrrr)rrrZrendererrr(rqrrrr
render_docqs$






rc
Csfy2|dkrtt|||n|t|||tWn.ttfk
r`}zt|Wdd}~XYnXdS)zCDisplay text documentation, given an object or a path to an object.N)rwrr	plaintextrrprint)rrroutputrHrrrr"sr"c
Csy`t||\}}tt|t||}t|dddd}||WdQRXtd|dWn.tt	fk
r}zt|Wdd}~XYnXdS)z<Write HTML documentation to a file in the current directory.z.htmlrzutf-8)rNZwrote)
rhtmlrrrrrrrr)rrrr(rrrHrrrwritedocsrrcCs6|dkri}x$t|g|D]\}}}t|qWdS)zAWrite out HTML documentation for all modules in a directory tree.N)r,
walk_packagesr)rpkgpathZdoner6r'r7rrr	writedocss
rcJ@s*eZdZddddddddddd	d
ddd
ddddddddddddddddddddd#Zd d!d"DZded'd(d)d*d+d,d-Zd.d/d0d1d2d3d4d5d6d7d8d9d9d:d:d;ZxJeD]>\ZZ	x4e	D],Z
ee
eZeekred<eZeee
<qWqWd=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdLdMdNdOdPdQddRdSdSdTdUdVdWdXdYdZd[d\d]d^d_d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{ddd|d}d~ddIZdddZ
eddZeddZddZeZefddZddZddZddZddZdddZddZddZddZdddZdddZddZdddZ dS)HelperrBOOLEANwith)assertr)asyncr)awaitr)breakz	while for)classzCLASSES SPECIALMETHODS)continuez	while for)Zfunctionr)delBASICMETHODSif)elsez	while fortry)forzbreak continue whileimport)globalznonlocal NAMESPACES)r
TRUTHVALUE)rMODULES)inSEQUENCEMETHODS
COMPARISON)lambdarm)nonlocalzglobal NAMESPACES)passr)raise
EXCEPTIONS)returnrm)rr)whilezbreak continue if TRUTHVALUE)rz CONTEXTMANAGERS EXCEPTIONS yield)yieldr)#FalseNoneTrueandasrrrrrrdefrelifrexceptfinallyrfromrrrrisrrnotorrrrrrrrcCsg|]}dD]}||qqS))'rr)riprrrrrszHelper.<listcomp>)rfrur'''r""")+rH*z**rz//%z<<z>>r|^~rrz<=z>=z==z!=z<>)rrz<=z>=z==z!=z<>)rHr)z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//=)z<<z>>rrrr)jJ)STRINGS	OPERATORSrUNARYAUGMENTEDASSIGNMENTBITWISECOMPLEXzOPERATORS FORMATTINGPOWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTSELLIPSISzSLICINGS DICTIONARYLITERALSz	def classrPRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ
BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)rz**,rz...:@r~r]r\`r
r[]r)typeszRSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect)stringsz4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES)zstring-methodszSTRINGS FORMATTING)Z
formatstringsr)rz: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)rz!class SPECIALMETHODS PRIVATENAMES)Ztypesmodulesr)zoperator-summaryzlambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIESEXPRESSIONS)Zobjectsr)ZspecialnameszbBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES)Z
customizationzhash repr str SPECIALMETHODS)zattribute-accesszATTRIBUTES SPECIALMETHODS)zcallable-typeszCALLS SPECIALMETHODS)zsequence-typesz(SEQUENCES SEQUENCEMETHODS SPECIALMETHODS)zsequence-typeszMAPPINGS SPECIALMETHODS)z
numeric-typesz*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS)Z	execmodelz%NAMESPACES DYNAMICFEATURES EXCEPTIONS)Znamingz3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES)zdynamic-featuresr
NAMESPACES)rztry except finally raise)Zconversionsr)Zidentifierszkeywords SPECIALIDENTIFIERS)z
id-classesr)zatom-identifiersr)z
atom-literalsz=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS	SEQUENCES)Z	exprlistszTUPLES LITERALS)ztypesseq-mutableLISTLITERALS)ZlistszLISTS LITERALS)ZtypesmappingDICTIONARYLITERALS)rzDICTIONARIES LITERALS)zattribute-referencesz(getattr hasattr setattr ATTRIBUTEMETHODS)Z
subscriptionsr)Zslicingsr)Zcallsr)Zpowerr)Zunaryr)Zbinaryr)Zshiftingr)Zbitwiser)ZcomparisonszEXPRESSIONS BASICMETHODS)ZbooleanszEXPRESSIONS TRUTHVALUEr)Z
assignmentr)Z	augassign
NUMBERMETHODSrr)Zcompoundzfor while break continue)truthz if while and or not BASICMETHODS)ZdebuggerZpdb)zcontext-managersr)IrrZ
STRINGMETHODSZ
FORMATTINGUNICODEZNUMBERSZINTEGERZFLOATrrZMAPPINGSrmZMETHODSZCODEOBJECTSZTYPEOBJECTSZFRAMEOBJECTSZ
TRACEBACKSZNONErZSPECIALATTRIBUTESrlrZPACKAGESrrZ
PRECEDENCEZOBJECTSZSPECIALMETHODSrZATTRIBUTEMETHODSZCALLABLEMETHODSrZMAPPINGMETHODSr
Z	EXECUTIONrZDYNAMICFEATURESZSCOPINGZFRAMESrZCONVERSIONSZIDENTIFIERSZSPECIALIDENTIFIERSrZLITERALSZTUPLESZ
TUPLELITERALSZLISTSrrr	Z
ATTRIBUTESZ
SUBSCRIPTSrZCALLSrrZBINARYZSHIFTINGrrrZ	ASSERTIONZ
ASSIGNMENTrZDELETIONZ	RETURNINGZ	IMPORTINGZCONDITIONALZLOOPINGrZ	DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dS)N)_input_output)r>inputrrrrrwVszHelper.__init__cCs|jp
tjS)N)r
rr~)r>rrrrZszHelper.inputcCs|jp
tjS)N)rrr)r>rrrr^sz
Helper.outputcCs2tdddkr|dSd|jj|jjfS)Nrr0?rz<%s.%s instance>)rstackrr&r[)r>rrr__repr__bs
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.
)_GoInteractiverintrointeractrr)r>requestrrr__call__js
zHelper.__call__c	Cs|jdxy|d}|s PWnttfk
r<PYnX|}t|dkr|d|dkrndkrnn |d|ddkr|dd}|dkrP|d	kr|q|	|qWdS)
Nrzhelp> rrr})rrr)rquitr)
rrgetlinerEOFErrorrr rrr)r>rrrrrws"
,
zHelper.interactcCs8|jtjkrt|S|j||j|jSdS)z.Read one line, using input() when appropriate.N)rrr~rrrr)r>Zpromptrrrrs

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)rrrzHelp on %s:)rr)rrlistkeywordslistsymbols
listtopicslistmodulesrr
showsymbolr"evalr	showtopicrrr)rrrr)r>rrrrrs6






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)rrrrr)r>rrrrszHelper.intror|Pc	
Cstt|}||}t||d|}xt|D]z}xht|D]\}|||}|t|kr@|j||||dkr@|jdd|dt||q@W|jdq2WdS)Nrrr)rsortedr rrr)	r>itemscolumnsrZcolwrrowrrjrrrrs(zHelper.listcCs |jd||jdS)NzN
Here is a list of the Python keywords.  Enter any keyword to get more help.

)rrrrrD)r>rrrrszHelper.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.

)rrrrrD)r>rrrr szHelper.listsymbolscCs |jd||jdS)NzN
Here is a list of available topics.  Enter any topic name to get more help.

)rrrrrD)r>rrrr!szHelper.listtopicscCs,yddl}Wn tk
r,|jddSX|j||j|}|s`|jdt|dSt|tdkr||	||S|\}}y|jj|}Wn(t
k
r|jdt|dSX|d}|r|pdd|}|r ddl}dd
|d}	||	d	}
|d
d
|
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.topicsrrrrrmrrrr%KeyErrorrtextwrapr!rZwraprw)r>topic
more_xrefs
pydoc_datatargetlabelxrefsr"r.r.Zwrapped_textrrrr%s6zHelper.showtopiccCsyddl}Wntk
r dSX|j||j|}|sDtdt|trZ|||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.
        rN)zt
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
rzcould not find topicrr)	r,rrrmrrPrr)	_gettopic)r>r/r0r1r2r3r4r"rrrr5s	
zHelper._gettopiccCs*|j|}|d\}}}|||dS)Nr)r	partitionr%)r>symbolr2r/r]r4rrrr#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)Niz	.__init__z
 (package)rrr)find)rr'rqrrrrcallback,sz$Helper.listmodules.<locals>.callbackcsd|ddS)Nr)r')r9rronerror1sz#Helper.listmodules.<locals>.onerror)r:z
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
ModuleScannerrunrrD)r>rGrr:r)r9rr"s
zHelper.listmodules)rrrr)NN)r|r&)r)r)r)!r%r&r[rZ_strprefixesZ_symbols_inverserr(r/Zsymbols_r7rmrrwrrrrrrrrrrrrrr r!r%r5r#r"rrrrrs6


	


 
rc@seZdZdZdddZdS)r<z7An interruptible scanner that searches module synopses.Nc	Cs
|r|}d|_i}xztjD]p}|dkrd||<|dkrH|d|dqt|jpTd}|dd}|d|}||dkr|d||qWxdtj	|dD]R\}	}}
|jrP|dkr|d|dqyt
|	|}Wntk
rwYnX|j}t
|d	rny||}
Wn&tk
r:|r4||wYnXtt|
pNd}t
|d
rh||}nd}n^ytj|}Wn&tk
r|r||wYnX|jr|jdnd}t|dd}|d|}||dkr||||qW|r|dS)NF__main__rrrrz - )r:
get_sourceget_filenamerO)rrrrrrUrr8r,r	_get_specrrrar?r=rrStringIOr@rrrrrr<)r>r9rGZ	completerr:seenr'r(rqr6r7rrsourcerrrrrr=?s`zModuleScanner.run)NNN)r%r&r[rUr=rrrrr<<sr<c	CsDdd}dd}t"tdtj|||dWdQRXdS)zAPrint all the one-line module summaries that contain a substring.cSs6|dddkr |ddd}t||o.d|dS)Niz	.__init__z
 (package)z- )r)rr'rqrrrr9{szapropos.<locals>.callbackcSsdS)Nr)r'rrrr:szapropos.<locals>.onerrorignore)r:N)warningscatch_warningsfilterwarningsr<r=)rGr9r:rrrr;ys


r;csddlddlddlddlGdddjjGfdddjjGfdddj}||||}|x|j	s|j
std	qW|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.cssztext/cssz	text/htmlzContent-Typez%s; charset=UTF-8zutf-8N)	rr`Z
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[rLrMrrrr
DocHandlersrNcs(eZdZddZfddZddZdS)z _start_server.<locals>.DocServercSs6||_|j|f|_||_|j||j|jd|_dS)NF)hostZaddressr9rIrwhandlerr)r>rOportr9rrrrws
z)_start_server.<locals>.DocServer.__init__csBx4|js4|jgggd\}}}|r|qW|dS)Nr)rselectZsocketrZhandle_requestZserver_close)r>ZrdZwrZex)rRrrserve_until_quits
z1_start_server.<locals>.DocServer.serve_until_quitcSs |j||jr||dS)N)rIserver_activater9)r>rrrrTsz0_start_server.<locals>.DocServer.server_activateN)r%r&r[rwrSrTr)rRrr	DocServersrUcs:eZdZfddZfddZddZddZd	S)
z#_start_server.<locals>.ServerThreadcs2||_||_t||_j|d|_d|_dS)NF)rJrOrrQThreadrwservingerror)r>rJrOrQ)	threadingrrrws
z,_start_server.<locals>.ServerThread.__init__c
sxyJjj__jj_t|j_|j	|j
|j}||_|
Wn(tk
rr}z
||_Wdd}~XYnXdS)zStart the server.N)server
HTTPServerrIrPrZMessageZMessageClassstaticmethodrJrOrQready	docserverrSr=rX)r>Zdocsvre)rNrUemailhttprrr=s

z'_start_server.<locals>.ServerThread.runcSs,d|_|j|_|j|_d|j|jf|_dS)NTz
http://%s:%d/)rWrOZserver_portrQr	)r>rZrrrr]	sz)_start_server.<locals>.ServerThread.readycSs&d|j_|d|_d|_d|_dS)z&Stop the server and this thread nicelyTNF)r^rr!rWr	)r>rrrstop	s
z(_start_server.<locals>.ServerThread.stopN)r%r&r[rwr=r]rbr)rNrUr`rarYrrServerThreads
rcg{Gz?)
Zhttp.serverZ
email.messagerRrYrZZBaseHTTPRequestHandlerr[rVrrXrWtimeZsleep)rJhostnamerQrcZthreadr)rNrUr`rarRrYr
_start_servers8'rf	text/htmlc	s*Gfdddt}|fddfddfddfd	d
fdd	fd
dfddfddfdd	f	dd}|dr|dd}|dkrtjtjt}tj||}t|}d|	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_navbarrrr*	sz#_url_handler.<locals>._HTMLDoc.pagecSsd||fS)Nz<a href="getfile?key=%s">%s</a>r)r>r	rrrrr7	sz'_url_handler.<locals>._HTMLDoc.filelinkN)r%r&r[rrr)rirr_HTMLDoc(	s
rjcs>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)r3)rrrri=	s
z!_url_handler.<locals>.html_navbarcsdd}ddd}ddtjD}||}|dd	dd
|g}i}x tjD]}|||qVW|ddd
|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)r>r)rir(rrrra	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)	rrrrrrr
rbr!)rkrnamesrrCr)rrr
html_indexX	sz _url_handler.<locals>.html_indexc		sgfdd}t*tddd}tj|||dWdQRXdd	}g}d
dd}x"D]\}}||||qhW|d
|ddd|}d|fS)zSearch results page.cs:|dddkr |ddd}||o0d|fdS)Niz	.__init__z
 (package)z- )r
)rr'rq)
search_resultrrr9v	sz3_url_handler.<locals>.html_search.<locals>.callbackrEcSsdS)Nr)r'rrrr:}	sz2_url_handler.<locals>.html_search.<locals>.onerror)r:NcSsd||fS)Nz<a href="%s.html">%s</a>r)r(rrrrk	sz4_url_handler.<locals>.html_search.<locals>.bltinlinkz5<big><big><strong>Search Results</strong></big></big>z#ffffffz#7799eezkey = %sz#ee77aaz<br>zSearch Results)	rFrGrHr<r=rr
rr!)	rGr9r:rkrfrr(rqr)r)rnrhtml_searchq	s 

z!_url_handler.<locals>.html_searchc	sjtj|}t|}|}WdQRXd|}ddd}|d|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)	r'r(Zunquoterrrrrr)rfpr#Zbodyrr)rrrhtml_getfile	sz"_url_handler.<locals>.html_getfilecsLdd}ddd}ttj}||}|ddd|}d|fS)zIndex of topic texts available.cSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrrk	sz4_url_handler.<locals>.html_topics.<locals>.bltinlinkz,<big><big><strong>INDEX</strong></big></big>z#ffffffz#7799eeZTopicsz#ee77aa)rr'rrrDrr)rkrrlr)rrrhtml_topics	sz!_url_handler.<locals>.html_topicscsLddd}ttj}dd}||}|ddd|}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(rrrrk	sz6_url_handler.<locals>.html_keywords.<locals>.bltinlinkZKeywordsz#ee77aa)rr'rrrDrr)rrlrkr)rrr
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.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(rrrrk	sz7_url_handler.<locals>.html_topicpage.<locals>.bltinlinkzRelated help topics: z%s %sr)
rrBrr5rrrrr'rrrr!)r/ZbufZhtmlhelprr4rrrk)rrrhtml_topicpage	s&



z$_url_handler.<locals>.html_topicpagecs@t|dd}|dkr$|dkr$tdt|}||}||fS)Nr)rrzcould not find object)rrPrr)r	r9rcontent)rrrhtml_getobj	sz!_url_handler.<locals>.html_getobjcsPddd}dfddtt||D}||dd|}d||fS)	Nz,<big><big><strong>Error</strong></big></big>z#ffffffz#7799eez<br>c3s|]}|VqdS)N)r)rir)rrrr`	sz3_url_handler.<locals>.html_error.<locals>.<genexpr>z#bb0000z
Error - %s)rr!rrr)r	rrr)rrr
html_error	sz _url_handler.<locals>.html_errorc
s|}|dr|dd}y0|dkr4\}}n|dkrJ\}}n|dkr^\}}nd|kr>|d\}}}|dkr|\}}n|d	kr|\}}n|d
kry|\}}Wn tk
r|\}}YnXn\|dkr4|dkr\}}n4y|\}}Wn"tk
r0|\}}YnXntdn|\}}Wn2tk
r~}z||\}}Wdd}~XYnX||S)
zGenerate an HTML page for url.z.htmlN)rrbrrrXz
search?keyzgetfile?keyz	topic?keyzget?keyz
bad pydoc url)r`r6rPr=r)r	Zcomplete_urlrruopr]r)	rrwrqrvrmrsrortrrrr
get_html_page	sB



 z#_url_handler.<locals>.get_html_pagerrNztext/cssrz	text/htmlz"unknown content type %r for url %s)rr_r	rdirnamerealpathrOr!r	readlinesrs)r	rKrjrzZ	path_hererhrpr)
rrwrqrvrmrsrirortrrr_url_handler	s,	

*



r~T	localhost)open_browserrec	Csddl}tt||}|jr(t|jdS|jrd}|rB||jzy^td|jt|xD|jrtd}|	}|dkr~Pq\|dkr||jq\t|q\WWnt
tfk
rtYnXWd|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 ready atzserver> rrzServer stopped)
webbrowserrfr~rXrrWrr	rrrrrb)rQrrerZserverthreadZserver_help_msgrrrrbrowse
s2
rcCst|to|tjdkS)Nr)rr)r8r	sep)rLrrrispathC
srcCsvd|kstj|kst|kr"dStjt}tj|}|}||krbtj||sb|||	dt|S)zEnsures current directory is on returned path, and argv0 directory is not

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

    Returns a new path entry list, or None if no adjustment is needed.
    rNr)
r	curdirgetcwdrr{rOcopysamefileremoveinsert)Z
given_pathZargv0Z
stdlib_dirZ
script_dirrevised_pathrrr_get_revised_pathF
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_pathb
srcCsddl}Gdddt}typ|tjddd\}}d}d}d}d}d}x`|D]X\}	}
|	d	krnd
}d
}|	dkrt|
dS|	dkrd
}|
}|	d
krd
}|	dkrVd
}|
}qVW|rt|||ddS|s|x|D]}t|rtj	
|std|Py`t|rtj	|rt
|}|rPt|rFtj	|rFt|nt|n
t|Wqtk
r}zt|Wdd}~XYqXqWWnN|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&r[rrrrBadUsageo
srrzbk:n:p:wFrz-bTz-kz-pz-wz-n)rerzfile %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)getoptr=rrrr;rrr	rexistsrrxrrrrrrrXrrrr)rrZoptsrZwritingZstart_serverrrQreZoptvalargrHrrrrclil
s`


"rr>)NN)r)r)rrN)rrN)r)rN)rg)r)ZrUr&rSrVrXrMZimportlib._bootstraprimportlib._bootstrap_externalimportlib.machineryimportlib.utilrrr	r,rrrrdrZurllib.parser'rFcollectionsrreprlibr	tracebackrrrr$r)r-r/r3r
IGNORECASEr4r5r:r?rCrMrcrdrvrzrrr=rrrrrrrdrerurwrvrzr|ryrrrrrr.rrrrr"rrrrr<r;rfr~rrrrrr%rrrr<module>+s		


	'
0?*; p$,






=
%
U