Your IP : 216.73.217.7
3
fd��@s�dgZdZdZdZddlZddlZddlZddlZddl Zddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlmZd d
�Zdd�Zd
d�Zdd�Zdd�Z dd�Z!dd�Z"ej#dej$�Z%dd�Z&dd�Z'dd�Z(dd�Z)d d!�Z*dtd"d#�Z+d$d%�Z,d&d'�Z-d(d)�Z.d*d+�Z/ifd,d-�Z0Gd.d/�d/e1�Z2d0d1�Z3difd2d3�Z4Gd4d5�d5�Z5Gd6d7�d7e�Z6Gd8d9�d9e5�Z7Gd:d;�d;e�Z8Gd<d=�d=e5�Z9Gd>d?�d?e9�Z:d@dA�a;dBdC�Z<dDdE�Z=dFdG�Z>dHdI�Z?dJdK�Z@dLdM�ZAdNdO�ZBdPdQ�ZCdudRdS�ZDe9�ZEe:�ZFe7�ZGdvdTdU�ZHdwdWdX�ZIdxdYdZ�ZJdyd[d\�ZKdzd^d_�ZLGd`da�da�ZMeM�ZNGdbdc�dc�ZOddde�ZPdfdg�ZQd{didj�ZRd|dkdl�dmdn�ZSdodp�ZTdqdr�ZUeVdsk�r�eU�dS)}�helpzKa-Ping Yee <ping@lfw.org>z26 February 2001z�Guido 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)N�.)�sys�path�os�abspath�normcase�isdir�append)�dirsZnormdirs�dirZnormdir�r�*/opt/alt/python36/lib64/python3.6/pydoc.py�pathdirsMs
rcCs.tj|�ptj|�}|r*tjdd|j��p,dS)Nz^ *
�)�inspect�getdocZgetcomments�re�sub�rstrip)�object�resultrrrrYsrcCsh|j�jd�}t|�dkr&|ddfSt|�dkrZ|dj�rZ|ddj|dd��fSddj|�fS)N�
�rr�)�strip�split�lenr�join)�doc�linesrrr�splitdoc^sr$cCs"|j}|j|kr|jd|}|S)Nr)�__name__�
__module__)r�modname�namerrr� classnamegs
r)cCs>tj|�p:tj|�p:tj|�p:tj|�p:tj|�p:tj|�S)N)r�ismodule�isclass� isroutineZisframeZistracebackZiscode)rrrr�isdatansr-cGs2x,|r,|dj|j|d��}|dd�}qW|S)Nrrr)r!r)�textZpairsrrr�replacetsr/cCsXt|�|krTtd|dd�}td|d|�}|d|�d|t|�|d�S|S)Nr�rz...)r �max)r.�maxlenZpreZpostrrr�cram{s
$r3z at 0x[0-9a-f]{6,16}(>+)$cCstjd|�S)Nz\1)�_re_stripidr)r.rrr�stripid�sr5cCs(tj|�p&tj|�p&tj|�p&tj|�S)N)r�
isfunction�ismethod� isbuiltinZismethoddescriptor)�objrrr�_is_some_method�s
r:cCs<tj|�rdStj|�r8t|dd�}tj|�p4|dkSdS)NT�__self__F)rr7r8�getattrr*)�fn�selfrrr�_is_bound_method�s
r?cCshi}x tj|t�D]\}}d||<qWx|jD]}|jt|��q.Wx|j�D]}t||�||<qNW|S)Nr)r�
getmembersr:� __bases__�update�
allmethods�keysr<)�cl�methods�key�value�baserrrrC�srCcCs<g}g}x*|D]"}||�r&|j|�q|j|�qW||fS)N)r
)�s� predicate�yes�no�xrrr�_split_list�s
rOcCs\|dkrdS|jd�r$|jd�r$dS|jd�r<t|d�r<dS|dk rL||kS|jd�SdS)N�
__author__�__builtins__�
__cached__�__credits__�__date__�__doc__�__file__�__spec__�
__loader__r&r%�__package__�__path__�__qualname__� __slots__�__version__r�__r�_�_fieldsT>rVr%rZrQrWrRrYrUr&rTr]rXr[r\rSrP)�
startswith�endswith�hasattr)r(�allr9rrr�visiblename�srecCsDg}x:tj|�D],\}}}}tj|�r*d}|j||||f�qW|S)Nzdata descriptor)r�classify_class_attrs�isdatadescriptorr
)r�resultsr(�kind�clsrHrrrrf�s
rfcs\t|dg��y�fdd�t��D��Wntk
r>i�YnX�fdd�}|j|d�dS)Nr`csi|]\}}|t��|�qSr)r )�.0�ir()�fieldsrr�
<dictcomp>�sz#sort_attributes.<locals>.<dictcomp>cs�j|dd�|dfS)Nr)�get)�attr)�field_orderrr�<lambda>�sz!sort_attributes.<locals>.<lambda>)rG)r<� enumerate� TypeError�sort)�attrsrZkeyfuncr)rqrmr�sort_attributes�s
rwcCs<tjj|�r8x*dD]"}tjjtjj|d|��rdSqWdS)N�.py�.pyc�__init__TF)rxry)r rr�isfiler!)r�extrrr� ispackage�s
r}cCs�|j�}x,|dd�dks$|j�r4|j�}|s
Pq
W|j�}|dd�dkrZ|dd�}|dd�dkr�|dd�}|d d�dkr�|dd
�}x|j�s�|j�}|s�Pq�W|jd�dj�}nd}|S)Nr�#�zr"""r0z"""�\r���r�)�readlinerr)�file�linerrrr�source_synopsis�s&
r�c
Cstj|�j}|j|d�\}}|dks.||k�r|jttjj��rJtjj }n |jttjj
��rftjj}nd}|dkr�ytj
|�}Wntk
r�dSX|�t|�}WdQRXnZ|d|�}tjjd||d�}ytjj|�} Wn
dStjd=| j�r| jj�dnd}||f||<|S)NZ__temp__)�loaderr)NN)r �stat�st_mtimerorb�tuple� importlib� machinery�BYTECODE_SUFFIXES�SourcelessFileLoader�EXTENSION_SUFFIXES�ExtensionFileLoader�tokenize�open�OSErrorr��util�spec_from_file_location�
_bootstrap�_loadr�modulesrU�
splitlines)
�filename�cache�mtimeZ
lastupdaterZ
loader_clsr�r��spec�modulerrr�synopsis�s4
r�c@seZdZdd�Zdd�ZdS)�ErrorDuringImportcCs||_|\|_|_|_dS)N)r��excrH�tb)r>r��exc_inforrrrz$szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)r�r%r�rH)r>r�rrr�__str__(szErrorDuringImport.__str__N)r%r&r[rzr�rrrrr�"sr�c Cs�tjj}t|d��}||jt|��k}WdQRXtjj|�}tjj |�\}}|r`tj
j||�}ntj
j||�}tjj
|||d�}ytjj|�St|tj���YnXdS)N�rb)r�)r�r��MAGIC_NUMBERr��readr r r�basename�splitext�_bootstrap_externalr��SourceFileLoaderr�r�r�r�rr�) r�magicr�Zis_bytecoder�r(r|r�r�rrr�
importfile,sr�cs"yb|rX�tjkrX�tjkrX�fdd�tjD�}x(�g|D]}tj|||<tj|=q:Wt��}Wnxtj�\}}}} �tjkr�ttj�j| ��n<|tkr�t|j| ��n&t |t
�r�|j�kr�dSt�tj���YnXx@�jd�dd�D]*}
yt
||
�}Wq�tk
�rdSXq�W|S)Ncsg|]}|j�d�r|�qS)r)ra)rk�m)rrr�
<listcomp>Rszsafeimport.<locals>.<listcomp>rr)rr��builtin_module_names�
__import__r�r�rV�SyntaxErrorr��
issubclass�ImportErrorr(rr<�AttributeError)r� forceloadr�ZsubsrGr�r�rHr��info�partr)rr�
safeimport>s.
r�c@s|eZdZejjddejdd��Zd
dd�Z ddd�Z
e
ZZZ
ZZZejjejd d
ejdd��fdd�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
r�YnXt|t�r�|j
|�S|j|�S)N)r�isgetsetdescriptor�docdata�ismemberdescriptorr*� docmoduler+�docclassr,�
docroutiner��
isinstance�property�docproperty�docother)r>rr(�argsrrr�documentts"
zDoc.documentcGs*d|odt|�t|�jf}t|��dS)Nz.don't know how to document object%s of type %s� )�repr�typer%rt)r>rr(r��messagerrr�fail�szDoc.fail�libzpython%d.%dcCs�ytj|�}Wntk
r&d}YnXtjjd|j�}tjj|�}t |t
t��r�|jdks||j|�r�|jtjj
|d
��r�|jdkr�|jd�r�d|jd�|jj�f}q�tjj
||jj�d�}nd}|S)Nz
(built-in)r��errno�
exceptions�gc�imp�marshal�posix�signalr�_thread� zipimportz
site-packages� xml.etree�test.pydoc_mod�http://�https://z%s/%s�/z.html)
r�r�r�r�r�r�r�rr�r�)r�r�)r�r�)r�
getabsfilertr �environror�rrr�r�r%rar!r�lower)r>rZbasedirr��doclocrrr� getdocloc�s$
z
Doc.getdocloc)N)N)r%r&r[r r�ror�version_infor�r�r�r�r�r�r�r�r�rr!�base_exec_prefixr�rrrrr�ns
r�c@sDeZdZdd�Zdd�Zdd�Zdd�Zd d
�ZeZdd�Z eZ
d
S)�HTMLReprcCs,tj|�d|_|_d|_d|_|_dS)N��
�d)rrz�maxlist�maxtuple�maxdict� maxstring�maxother)r>rrrrz�s
zHTMLRepr.__init__cCst|dddddd�S)N�&z&�<z<�>z>)r/)r>r.rrr�escape�szHTMLRepr.escapecCstj||�S)N)rr�)r>rrrrr��sz
HTMLRepr.reprcCsZtt|�d�r@ddjt|�jj��}t||�r@t||�||�S|jttt |��|j
��S)Nr%�repr_r_)rcr�r!r%rr<r�r3r5r�r�)r>rN�level�
methodnamerrr�repr1�s
zHTMLRepr.repr1cCs^t||j�}t|�}d|krJdt|dd�krJd|d|j|�|dStjdd|j|��S)Nr�z\\r�rrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z<font color="#c040c0">\1</font>)r3r�r�r/r�rr)r>rNr��test�testreprrrr�repr_string�szHTMLRepr.repr_stringcCs8y|jttt|��|j��S|jd|jj�SdS)Nz
<%s instance>)r�r3r5r�r�� __class__r%)r>rNr�rrr�
repr_instance�szHTMLRepr.repr_instanceN)r%r&r[rzr�r�r�r��repr_strr�Zrepr_unicoderrrrr��sr�c@s
eZdZe�ZejZejZdd�Zd4dd�Zd5d d
�Z dd�Z
d
d�Zd6dd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdiiifdd�Zd7d d!�Zd8d"d#�Zddiifd$d%�Zd&d'�Zddiiidfd(d)�Zd*d+�Zd9d,d-�Zd:d.d/�Zd;d0d1�Zd<d2d3�ZdS)=�HTMLDoccCsd||fS)Nz�<!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>�title�contentsrrr�page�szHTMLDoc.pagercCsd|||||pdfS)Na'
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="%s">
<td valign=bottom> <br>
<font color="%s" face="helvetica, arial"> <br>%s</font></td
><td align=right valign=bottom
><font color="%s" face="helvetica, arial">%s</font></td></tr></table>
z r)r>r��fgcol�bgcol�extrasrrr�heading�s zHTMLDoc.heading�N� c
Cs^|dkrdd|d}d|||f} |r@| d||||f} n| d|||f} | d|S)Nz<tt>z z</tt>z�<p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="%s">
<td colspan=3 valign=bottom> <br>
<font color="%s" face="helvetica, arial">%s</font></td></tr>
zR
<tr bgcolor="%s"><td rowspan=2>%s</td>
<td colspan=2>%s</td></tr>
<tr><td>%s</td>z(
<tr><td bgcolor="%s">%s</td><td>%s</td>z'
<td width="100%%">%s</td></tr></table>r)
r>r�r�r�r��widthZpreludeZ
marginaliaZgaprrrr�section�szHTMLDoc.sectioncGsd|}|j|f|��S)Nz<big><strong>%s</strong></big>)r)r>r�r�rrr�
bigsection
szHTMLDoc.bigsectionc
Cs&|j|j��}t|dddddddd� S)Nz
z
r�z rz<br>
)r��
expandtabsr/)r>r.rrr� preformatszHTMLDoc.preformatrcCs�d}t|�|d|}xht|�D]\}|dd|}x>t|||||�D]$}|t|�krN||||�d}qNW|d}q"Wd|S)Nrrz<td width="%d%%" valign=top>r�z<br>
z</td>z7<table width="100%%" summary="list"><tr>%s</tr></table>)r �range)r>�list�formatZcolsr�rows�colrlrrr�multicolumnszHTMLDoc.multicolumncCsd|S)Nz<font color="#909090">%s</font>r)r>r.rrr�grey!szHTMLDoc.greycGs*x$|D]}||krd|||fSqW|S)Nz<a href="%s">%s</a>r)r>r(Zdicts�dictrrr�namelink#s
zHTMLDoc.namelinkcCsN|jtjj|j�}}t||�rDt||�|krDd|j|t||�fSt||�S)Nz<a href="%s.html#%s">%s</a>)r%rr�ror&rcr<r))r>rr'r(r�rrr� classlink*s
zHTMLDoc.classlinkcCsd|j|jfS)Nz<a href="%s.html">%s</a>)r%)r>rrrr�
modulelink2szHTMLDoc.modulelinkcCsR|\}}}}|r|j|�S|r,d||f}nd|}|rBd|}n|}d||fS)Nz
%s.%s.htmlz%s.htmlz"<strong>%s</strong> (package)z<a href="%s">%s</a>)r)r>Z
modpkginfor(rr}�shadowed�urlr.rrr�
modpkglink6s
zHTMLDoc.modpkglinkcCsd||fS)Nz<a href="file:%s">%s</a>r)r>rrrrr�filelinkEszHTMLDoc.filelinkcCs�|p|j}g}d}tjd�}�xL|j||�} | s2P| j�\}
}|j||||
���| j�\}}
}}}}|
r�||�jdd�}|jd||f�n�|r�dt|�}|jd|||�f�n�|r�dt|�}|jd|||�f�n�|�r$|||d�d k�r|jd
|j ||��n|jd|�n@|||d�d k�rR|j|j ||||��n|j|j ||��|}q W|j|||d���dj
|�S)
NrzD\b((http|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?(\w+))�"z"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>r)r�r�compile�search�spanr
�groupsr/�intrr!)r>r.r��funcs�classesrFrh�here�pattern�match�start�endrd�schemeZrfcZpepZselfdotr(rrrr�markupIs<
zHTMLDoc.markupc
Cs�d}x�|D]�}t|�tf�kr�|\}}|d}||j||�}|r�||fkr�g}x|D]} |j|j| |��qVW|ddj|�d}|d}q
t|�tg�kr
|d|j|||�}q
Wd|S) Nrz"<dt><font face="helvetica, arial">rz, �)z
</font></dt>z
<dd>
%s</dd>
z
<dl>
%s</dl>
)r�rr
r!�
formattree)
r>�treer'�parentr�entry�c�bases�parentsrIrrrr)ts
zHTMLDoc.formattreec#s�|j}y
|j}Wntk
r(d}YnX|jd�}g}x@tt|�d�D],}|jddj|d|d��||f�qJWdj||d-d��} d| }
y&tj |�}t
jj|�}�j
||�}
Wntk
r�d}
YnXg}t|d��r:t|j�}|dd�d.k�r&|d/d�dk�r&|dd0�j�}|jd
�j|��t|d��r\|j�jt|j���|�rt|
dd
j|�}
�j|�}|dk �r�dt�}nd}�j|
ddd|
|�}tj|tj�}gi}}xltj|tj�D]Z\}}|dk �stj|��p�||k�r�t|||��r�|j||f�d|||<||<�q�Wx�|D]�\}}xx|jD]n}|j|j}}tj j!|�}||k�rL|�rLt||��rLt"||�|k�rL||k�rL|d|||<||<�qLW�q<Wgi}}x�tj|tj#�D]p\}}|dk �stj$|��stj|�|k�r�t|||��r�|j||f�d|||<tj%|��r�||||<�q�Wg}x6tj|t&�D]&\}}t|||��rd|j||f��qdW�j't(|��j)||�}|�o�d|}|d|}t|d��r*g}x.t*j+|j,�D]\}}} |j||| df��q�W|j-��j.|�j/�}!|�j0ddd|!�}n.|�rX�j.|�fdd��}!|�j0ddd|!�}|�r�dd �|D�}"�j1tj2|"d�|�g}!x*|D]"\}}|!j�j3|||||���q�W|�j0d!dd"d#j|!��}|�rg}!x*|D]"\}}|!j�j3|||||���q�W|�j0d$dd%d#j|!��}|�rbg}!x$|D]\}}|!j�j3||���q(W|�j0d&dd'd(j|!��}t|d)��r��j't|j4��j)�}!|�j0d*dd|!�}t|d+��rʈj't|j5��j)�}!|�j0d,dd|!�}|S)1Nrrz5<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#aa55cccs�j|d�S)Nr)r)�t)r>rrrr�sz#HTMLDoc.docmodule.<locals>.<lambda>�ModulescSsg|]\}}|�qSrr)rkrGrHrrrr��sz%HTMLDoc.docmodule.<locals>.<listcomp>ZClassesz#ee77aar�Z Functionsz#eeaa77ZDataz#55aa55z<br>
rPZAuthorrSZCreditsr�z$Revision: r�r�)6r%�__all__r�rr r r
r!rr��urllib�parseZquoterrtrc�strr]rr�rTr��localsrr@r*r+� getmodulererAr&rr�ror<r,r8r6r-r'rr�pkgutil�iter_modulesrZrurrrr)�getclasstreer�rPrS)#r>rr(�mod�ignoredrd�partsZlinksrlZ
linkedname�headrrrr��versionr�rr�r ZcdictrGrHrIr'r�rZfdict�datar"�modpkgs�importer�ispkgr�� classlistr)r>rr��s�
&
$
$
zHTMLDoc.docmodulecs�j}|p|}�j}g} | j�G�fdd�d�}
|
��ttj���}t|�dkr��j��d�x"|D]}�d�j|�j ��qfW�d���������fdd�}
����fd d
�}��������fdd�}�fd
d�t
��D�}i�xv|D]n\}}}}d|d|�|<}yt�|�}Wntk
�r:YnXy|�|<Wq�t
k
�r^Yq�Xq�Wx�|�rT|�r||j��n|dd�t|�fdd��\}}�tjk�r�|}�qfn"��k�r�d}nd�j��j �}|d7}t|��|
d||dd��}|
d||dd��}|
d||dd��}|d||dd��}|d||d d��}|}�qfWd!j| �} ||k�rxd"||f}nd#|||f}|�r�g}x"|D]}|j�j|�j ���q�W|d$d%j|�}�jt���j����}|�o�d&|}�j|d'd(| d)|�S)*Ncs eZdZdd�Z�fdd�ZdS)z(HTMLDoc.docclass.<locals>.HorizontalRulecSs
d|_dS)Nr)�needone)r>rrrrzsz1HTMLDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�d�d|_dS)Nz<hr>
r)rG)r>)�pushrr�maybesz.HTMLDoc.docclass.<locals>.HorizontalRule.maybeN)r%r&r[rzrIr)rHrr�HorizontalRulesrJrz&<dl><dt>Method resolution order:</dt>
z<dd>%s</dd>
z</dl>
cs�t||�\}}|r��j��|�xl|D]d\}}}}yt�|�}Wn&tk
rh��j||���YnX��j||��������d�q(W|S)Nr)rOrIr<� Exception�_docdescriptorr�)�msgrvrK�okr(ri�homeclsrH)r r�hr�mdictr=rrHr>rr�spillszHTMLDoc.docclass.<locals>.spillcsNt||�\}}|rJ�j��|�x&|D]\}}}}��j||���q(W|S)N)rOrIrL)rMrvrKrNr(rirOrH)rPr=rHr>rr�spilldescriptors0sz*HTMLDoc.docclass.<locals>.spilldescriptorsc
s�t||�\}}|r��j��|�x�|D]�\}}}}�jt�|�|��}t|�sZtj|�rht|dd�} nd} | dkr��d|�n0�jt|��j ����} d| } �d|| f��d�q(W|S)NrUz<dl><dt>%s</dl>
z<dd><tt>%s</tt>z<dl><dt>%s%s</dl>
r)
rOrIr�r<�callablerrgr'rr)
rMrvrKrNr(rirOrHrIr")r rrPrQr=rrHr>rr� spilldata9s"
z#HTMLDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qS))r9)re)rkr(rirjrH)rrrr�Ns
z$HTMLDoc.docclass.<locals>.<listcomp>r~�-rcs|d�kS)Nrr)r2)� thisclassrrrrgsz"HTMLDoc.docclass.<locals>.<lambda>zdefined herezinherited from %sz:<br>
z
Methods %scSs|ddkS)Nr�methodr)r2rrrrrwszClass methods %scSs|ddkS)Nrzclass methodr)r2rrrrryszStatic methods %scSs|ddkS)Nrz
static methodr)r2rrrrr{szData descriptors %scSs|ddkS)Nrzdata descriptorr)r2rrrrr}szData and other attributes %scSs|ddkS)NrrBr)r2rrrrrsrz*<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> </tt>z#000000z#ffc8d8r0)r%rAr
rr�getmror rIrr&rfr<rKrt�popleftrO�builtinsrrwr!r'rrr)r>rr(r=rr r>�realnamer.r�rJ�mrorIrRrSrUrvrGrirOrH�anchor� inherited�tagr�r/r"r) r rrPrQr=rrHr>rWrr�s�
zHTMLDoc.docclasscCs|jd|j|��S)N�=)rr�)r>rrrr�formatvalue�szHTMLDoc.formatvaluecCs�|j}|p|}|r|jpdd|} d}
d}t|�r�|jj}|rZ||k r�d|j||�}
n0|jdk rzd|j|jj|�}
nd|j||�}
||kr�d| |f}
nD|r�tj||g�|kr�d|jd||f}d }n|}d
| ||f}
d}tj|��rNytj|�}Wnt t
fk
�r d}YnX|�rNt|�}|dk�rNd|}
|d d�}|�sXd
}|
|j|�|
�ov|j
d|
�}|�r�d|S|jt|�|j|||�}|�o�d|}d||fSdS)NrrVrz from z 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;r�rr�getattr_staticr,� signature�
ValueErrorrtr7r�rr'rr)r>rr(r=rr rFrEr\r^�note�skipdocs�imclassr�Zreallink�argspecrd�declr"rrrr��sX
zHTMLDoc.docroutinecCsTg}|j}|r|d|�|jdk rB|jt|�|j�}|d|�|d�dj|�S)Nz!<dl><dt><strong>%s</strong></dt>
z<dd><tt>%s</tt></dd>
z</dl>
r)r
rUr'rrr!)r>r(rHr=rhrHr"rrrrL�s
zHTMLDoc._docdescriptorcCs|j|||�S)N)rL)r>rr(r=rErrrr��szHTMLDoc.docpropertycGs|rd|pd}||j|�S)Nz<strong>%s</strong> = r)r�)r>rr(r=r>Zlhsrrrr��szHTMLDoc.docothercCs|j|||�S)N)rL)r>rr(r=rErrrr��szHTMLDoc.docdatacCs�g}|dkri}xLtj|g�D]<\}}}tdd�|D��r<q|j|d|||kf�d||<qW|j�|j||j�}|j|dd|�S)Ncss*|]"}dt|�kodknVqdS)i�i��N)�ord)rk�chrrr� <genexpr>�sz HTMLDoc.index.<locals>.<genexpr>rrz#ffffffz#ee77aa)r:r;�anyr
rurrr)r>rrrCrDr(rEr�rrr�index�sz
HTMLDoc.index)r)rrNr)r)N)NN)NNN)NN)NNN)N)r%r&r[r��_repr_instancer�r�r�rrrrrrrrrrrr'r)r�r�rbr�rLr�r�r�rorrrrr��s:
+
y:
r�c@s0eZdZdd�Zdd�Zdd�ZeZdd�Zd S)
�TextReprcCs,tj|�d|_|_d|_d|_|_dS)Nr�r�r�)rrzr�r�r�r�r�)r>rrrrzs
zTextRepr.__init__cCsTtt|�d�r@ddjt|�jj��}t||�r@t||�||�Sttt|��|j �S)Nr%r�r_)
rcr�r!r%rr<r3r5r�r�)r>rNr�r�rrrr�s
zTextRepr.repr1cCsHt||j�}t|�}d|krDdt|dd�krDd|d||dS|S)Nr�z\\rr�r)r3r�r�r/)r>rNr�r�r�rrrr�s
zTextRepr.repr_stringc
Cs,yttt|��|j�Sd|jjSdS)Nz
<%s instance>)r3r5r�r�r�r%)r>rNr�rrrr�szTextRepr.repr_instanceN)r%r&r[rzr�r�r�r�rrrrrq�s
rqc@s�eZdZe�ZejZdd�Zddd�Zdd�Zdd
d�Z ddd
�Z
ddd�Zdd�Zd dd�Z
dd�Zd!dd�Zd"dd�Zd#dd�ZdS)$�TextDoccCsdjdd�|D��S)Nrcss|]}|d|VqdS)�Nr)rkrlrrrrm)szTextDoc.bold.<locals>.<genexpr>)r!)r>r.rrr�bold'szTextDoc.bold� cs>|sdS�fdd�|jd�D�}|r4|dj�|d<dj|�S)Nrcsg|]}�|�qSrr)rkr�)�prefixrrr�.sz"TextDoc.indent.<locals>.<listcomp>rrr�r�)rrr!)r>r.rvr#r)rvr�indent+szTextDoc.indentcCs$|j|�j�}|j|�d|dS)Nrz
)rwrrt)r>r�r�Zclean_contentsrrrr2szTextDoc.sectionNrc
s�d}x�|D]�}t|�tf�krt|\}}||t|��}|rj||fkrj�fdd�|D�} |ddj| �}|d}q
t|�tg�kr
||j|�||d�}q
W|S)Nrc3s|]}t|��VqdS)N)r))rkr-)r'rrrmAsz%TextDoc.formattree.<locals>.<genexpr>z(%s)z, rz )r�r)r!r))
r>r*r'r+rvrr,r-r.r/r)r'rr)9s
zTextDoc.formattreecCsD|j}tt|��\}}|jd||o(d|�}t|dd�}|j|�}|dk r`||jd|d�}|rt||jd|�}g} xNtj|tj�D]<\}
}|dk s�tj |�p�||kr�t
|
||�r�| j|
|f�q�Wg}xXtj|tj�D]F\}
}|dk �stj
|��stj |�|kr�t
|
||�r�|j|
|f�q�Wg}
x6tj|t�D]&\}
}t
|
||��r8|
j|
|f��q8Wg}t�}t|d��r�xFtj|j�D]6\}}}|j|�|�r�|j|d�n
|j|��q�W|j�||jd d
j|��}g}xBtj|tj�D]0\}
}|jj|d��r�|
|k�r�|j|
��q�W|�rJ|j�||jdd
j|��}| �r�d
d�| D�}|jtj|d�|�g}x&| D]\}
}|j|j||
|���qzW||jdd
j|��}|�r�g}x&|D]\}
}|j|j||
|���q�W||jdd
j|��}|
�rFg}x*|
D]"\}
}|j|j||
|dd���q
W||jdd
j|��}t|d��r�t|j�}|dd�d"k�r�|d#d�dk�r�|dd$�j�}||jd|�}t|d��r�||jdt|j ��}t|d��r�||jdt|j!��}t|d��r||jdt|j"��}ytj#|�}Wnt$k
�r.d }YnX||jd!|�}|S)%N�NAMEz - r4zMODULE 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)rkrGrHrrrr��sz%TextDoc.docmodule.<locals>.<listcomp>r�CLASSES� FUNCTIONS�F)r2ZDATAr]r0r1z
Revision: �VERSIONrTZDATErPZAUTHORrSZCREDITSz
(built-in)�FILEz$Revision: r�r�)%r%r$rrr<r�rr@r+r9rer
r,r8r-�setrcr:r;rZ�addrur!r*rar)r<r�r�r7r]rrTrPrSr�rt)r>rr(r=Zsynop�descrrdr�r rGrHrrBrCZ
modpkgs_namesrDr'rEZ
submodulesrFr�rAr�rrrr�Is�
$
zTextDoc.docmodulecsX�j}|p|}�j}�jfdd�}||kr:d�j|�}n�j|�d|}|rlt||�} |ddj| �}t��}
|
r�|
dgp�g}|j�tt j
���}t|�dkrԈd �x|D]}
�d
||
��q�W�d�G�fdd
�d
�}|�������fdd�}����fdd�}�����fdd�}�fdd�t��D�}x�|�r"|�rT|j
��n|dd�t|�fdd��\}}�tjk�r�|}�q>n ��k�r�d}ndt��j�}t|��|d||dd��}|d||dd��}|d||d d��}|d!||d"d��}|d#||d$d��}|}�q>Wdj|�}|�s<|dS|d�j|j�d%�dS)&NcSs
t||�S)N)r))r-r�rrr�makename�sz"TextDoc.docclass.<locals>.makenamezclass z = class z(%s)z, rrzMethod resolution order:z rcs eZdZdd�Z�fdd�ZdS)z(TextDoc.docclass.<locals>.HorizontalRulecSs
d|_dS)Nr)rG)r>rrrrz�sz1TextDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�dd�d|_dS)NrVr{r)rG)r>)rHrrrI�sz.TextDoc.docclass.<locals>.HorizontalRule.maybeN)r%r&r[rzrIr)rHrrrJ�srJcs�t||�\}}|r��j��|�x^|D]V\}}}}yt�|�}Wn&tk
rh��j||���Yq(X��j||����q(W|S)N)rOrIr<rKrLr�)rMrvrKrNr(rirOrH)rPr=rrHr>rrrR�szTextDoc.docclass.<locals>.spillcsNt||�\}}|rJ�j��|�x&|D]\}}}}��j||���q(W|S)N)rOrIrL)rMrvrKrNr(rirOrH)rPr=rHr>rrrS�sz*TextDoc.docclass.<locals>.spilldescriptorsc
s�t||�\}}|r��j��|�x~|D]v\}}}}t|�sFtj|�rPt|�}nd}yt�|�} Wntk
r�|j|} YnX��j | |�d|d�d�q(W|S)Nr{)r2r"r)
rOrIrTrrgrr<r��__dict__r�)
rMrvrKrNr(rirOrHr"r9)rPr=rrHr>rrrU�s
z#TextDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qS))r9)re)rkr(rirjrH)rrrr�s
z$TextDoc.docclass.<locals>.<listcomp>rcs|d�kS)Nrr)r2)rWrrrr
sz"TextDoc.docclass.<locals>.<lambda>zdefined herezinherited from %szMethods %s:
cSs|ddkS)NrrXr)r2rrrrrszClass methods %s:
cSs|ddkS)Nrzclass methodr)r2rrrrrszStatic methods %s:
cSs|ddkS)Nrz
static methodr)r2rrrrrszData descriptors %s:
cSs|ddkS)Nrzdata descriptorr)r2rrrrrszData and other attributes %s:
cSs|ddkS)NrrBr)r2rrrrr!sz | )r%rAr&rt�mapr!rr
rrrYr rfrZrOr[rr)rwrwr)r>rr(r=r>r\r.r�r�r/r"r�r]rIrJrRrSrUrvr_r`r)rPr=rrHr>rWrr��sl
zTextDoc.docclasscCsd|j|�S)Nra)r�)r>rrrrrb+szTextDoc.formatvaluecCsr|j}|p|}d}d}t|�rn|jj}|rB||k rndt||�}n,|jdk r`dt|jj|�}ndt||�}||kr�|j|�} n,|r�tj||g�|kr�d}|j|�d|} d}
tj|��rytj |�}Wnt
tfk
r�d}YnX|�rt|�}
|dk�r|j|�d } |
dd�}
|
�s&d
}
| |
|}|�r@|dSt
|��pLd}
|d|
�oj|j|
�j�dSdS)
Nrrz from z method of %s instancez unbound %s methodrz = z<lambda>z lambda z(...)rr�)r%r?r;r�r)rtrrcr,rdrertr7rrwr)r>rr(r=rEr\rfrgrhr�rirdrjr"rrrr�/sH
zTextDoc.docroutinecCsTg}|j}|r$||j|��|d�t|�p.d}|rJ||j|��|d�dj|�S)Nrr)r
rtrrwr!)r>r(rHr=rhrHr"rrrrL`szTextDoc._docdescriptorcCs|j|||�S)N)rL)r>rr(r=rErrrr�mszTextDoc.docpropertycCs|j|||�S)N)rL)r>rr(r=rErrrr�qszTextDoc.docdatac
Cs�|j|�}|rF|r|dpd|}|t|�} | dkrF|d| �d}|rX|j|�dpZd|}|dk r~|d|jt|��7}|S)Nz = rrz...r)r�r rtrwr7)
r>rr(r=r+r2r"r�r�Zchoprrrr�us
zTextDoc.docother)ru)Nr)NN)NN)NNN)NNN)NNN)NNNNN)r%r&r[rqrpr�rtrwrr)r�r�rbr�rLr�r�r�rrrrrrs
e
}
1
rrc@seZdZdd�ZdS)�
_PlainTextDoccCs|S)Nr)r>r.rrrrt�sz_PlainTextDoc.boldN)r%r&r[rtrrrrr��sr�cCst�at|�dS)N)�getpager�pager)r.rrrr��sr�cs<ttjd�stSttjd�s tStjj�s8tjj�r<tStjjd�pRtjjd���r�tj dkrn�fdd�Stjjd�dkr��fd
d�S�fdd�Stjjd�dkr�tStj dkr�dd�Sttd
�r�tj
d�dkr�dd�Sddl}|j�\}}tj
|�z0ttd
��r$tj
d|�dk�r$dd�StSWdtj|�XdS)N�isattyZMANPAGERZPAGER�win32cstt|���S)N)�
tempfilepager�plain)r.)� use_pagerrrrr�szgetpager.<locals>.<lambda>ZTERM�dumb�emacscstt|���S)N)� pipepagerr�)r.)r�rrrr�scs
t|��S)N)r�)r.)r�rrrr�scSstt|�d�S)Nzmore <)r�r�)r.rrrrr�s�systemz(less) 2>/dev/nullrcSs
t|d�S)NZless)r�)r.rrrrr�sz more "%s"cSs
t|d�S)NZmore)r�)r.rrrrr�s)r�r�)r�r�)rcr�stdin�
plainpager�stdoutr�r r�ro�platformr��tempfileZmkstemp�close�ttypager�unlink)r��fdr�r)r�rr��s6
r�cCstjdd|�S)Nz.r)rr)r.rrrr��sr�c Cs�ddl}|j|d|jd�}yDtj|jdd��*}y|j|�Wntk
rPYnXWdQRXWntk
rrYnXx(y|j �PWqvtk
r�YqvXqvWdS)NrT)�shellr��backslashreplace)�errors)
�
subprocess�Popen�PIPE�io�
TextIOWrapperr��write�KeyboardInterruptr��wait)r.�cmdr��proc�piperrrr��s r�cCs`ddl}|j�}t|ddd��}|j|�WdQRXztj|d|d�Wdtj|�XdS)Nr�wr�)r�z "r)r�Zmktempr�r�r r�r�)r.r�r�r�r�rrrr��sr�cCs$ttjdd�pd}|j|d�j|�S)N�encodingzutf-8r�)r<rr��encode�decode)r.r�rrr�_escape_stdout�sr�c
Cs�tt|��jd�}y2ddl}tjj�}|j|�}|j|�dd�}Wn(t t
tjfk
rld}dd�}YnX�z2yt
tjjdd��}Wntk
r�d}YnX|dkr�d}|d}}tjjdj|d|��d�x�||d��r�tjjd �tjj�|�} | dk�rtjjd�Pn,| dk�rJtjjd||d�|d}q�| dk�rn|||}|dk�rnd}tjjddj||||��d�||}q�WWd|�r�|j||j|�XdS)NrrcSstjjd�S)Nr)rr�r�rrrrrr�szttypager.<locals>.<lambda>cSstjj�dd�dd�S)Nrr�)rr�r�rrrrrr�sZLINESr�z
-- more --�q�Qz
�
�b�B�)r�r�)r�r)r�r�r�)r�r�r�ttyrr��filenoZ tcgetattrZ setcbreakr�r�r��UnsupportedOperationrr r�rorer�r�r!�flushZ tcsetattrZ TCSAFLUSH)
r.r#r�r��oldZgetchar�hr�Zincr-rrrr��sL
&r�cCstjjtt|���dS)N)rr�r�r�r�)r.rrrr�sr�cCs�tj|�r>|jtjkr d|jSt|d�r4d|jSd|jStj|�rRd|jStj|�rtd|jj |jj|jfStj
|�r�d|jj |jj|jfStj|�r�d|jStj|�r�d |jStj
|�r�d
|jSt|�jS)Nzbuilt-in module rZzpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%szclass z function zmethod )rr*r%rr�rcr8r��__objclass__r&r�r+r6r7r�)�thingrrr�describes.
r�cCs�dd�|jd�D�}d\}}xB|t|�kr^tdj|d|d��|�}|rZ||d}}qPqW|rj|}nt}x8||d�D](}yt||�}Wq|tk
r�dSXq|W|S)NcSsg|]}|r|�qSrr)rkr�rrrr�(szlocate.<locals>.<listcomp>rrr)Nr)rr r�r!r[r<r�)rr�r?r��nZ
nextmodulerr�rrr�locate&s
r�cCsVt|t�r0t||�}|dkr(td|��||fSt|dd�}|t|t�rL|ndfSdS)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%)r�r7r�r�r<)r�r�rr(rrr�resolve?s
r�� Python Library Documentation: %scCs�|dkrt}t||�\}}t|�}tj|�}|rTd|krT|d|d|jd��7}n|rn||k rn|d|j7}tj|�p�tj|�p�tj |�p�tj
|�p�tj|�p�t|t
�s�t|�}|d7}||d|j||�S)Nrz in z in module z objectz
)r.r�r�rr9�rfindr%r*r+r,r�r�r�r�r�r�)r�r�r�Zrendererrr(r�r�rrr�
render_docMs$
r�cCsfy2|dkrtt|||��n|jt|||t��Wn.ttfk
r`}zt|�WYdd}~XnXdS)N)r�r�r�� plaintextr�r��print)r�r�r��outputrHrrrr"fsr"cCs�y`t||�\}}tjt|�tj||��}t|dddd��}|j|�WdQRXtd|d�Wn.tt fk
r�}zt|�WYdd}~XnXdS)Nz.htmlr�zutf-8)r�Zwrote)
r��htmlr�r�r�r�r�r�r�r�)r�r�rr(r�r�rHrrr�writedocqsr�rcCs6|dkri}x$tj|g|�D]\}}}t|�qWdS)N)r:�
walk_packagesr�)r�pkgpath�donerDr'rErrr� writedocs|s
r�cJ@s�eZdZdddddd�d�d�d�d�d�d
d�ddd�dd�d�d�d�dd�d�ddd�d�d��d�d�d�dd&�!Zd'd(��dD�Z�de��d�d�d�d �d
�ddS�ZdTdUdVdWdXdYdZd[d\d]d^d_d_d`d`da�ZxPej�D]D\ZZ x8e D]0Z
eje
e�Zeek�r�edbeZeee
<�q�W�q�W�d�d
�d�d�d�d�d�d�d�ddv�d�d�d�ddd�d�d�d�d�dd�dd�d��d �d!�d"�d#�d$�d%�d&�d'�d(�d)�d*d�d��d+�d,�d-�d.�d/�d0d��d1�d2�d3�d4�d5�d6�d7�d8�d9�d:�d;�d<�d=�d>�d?�d@d�dA�dBdd!dd
�dC�dD�dE�dFdʜIZ�dGd�d̈́Z
ed�dτ�Zed�dτ�Zd�d҄Ze�Zefd�dԄZd�dքZd�dZd�dڄZd�d܄Z�dHd�d�Zd�d�Zd�d�Zd�d�Z�dId�d�Z�dJd�d�Zd�d�Z�dKd�d�Z d�S(L�Helperr�BOOLEAN�with�assert�break� while for�class�CLASSES SPECIALMETHODS�continue�function�del�BASICMETHODS�if�else�try�for�break continue while�import�global�nonlocal NAMESPACES�
TRUTHVALUE�MODULES�in�SEQUENCEMETHODS�
COMPARISON�lambdarz�nonlocal�global NAMESPACES�pass�raise�
EXCEPTIONS�return�while�break continue if TRUTHVALUE� CONTEXTMANAGERS EXCEPTIONS yield�yield)!�False�None�True�and�asr�r�r�r��defr��elifr��except�finallyr��fromr�r�r�r��isr�r��not�orr�r�r�r�r�r�r�cCsg|]}dD]}||�qqS)�'r)r�rr)rk�pr�rrrr��szHelper.<listcomp>r��fr��ur��'''r�"""�+rV�*�**r��//�%�<<�>>r��|�^�~r�r��<=�>=�==�!=�<>�+=�-=�*=�/=�%=�&=�|=�^=�<<=�>>=�**=�//=�j�J)�STRINGS� OPERATORSr��UNARY�AUGMENTEDASSIGNMENT�BITWISE�COMPLEXzOPERATORS FORMATTING�POWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTS�ELLIPSISzSLICINGS DICTIONARYLITERALSz def classr�PRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ
BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)rz**�,rz...�:�@r�r_r^�`rr(�[�]r��types�RSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect�strings�4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES�string-methods�STRINGS FORMATTING�
formatstringsr �:encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPES�numbers�INTEGER FLOAT COMPLEX TYPES�integers� int range�floating�
float math� imaginary�
complex cmath�typesseq�$STRINGMETHODS FORMATTING range LISTS�DICTIONARIES�typesfunctions� def TYPES�typesmethods�class def CLASSES TYPES�bltin-code-objects�compile FUNCTIONS TYPES�bltin-type-objects�types TYPES�TYPES�bltin-null-object�bltin-ellipsis-object�SLICINGS�specialattrs�!class SPECIALMETHODS PRIVATENAMES�typesmodules�operator-summary��lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES�EXPRESSIONS�objects�specialnames�bBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES�
customization�hash repr str SPECIALMETHODS�attribute-access�ATTRIBUTES SPECIALMETHODS�callable-types�CALLS SPECIALMETHODS�sequence-types�(SEQUENCES SEQUENCEMETHODS SPECIALMETHODS�MAPPINGS SPECIALMETHODS�
numeric-types�*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS� execmodel�%NAMESPACES DYNAMICFEATURES EXCEPTIONS�naming�3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES�dynamic-features�
NAMESPACESr��try except finally raise�conversions�identifiers�keywords SPECIALIDENTIFIERS�
id-classes�atom-identifiers�
atom-literals�=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS� SEQUENCES� exprlists�TUPLES LITERALS�typesseq-mutable�LISTLITERALS�lists�LISTS LITERALS�typesmapping�DICTIONARYLITERALSr�DICTIONARIES LITERALS�attribute-references�(getattr hasattr setattr ATTRIBUTEMETHODS�
subscriptions�slicings�calls�power�unary�binary�shifting�bitwise�comparisons�EXPRESSIONS BASICMETHODS�booleans�EXPRESSIONS TRUTHVALUE�
assignmentr"� augassign�
NUMBERMETHODS�compound�for while break continue�truth� if while and or not BASICMETHODS�debugger�pdb�context-managers)IrIrZ
STRINGMETHODSZ
FORMATTING�UNICODEZNUMBERSZINTEGERZFLOATr$roZMAPPINGSrzZMETHODSZCODEOBJECTSZTYPEOBJECTSZFRAMEOBJECTSZ
TRACEBACKSZNONEr&ZSPECIALATTRIBUTESryr�ZPACKAGESrRr Z
PRECEDENCEZOBJECTSZSPECIALMETHODSr�ZATTRIBUTEMETHODSZCALLABLEMETHODSr�ZMAPPINGMETHODSr�Z EXECUTIONrfZDYNAMICFEATURESZSCOPINGZFRAMESr�ZCONVERSIONSZIDENTIFIERSZSPECIALIDENTIFIERSr'ZLITERALSZTUPLESZ
TUPLELITERALSZLISTSrsr@rwZ
ATTRIBUTESZ
SUBSCRIPTSrLZCALLSr%r!ZBINARYZSHIFTINGr#r�r�Z ASSERTIONZ
ASSIGNMENTr"ZDELETIONZ RETURNINGZ IMPORTINGZCONDITIONALZLOOPINGr�Z DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dS)N)�_input�_output)r>�inputr�rrrrz0szHelper.__init__cCs|jp
tjS)N)r�rr�)r>rrrrr4szHelper.<lambda>cCs|jp
tjS)N)r�rr�)r>rrrrr5scCs2tj�dddkr|�dSd|jj|jjfS)Nrr0�?rz<%s.%s instance>)r�stackr�r&r[)r>rrr�__repr__7s
zHelper.__repr__cCs6||jk r|j|�n|j�|j�|jjd�dS)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.
)�_GoInteractiver�intro�interactr�r�)r>�requestrrr�__call__?s
zHelper.__call__cCs�|jjd�x�y|jd�}|s PWnttfk
r<PYnX|j�}t|�dkr�|d|dkoldknr�|d|dd
�kr�|dd�}|j�dkr�P|d
kr�|j�q|j |�qWdS)Nrzhelp> rrrr�rr��quitrr�)r�rr�r�)r�r�)
r�r��getliner��EOFErrorrr r�r�r)r>r�rrrr�Ls"
,
zHelper.interactcCs8|jtjkrt|�S|jj|�|jj�|jj�SdS)N)r�rr�r�r�r�r�)r>�promptrrrr�as
zHelper.getlinecCs<t|�td�k�r|j�}|dkr,|j�n�|dkr>|j�n�|dkrP|j�n�|dkrb|j�n�|dd�dkr�|j|j�d�n�||jkr�|j|�nj|dkr�t t
|�d�nR||jkr�|j|�n<||j
kr�|j|�n&|r�t |d|jd
�nt td|jd
�n$t|t��r|�nt |d|jd
�|jjd�dS)Nr�keywords�symbols�topicsr��zmodules rr�r�r�zHelp on %s:)r�r)r�r�r�)r�r�listkeywords�listsymbols�
listtopics�listmodulesrr��
showsymbolr"�evalr�� showtopicr�r�r7r�r�r�r�)r>r�rrrrjs6
zHelper.helpcCs$|jjdjdtjdd���dS)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)r�r�rrr�)r>rrrr�szHelper.intror�Pc Cs�tt|��}||}t|�|d|}x�t|�D]z}xht|�D]\}|||}|t|�kr@|jj||�||dkr@|jjdd|dt||��q@W|jjd�q2WdS)Nrr�r)r
�sortedr r r�r�) r>�items�columnsrZcolwr�rowr
rlrrrr
�s(zHelper.listcCs |jjd�|j|jj��dS)NzN
Here is a list of the Python keywords. Enter any keyword to get more help.
)r�r�r
r�rD)r>rrrr��szHelper.listkeywordscCs |jjd�|j|jj��dS)Nzx
Here is a list of the punctuation symbols which Python assigns special meaning
to. Enter any symbol to get more help.
)r�r�r
r�rD)r>rrrr��szHelper.listsymbolscCs |jjd�|j|jj��dS)NzN
Here is a list of available topics. Enter any topic name to get more help.
)r�r�r
r�rD)r>rrrr��szHelper.listtopicscCs,yddl}Wn tk
r,|jjd�dSX|jj||jj|��}|s`|jjdt|��dSt|�td�kr||j ||�S|\}}y|jj|}Wn(t
k
r�|jjdt|��dSX|j�d}|r�|p�dd|}|�r ddl}ddj
|j��d} |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
rrr�zRelated help topics: z, �Hz
%s
)�pydoc_data.topicsr�r�r�r�ror�r�r�r��KeyErrorr�textwrapr!r�wrapr�)r>�topic�
more_xrefs�
pydoc_data�target�label�xrefsr"r�r.Zwrapped_textrrrr��s6zHelper.showtopiccCs�yddl}Wntk
r dSX|jj||jj|��}|sDtd��t|t�rZ|j||�S|\}}|jj|}|r�|pxdd|}||fS)Nr�t
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
rzcould not find topicr�)r�r) r�r�r�ror�rer�r7� _gettopic)r>r�r�r�r�r�r�r"rrrr��s
zHelper._gettopiccCs*|j|}|jd�\}}}|j||�dS)Nr�)r�� partitionr�)r>�symbolr�r�r_r�rrrr��s
zHelper.showsymbolcsv|r |jjdj|��t|�nR|jjd�i}|fdd���fdd�}t�j�|d�|j|j��|jjd�dS) 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$|dd�dkr$|dd�d}|jd�dkr:d||<dS) N� z .__init__z
(package)rrri����i����)�find)rr'r�r�rrr�callbacksz$Helper.listmodules.<locals>.callbackcs�d|d�dS)Nr)r')r�rr�onerrorsz#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".
)r�r�r�apropos�
ModuleScanner�runr
rD)r>rGr�r�r)r�rr��s
zHelper.listmodules)r�r)r�r�)r�r�)r�r�)r�r)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�rz)r�r�)r�r)r�r�)r�rz)r�r�)r�r�)r�r�)r�r)r�r�r�r�)r�rrr)rrVrrr�rrrrr�r r
rr�r�rr
rrr)r�r�rr
rrr)rVr)rrrrrrrrrrrr)rrr�r r
r)rr)r.r/)r0r1)r2r3)r4r )r0r5)r6r7)r8r9)r:r;)r<r=)r>r?)rArB)rCrD)rErF)rGrH)rJr)rKrL)rMr)r.rN)rOr�)rPrQ)rSrI)rTrU)rVrW)rXrY)rZr[)r\r])r\r^)r_r`)rarb)rcrd)rer)r�rg)rhr)rirj)rkr)rlr)rmrn)rprq)rrrs)rtru)rvrw)rrx)ryrz)r{r�)r|r�)r}rR)r~rR)rrR)r�rR)r�rR)r�rR)r�r�)r�r�)r�r")r�r�)r�r�)r�r�)r�r�)r�r�)NN)rr�)r)r)r)!r%r&r[r�Z_strprefixesZ_symbols_inverser�r�r�Zsymbols_r�ror�rzr�r�r�r�rr�r�r�r�rr�r
r�r�r�r�r�r�r�rrrrr��s6
r�c@seZdZddd�ZdS)r�NcCs
|r|j�}d|_i}xztjD]p}|dkrd||<|dkrH|d|d�qt|�jpTd}|jd�d}|d|}|j�j|�dkr|d||�qW�xdtj |d�D�]R\} }}
|jr�P|dkr�|d|d�q�ytj
| |�}Wntk
r�w�YnX|j}t
|d ��rny|j|�}
Wn&tk
�r:|�r4||�w�YnXttj|
���pNd}t
|d
��rh|j|�}nd}n^ytjj|�}Wn&tk
�r�|�r�||�w�YnX|j�r�|jj�dnd}t|dd�}|d|}|j�j|�dkr�||||�q�W|�r|�dS)NF�__main__rrrrz - )r��
get_source�get_filenamerV)r�r�rr�r�rUrr�r:r�� _get_specr�r�rcr�rKr�r��StringIOr�r�r�r�r�r�r<)r>r�rGZ completerr��seenr'r(r�rDrEr�r��sourcerr�rrrr�s`zModuleScanner.run)NNN)r%r&r[r�rrrrr�sr�cCsDdd�}dd�}tj��"tjd�t�j|||d�WdQRXdS)NcSs6|dd�dkr |dd�d}t||o.d|�dS)Nr�z .__init__z
(package)z- i����i����)r�)rr'r�rrrr�Pszapropos.<locals>.callbackcSsdS)Nr)r'rrrr�Tszapropos.<locals>.onerror�ignore)r�)�warnings�catch_warnings�filterwarningsr�r�)rGr�r�rrrr�Ns
r�cs�ddl�ddl�ddl�ddl�Gdd�d�jj��G�fdd�d�jj��G�����fdd�d�j�}|||�}|j�x|j r�|j
r�tjd�q~W|S) Nrc@seZdZdd�Zdd�ZdS)z!_start_server.<locals>.DocHandlercSsX|jjd�rd}nd}|jd�|jdd|�|j�|jj|j|j|�jd��dS)Nz.cssztext/cssz text/html��zContent-Typez%s; charset=UTF-8zutf-8) rrbZ
send_responseZsend_headerZend_headersZwfiler��
urlhandlerr�)r>�content_typerrr�do_GET�s
z(_start_server.<locals>.DocHandler.do_GETcWsdS)Nr)r>r�rrr�log_message�sz-_start_server.<locals>.DocHandler.log_messageN)r%r&r[r�r�rrrr�
DocHandler�sr�cs(eZdZdd�Z�fdd�Zdd�ZdS)z _start_server.<locals>.DocServercSs6d|_|j|f|_||_|jj||j|j�d|_dS)NZ localhostF)�hostZaddressr�rIrz�handlerr�)r>�portr�rrrrz�s
z)_start_server.<locals>.DocServer.__init__csBx4|js4�j|jj�gggd�\}}}|r|j�qW|j�dS)Nr)r��selectZsocketr�Zhandle_requestZserver_close)r>Zrd�wrZex)r�rr�serve_until_quit�s
z1_start_server.<locals>.DocServer.serve_until_quitcSs |jj|�|jr|j|�dS)N)rI�server_activater�)r>rrrr��sz0_start_server.<locals>.DocServer.server_activateN)r%r&r[rzr�r�r)r�rr� DocServer�sr�cs:eZdZ�fdd�Z����fdd�Zdd�Zdd�Zd S)
z#_start_server.<locals>.ServerThreadcs,||_t|�|_�jj|�d|_d|_dS)NF)r�rr��Threadrz�serving�error)r>r�r�)� threadingrrrz�s
z,_start_server.<locals>.ServerThread.__init__cstyF�jj�_��_�jj�_t|j��_�|j |j
�}||_|j�Wn(t
k
rn}z||_WYdd}~XnXdS)N)�server�
HTTPServerrIr�r�ZMessageZMessageClass�staticmethodr�r��ready� docserverr�rKr�)r>Zdocsvr�e)r�r��email�httprrr��s
z'_start_server.<locals>.ServerThread.runcSs,d|_|j|_|j|_d|j|jf|_dS)NTz
http://%s:%d/)r�r�Zserver_portr�r)r>r�rrrr��sz)_start_server.<locals>.ServerThread.readycSs&d|j_|j�d|_d|_d|_dS)NTF)r�r�r!r�r)r>rrr�stop�s
z(_start_server.<locals>.ServerThread.stopN)r%r&r[rzr�r�r�r)r�r�r�r�r�rr�ServerThread�s
r�g{�G�z�?)
Zhttp.serverZ
email.messager�r�r�ZBaseHTTPRequestHandlerr�r�r$r�r��timeZsleep)r�r�r�Zthreadr)r�r�r�r�r�r�r�
_start_server\s8&
r�� text/htmlcsG�fdd�dt�}|���fdd���fdd���fdd���fd d
���fdd���fd
d���fdd���fdd����������fdd�}|jd�r�|dd�}|dkr�tjjtjjt��}tjj||�}t|��}dj|j ��SQRXn|dk�r||�St
d||f��dS)NcseZdZ�fdd�ZdS)z_url_handler.<locals>._HTMLDoccsd}d|}d||��|fS)Nzpydoc_data/_pydoc.cssz1<link rel="stylesheet" type="text/css" href="%s">a<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Pydoc: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
%s</head><body bgcolor="#f0f0f8">%s<div style="clear:both;padding-top:.5em;">%s</div>
</body></html>r)r>r�r��css_pathZcss_link)�html_navbarrrr��sz#_url_handler.<locals>._HTMLDoc.pageN)r%r&r[r�r)r�rr�_HTMLDoc�sr�cs>�jdtj�tj�dtj�f�}d|�jtjdd��fS)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>
<form action="search" style='display:inline;'>
<input type=text name=key size=15>
<input type=submit value="Search">
</form>
</div>
</div>
T)Zterse)r�r�Zpython_versionZpython_buildZpython_compiler)rA)r�rrr� s
z!_url_handler.<locals>.html_navbarcs�dd�}�jddd�}dd�tjD�}�j||�}|d�jd dd
|�g}i}x tjD]}|j�j||��qVW|jd�dd
j|�fS)NcSsd||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)rkr(rrrr�2 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<ping@lfw.org></font>zIndex of Modulesr) rrr�rrrr
ror!)r�r�namesr�r�r)r�rr�
html_index) sz _url_handler.<locals>.html_indexc s�g��fdd�}tj��*tjd�dd�}t�j|||d�WdQRXdd�}g}�jd d
d�}x"�D]\}}|j||�|�qhW|�jd|d
d
dj|��}d|fS)Ncs:|dd�dkr |dd�d}�j||o0d|f�dS)Nr�z .__init__z
(package)z- i����i����)r
)rr'r�)�
search_resultrrr�G sz3_url_handler.<locals>.html_search.<locals>.callbackr�cSsdS)Nr)r'rrrr�N sz2_url_handler.<locals>.html_search.<locals>.onerror)r�cSsd||fS)Nz<a href="%s.html">%s</a>r)r(rrrr�S sz4_url_handler.<locals>.html_search.<locals>.bltinlinkz5<big><big><strong>Search Results</strong></big></big>z#ffffffz#7799eezkey = %sz#ee77aaz<br>zSearch Results) r�r�r�r�r�rr
rr!) rGr�r�r�rhrr(r�r�)r�)r�r�html_searchB s
z!_url_handler.<locals>.html_searchcsLdd�}�jddd�}ttjj��}�j||�}|�jddd|�}d|fS)NcSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr�c sz4_url_handler.<locals>.html_topics.<locals>.bltinlinkz,<big><big><strong>INDEX</strong></big></big>z#ffffffz#7799eeZTopicsz#ee77aa)rr�r�r�rDrr)r�rr�r�)r�rr�html_topics` sz!_url_handler.<locals>.html_topicscsL�jddd�}ttjj��}dd�}�j||�}|�jddd|�}d|fS)Nz,<big><big><strong>INDEX</strong></big></big>z#ffffffz#7799eecSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr�w sz6_url_handler.<locals>.html_keywords.<locals>.bltinlinkZKeywordsz#ee77aa)rr�r�r�rDrr)rr�r�r�)r�rr�
html_keywordsp sz#_url_handler.<locals>.html_keywordscs�tj�}t||�}|j|�\}}||jkr0d}nd}�jd|dd�}d�j|�}�j|dd|�}|r�t|j ��}dd �}�j
||�}�jd
dd|�}d||fdj|||f�fS)
NZKEYWORDZTOPICz)<big><big><strong>%s</strong></big></big>z#ffffffz#7799eez
<pre>%s</pre>z#ee77aacSsd||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)
r�r�r�r�r�rr'rr�rrrr!)r��bufZhtmlhelpr�r�r�rr�)r�rr�html_topicpage s&
z$_url_handler.<locals>.html_topicpagecs@t|dd�}|dkr$|dkr$td��t|�}�j||�}||fS)Nr)r�r�zcould not find object)r�rer�r�)rr9r��content)r�rr�html_getobj� sz!_url_handler.<locals>.html_getobjcsP�jddd�}dj�fdd�tt|�|�D��}|�j|dd|�}d||fS) Nz,<big><big><strong>Error</strong></big></big>z#ffffffz#7799eez<br>c3s|]}�j|�VqdS)N)r�)rkr�)r�rrrm� sz3_url_handler.<locals>.html_error.<locals>.<genexpr>z#bb0000z
Error - %s)rr!rr�r)rr�rr�)r�rr�
html_error� sz _url_handler.<locals>.html_errorcst|}|jd�r|dd�}�y|d
kr4��\}}�n�|dkrH��\}}n�|dkr\��\}}n�d|k�r&|jd�\}}}|dkr��|�\}}n�|d kr�y�|�\}}Wn tk
r��|�\}}YnXn\|d
k�r|dkr��\}}n4y�|�\}}Wn"tk
�r�|�\}}YnXntd��n�|�\}}Wn2tk
�rf}z�||�\}}WYdd}~XnX�j||�S)Nz.html�rror�r�raz
search?keyz topic?keyzget?keyz
bad pydoc url���)rro)rro)rbr�rerKr�)rZcomplete_urlr�r��opr_r�)r�r�r�r�r�r�r�r�rr�
get_html_page� s>
z#_url_handler.<locals>.get_html_pager�rztext/cssrz text/htmlz"unknown content type %r for url %s)r�rar r�dirname�realpathrVr!r�� readlinesrt)rr�r�rZ path_herer��fpr) r�r�r�r�r�r�r�r�r�r�_url_handler�s*
(
rT)�open_browsercCs�ddl}tt|�}|jr&t|j�dS|jr�d}|r@|j|j�z�y^td|j�t|�xD|jr�td�}|j �}|dkr|PqZ|dkr�|j|j�qZt|�qZWWnt
tfk
r�t�YnXWd|jr�|j�td�XdS)Nrz"Server commands: [b]rowser, [q]uitzServer ready atzserver> r�r�zServer stopped)
�
webbrowserr�rr�r�r�r�rr�r�r�r�r�)r�r r
ZserverthreadZserver_help_msgr�rrr�browse� s2
rcCst|t�o|jtj�dkS)Nr)r�r7r�r �sep)rNrrr�ispath
sr
cCsddl}Gdd�dt�}dtjkrXtjjtjd�}|tjkrJtjj|�tjjdd��yp|jtjdd�d�\}}d}d}d}d}xP|D]H\} }
| d kr�d
}d
}| dkr�t |
�dS| dkr�d
}|
}| d
kr�d
}q�W|r�|dkr�d}t
||d�dS|�s|�x�|D]�}t|��r4tjj|��r4t
d|�Py`t|��rVtjj|��rVt|�}|�r�t|��r~tjj|��r~t|�nt|�n
tj|�Wn,tk
�r�}zt
|�WYdd}~XnX�qWWnN|j|fk
�rtjjtjjtjd��d}
t
dj|
tjd��YnXdS)Nrc@seZdZdS)zcli.<locals>.BadUsageN)r%r&r[rrrr�BadUsage
srrrrzbk:p:wFz-bTz-kz-pz-w)r zfile %r does not exista�pydoc - 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.
)r�r)�getoptrKrrr r�argv�remove�insertr�rr
�existsr�r{r�rr�r�rr�r�r�r�rr)rrZ scriptdirZoptsr�ZwritingZstart_serverr r��opt�val�argrHr�rrr�cli
sd
$rr�)NN)r)r)r�rN)r�rN)r)rN)r�)r)Wr4rPrTrSr[Zimportlib._bootstrapr�Zimportlib._bootstrap_externalZimportlib.machinery�importlib.utilrr�r r:r�rrr�r�Zurllib.parser5r��collectionsr�reprlibr� tracebackrrrr$r)r-r/r3r�
IGNORECASEr4r5r:r?rCrOrerfrwr}r�r�rKr�r�r�r�r�r�rqrrr�r�r�r�r�r�r�r�r�r�r�r.r�r�r�r�r"r�r�r�rr�r�r�rrr
rr%rrrr�<module>%s�
'
0>*- d",
=
n%V
?>