AlkantarClanX12

Your IP : 3.145.105.149


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/pydoc.cpython-35.opt-2.pyc



$�Yfؔ�@s4dgZdZdZdZddlZddlZddlZddlZddl	Zddl
Z
ddlZddlZddl
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*ddd"d#�Z+d$d%�Z,d&d'�Z-d(d)�Z.id*d+�Z/Gd,d-�d-e0�Z1d.d/�Z2did0d1�Z3Gd2d3�d3�Z4Gd4d5�d5e�Z5Gd6d7�d7e4�Z6Gd8d9�d9e�Z7Gd:d;�d;e4�Z8Gd<d=�d=e8�Z9d>d?�a:d@dA�Z;dBdC�Z<dDdE�Z=dFdG�Z>dHdI�Z?dJdK�Z@dLdM�ZAdNdO�ZBddPdQ�ZCe8�ZDe9�ZEe6�ZFddRdS�ZGdTdddUdV�ZHdTdddWdX�ZIddYdZ�ZJd[dd\d]�ZKGd^d_�d_�ZLeL�ZMGd`da�da�ZNdbdc�ZOddde�ZPdfdgdh�ZQddidjdkdl�ZRdmdn�ZSdodp�ZTeUdqkr0eT�dS)r�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}xstjD]h}tjj|p.d�}tjj|�}||krtjj|�r|j|�|j|�qW|S)N�.)�sys�path�os�abspath�normcase�isdir�append)�dirsZnormdirs�dir�normdir�r�*/opt/alt/python35/lib64/python3.5/pydoc.py�pathdirsMs
rcCsCtj|�ptj|�}|r?tjdd|j��pBdS)Nz^ *
�)�inspect�getdocZgetcomments�re�sub�rstrip)�object�resultrrrrYsrcCs�|j�jd�}t|�dkr5|ddfSt|�dkry|dj�ry|ddj|dd��fSddj|�fS)N�
�rr�)�strip�split�lenr�join)�doc�linesrrr�splitdoc^s#!r%cCs-|j}|j|kr)|jd|}|S)Nr)�__name__�
__module__)r�modname�namerrr�	classnamegs	r*cCsYtj|�pWtj|�pWtj|�pWtj|�pWtj|�pWtj|�S)N)r�ismodule�isclass�	isroutineZisframeZistracebackZiscode)rrrr�isdatansr.cGsAx:|r<|dj|j|d��}|dd�}qW|S)Nrrr)r"r )�textZpairsrrr�replacets	 r0cCsnt|�|krjtd|dd�}td|d|�}|d|�d|t|�|d�S|S)Nr�rz...)r!�max)r/�maxlen�preZpostrrr�cram{s
*r5z at 0x[0-9a-f]{6,16}(>+)$cCstjd|�S)Nz\1)�_re_stripidr)r/rrr�stripid�sr7cCs:tj|�p9tj|�p9tj|�p9tj|�S)N)r�
isfunction�ismethod�	isbuiltinZismethoddescriptor)�objrrr�_is_some_method�sr<cCsRtj|�rdStj|�rNt|dd�}tj|�pL|dkSdS)NT�__self__F)rr9r:�getattrr+)�fn�selfrrr�_is_bound_method�srAcCs�i}x*tj|t�D]\}}d||<qWx$|jD]}|jt|��q=Wx'|j�D]}t||�||<qgW|S)Nr)r�
getmembersr<�	__bases__�update�
allmethods�keysr>)�cl�methods�key�value�baserrrrE�srEcCsPg}g}x7|D]/}||�r5|j|�q|j|�qW||fS)N)r
)�s�	predicate�yes�no�xrrr�_split_list�s
rQcCs||dkrdS|jd�r2|jd�r2dS|jd�rTt|d�rTdS|dk	rj||kS|jd�SdS)N�
__author__�__builtins__�
__cached__�__credits__�__date__�__doc__�__file__�__spec__�
__loader__r'r&�__package__�__path__�__qualname__�	__slots__�__version__r�__r�_�_fieldsT>rUrVrRr'r&r]rTr_r^rYrZr\rXr[rSrW)�
startswith�endswith�hasattr)r)�allr;rrr�visiblename�s	
rgcCs^g}xQtj|�D]@\}}}}tj|�r=d}|j||||f�qW|S)Nzdata descriptor)r�classify_class_attrs�isdatadescriptorr
)r�resultsr)�kind�clsrJrrrrh�s"rhcCsPtjj|�rLx7dD]/}tjjtjj|d|��rdSqWdS)N�.py�.pyc�__init__TF)rmrn)r	rr�isfiler")r�extrrr�	ispackage�s

%rrcCs|j�}x:|dd�dks2|j�rH|j�}|sPqW|j�}|dd�dkr{|dd�}|dd�dkr	|dd�}|d	d�dkr�|dd
�}x#|j�s�|j�}|s�Pq�W|jd�dj�}nd}|S)Nr�#�zr"""r1z"""�\r���rv)�readlinerr )�file�linerrrr�source_synopsis�s&&rzc
Cs�tj|�j}|j|d�\}}|dksB||kr||jttjj��rltjj	}n0|jttjj
��r�tjj}nd}|dkr�ytj
|�}Wntk
r�dSYnX|�t|�}WdQRXn{|d|�}tjjd|d|�}ytjj|�}	WndSYnXtjd=|	jrf|	jj�dnd}||f||<|S)NZ__temp__�loaderr)NN)r	�stat�st_mtime�getrd�tuple�	importlib�	machinery�BYTECODE_SUFFIXES�SourcelessFileLoader�EXTENSION_SUFFIXES�ExtensionFileLoader�tokenize�open�OSErrorrz�util�spec_from_file_location�
_bootstrap�_loadr�modulesrW�
splitlines)
�filename�cache�mtimeZ
lastupdaterZ
loader_clsrxr{�spec�modulerrr�synopsis�s4
			
"r�c@s(eZdZdd�Zdd�ZdS)�ErrorDuringImportcCs%||_|\|_|_|_dS)N)r��excrJ�tb)r@r��exc_inforrrros	zErrorDuringImport.__init__cCs#|jj}d|j||jfS)Nzproblem in %s - %s: %s)r�r&r�rJ)r@r�rrr�__str__szErrorDuringImport.__str__N)r&r'r]ror�rrrrr�sr�c
Cstjj}t|d��4}|jt|��}||tjjfk}WdQRXtjj	|�}tjj
|�\}}|r�tjj||�}ntjj
||�}tjj||d|�}	ytjj|	�SWnt|tj���YnXdS)N�rbr{)r�r��MAGIC_NUMBERr��readr!�_BACKCOMPAT_MAGIC_NUMBERr	r�basename�splitext�_bootstrap_externalr��SourceFileLoaderr�r�r�r�rr�)
r�magicrxZfirst_bytesZis_bytecoder�r)rqr{r�rrr�
importfile sr�cs{y�|rv�tjkrv�tjkrv�fdd�tjD�}x0�g|D]!}tj|||<tj|=qQWt��}Wn�tj�\}}}}	�tjkr�ttj�j|	��nU|tkr�t|j|	��n4|t	kr
|j
�kr
dSt�tj���YnXxM�jd�dd�D]2}
yt||
�}WqAt
k
rrdSYqAXqAW|S)Ncs)g|]}|j�d�r|�qS)r)rc)�.0�m)rrr�
<listcomp>Ks	zsafeimport.<locals>.<listcomp>rr)rr��builtin_module_names�
__import__r�r�rX�SyntaxErrorr��ImportErrorr)r r>�AttributeError)r�	forceloadr�ZsubsrIr�r�rJr��info�partr)rr�
safeimport7s. 

r�c@s�eZdZejjddejdd��Zddd�Z	ddd�Z
e
ZZZ
ZZZejjejd	d
ejdd��dd�ZdS)
�Doc�
PYTHONDOCSz%https://docs.python.org/%d.%d/libraryNrcGs�||f|}tj|�r,|j|�Stj|�rH|j|�SyXtj|�rg|j|�Stj|�r�|j|�Stj|�r�|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�documentms"





zDoc.documentcGs9d|odt|�t|�jf}t|��dS)Nz.don't know how to document object%s of type %s� )�repr�typer&�	TypeError)r@rr)r��messagerrr�fails&zDoc.fail�libzpython%d.%dcCsytj|�}Wntk
r-d}YnXtjjd|j�}tjj|�}t	|t
t��r|jdks�|j|�r|jtjj
|d
��r|jdkr|jd�r�d|jd�|jj�f}qtjj
||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�
getabsfiler�r	�environr~r�rrr�r�r&rcr"r�lower)r@rZbasedirrx�doclocrrr�	getdocloc�s$
	%%z
Doc.getdocloc)r&r'r]r	r�r~r�version_infor�r�r�r�r�r�r�r�r�rr"�base_exec_prefixr�rrrrr�gsr�c@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZeZdd�Z	eZ
d
S)�HTMLReprcCs:tj|�d|_|_d|_d|_|_dS)N��
�d)rro�maxlist�maxtuple�maxdict�	maxstring�maxother)r@rrrro�s
	zHTMLRepr.__init__cCst|dddddd�S)N�&z&amp;�<z&lt;�>z&gt;)r0)r@r/rrr�escape�szHTMLRepr.escapecCstj||�S)N)rr�)r@rrrrr��sz
HTMLRepr.reprcCs�tt|�d�r\ddjt|�jj��}t||�r\t||�||�S|jttt	|��|j
��S)Nr&�repr_ra)rer�r"r&r r>r�r5r7r�r�)r@rP�level�
methodnamerrr�repr1�s
"zHTMLRepr.repr1cCst||j�}t|�}d|krcdt|dd�krcd|d|j|�|dStjdd|j|��S)Nruz\\r�rrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z<font color="#c040c0">\1</font>)r5r�r�r0r�rr)r@rPr��test�testreprrrr�repr_string�s$!	zHTMLRepr.repr_stringcCsOy)|jttt|��|j��SWn|jd|jj�SYnXdS)Nz
<%s instance>)r�r5r7r�r��	__class__r&)r@rPr�rrr�
repr_instance�s)zHTMLRepr.repr_instanceN)r&r'r]ror�r�r�r��repr_strr�Zrepr_unicoderrrrr��sr�c@s�eZdZe�ZejZejZdd�Zddd�Zddddd	d
�Z	dd�Z
d
d�Zddd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdiiidd�Zdd d!�Zddd"d#�Zddiid$d%�Zd&d'�Zddiiidd(d)�Zd*d+�Zdddd,d-�Zddd.d/�Zdddd0d1�Zdd2d3�ZdS)4�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�szHTMLDoc.pagercCsd|||||pdfS)Na'
<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@r��fgcol�bgcol�extrasrrr�heading�s	zHTMLDoc.heading�Nz&nbsp;c	
Csw|dkrdd|d}d|||f}	|rT|	d||||f}	n|	d|||f}	|	d|S)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@r�r�r�r��widthZpreludeZ
marginaliaZgaprrrr�section�szHTMLDoc.sectioncGsd|}|j||�S)Nz<big><strong>%s</strong></big>)r�)r@r�r�rrr�
bigsections
zHTMLDoc.bigsectionc
Cs7|j|j��}t|dddddddd�	S)Nz

z
 
r�z&nbsp;rz<br>
)r��
expandtabsr0)r@r/rrr�	preformatszHTMLDoc.preformatrtcCs�d}t|�|d|}x�t|�D]r}|dd|}xMt|||||�D]0}|t|�kr_||||�d}q_W|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�col�irrr�multicolumns"zHTMLDoc.multicolumncCsd|S)Nz<font color="#909090">%s</font>r)r@r/rrr�greyszHTMLDoc.greycGs3x,|D]$}||krd|||fSqW|S)Nz<a href="%s">%s</a>r)r@r)Zdicts�dictrrr�namelinks
zHTMLDoc.namelinkcCsm|jtjj|j�}}t||�r`t||�|kr`d|j|t||�fSt||�S)Nz<a href="%s.html#%s">%s</a>)r&rr�r~r'rer>r*)r@rr(r)r�rrr�	classlink#s
$zHTMLDoc.classlinkcCsd|j|jfS)Nz<a href="%s.html">%s</a>)r&)r@rrrr�
modulelink+szHTMLDoc.modulelinkcCso|\}}}}|r%|j|�S|r>d||f}n
d|}|r[d|}n|}d||fS)Nz
%s.%s.htmlz%s.htmlz"<strong>%s</strong>&nbsp;(package)z<a href="%s">%s</a>)r)r@Z
modpkginfor)rrr�shadowed�urlr/rrr�
modpkglink/s


zHTMLDoc.modpkglinkcCsd||fS)Nz<a href="file:%s">%s</a>r)r@r
rrrr�filelink>szHTMLDoc.filelinkcCs|p|j}g}d}tjd�}x�|j||�}	|	sFP|	j�\}
}|j||||
���|	j�\}}
}}}}|
r�||�jdd�}|jd||f�n|rdt|�}|jd|||�f�n�|r7dt|�}|jd|||�f�n�|r�|||d�d	krw|jd
|j	||��q�|jd|�nU|||d�d	kr�|j|j	||||��n|j|j	||��|}q-W|j|||d���dj
|�S)
NrzD\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>r)r�r�compile�search�spanr
�groupsr0�intr	r")r@r/r��funcs�classesrHrj�here�pattern�match�start�endrf�schemeZrfcZpepZselfdotr)r
rrr�markupBs<   "
zHTMLDoc.markupc
Csd}x�|D]�}t|�tf�kr�|\}}|d}||j||�}|r�||fkr�g}x'|D]}	|j|j|	|��qyW|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�r
r
r"�
formattree)
r@�treer(�parentr�entry�c�bases�parentsrKrrrr!ms 



zHTMLDoc.formattreec#s�|j}y
|j}Wntk
r0d}YnX|jd�}g}xPtt|�d�D]8}|jddj|d|d��||f�q]Wdj||d-d��}	d|	}
y7tj	|�}t
jj|�}�j
||�}
Wntk
rd}
YnXg}t|d�r�t|j�}|dd�d.krx|d/d�dkrx|dd0�j�}|jd
�j|��t|d�r�|j�jt|j���|r�|
dd
j|�}
�j|�}|dk	rdt�}nd}�j|
ddd|
|�}tj|tj�}gi}}x�tj|tj�D]n\}}|dk	s�tj|�p�||krft|||�rf|j||f�d|||<||<qfWx�|D]�\}}x�|jD]�}|j|j}}tj j!|�}||kr�|r�t||�r�t"||�|kr�||kr�|d|||<||<q�Wq�Wgi}}x�tj|tj#�D]�\}}|dk	s�tj$|�s�tj|�|kr�t|||�r�|j||f�d|||<tj%|�r�||||<q�Wg}xEtj|t&�D]1\}}t|||�rP|j||f�qPW�j't(|��j)||�}|o�d|}|d|}t|d�rVg}x<t*j+|j,�D](\}}} |j||| df�q�W|j-��j.|�j/�}!|�j0ddd|!�}n@|r��j.|�fdd��}!|�j0ddd|!�}|r.dd �|D�}"�j1tj2|"d�|�g}!x6|D].\}}|!j�j3|||||��q�W|�j0d!dd"d#j|!��}|r�g}!x6|D].\}}|!j�j3|||||��qAW|�j0d$dd%d#j|!��}|r�g}!x-|D]%\}}|!j�j3||��q�W|�j0d&dd'd(j|!��}t|d)�rB�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 %srVz (%s)z, z-<br><a href="%(docloc)s">Module Reference</a>rz#ffffffz#7799eez<a href=".">index</a><br>rsz.html#z#-z<tt>%s</tt>z
<p>%s</p>
r\rzPackage Contentsz#aa55cccs�j|d�S)Nr)r)�t)r@rr�<lambda>�sz#HTMLDoc.docmodule.<locals>.<lambda>�ModulescSsg|]\}}|�qSrr)r�rIrJrrrr��s	z%HTMLDoc.docmodule.<locals>.<listcomp>ZClassesz#ee77aar�Z	Functionsz#eeaa77ZDataz#55aa55z<br>
rRZAuthorrUZCreditsrvz$Revision: rvrv)6r&�__all__r�r rr!r
r"rr��urllib�parse�quoterr�re�strr_rr�rVr��localsr�rBr+r,�	getmodulergrCr'rr�r~r>r-r:r8r.rrr��pkgutil�iter_modulesr\�sortrrr�r!�getclasstreer�rRrU)#r@rr)�mod�ignoredrf�partsZlinksrZ
linkedname�headrr
rr��versionr�rr�rZcdictrIrJrKr(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	��q�W�d���������fdd�}
����fd	d
�}��������fdd�}�fd
d�t
��D�}i�x|D]w\}}}}d|d|�|<}yt�|�}Wntk
r�YnXy|�|<WqWt
k
r�YqWXqWWxI|r|r�|j��n|dd�t|�fdd��\}}�tjkr:|}q�n.��krOd}nd�j��j	�}|d7}|jddd��|
d||dd��}|
d||dd��}|
d||dd��}|d||d d��}|d!||d"d��}|}q�Wd#j|	�}	||krLd$||f}nd%|||f}|r�g}x*|D]"}|j�j|�j	��qrW|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@rrrrosz1HTMLDoc.docclass.<locals>.HorizontalRule.__init__cs |jr�d�d|_dS)Nz<hr>
r)rB)r@)�pushrr�maybes	
z.HTMLDoc.docclass.<locals>.HorizontalRule.maybeN)r&r'r]rorDr)rCrr�HorizontalRulesrErz&<dl><dt>Method resolution order:</dt>
z<dd>%s</dd>
z</dl>
cs�t||�\}}|r��j��|�x�|D]�\}}}}yt�|�}Wn+tk
r���j||���Yn&X��j||��������d�q6W|S)Nr)rQrDr>�	Exception�_docdescriptorr�)�msg�attrsrM�okr)rk�homeclsrJ)rr�hr�mdictr8rrCr@rr�spills


zHTMLDoc.docclass.<locals>.spillcsit||�\}}|re�j��|�x3|D]+\}}}}��j||���q6W|S)N)rQrDrG)rHrIrMrJr)rkrKrJ)rLr8rCr@rr�spilldescriptors)s

z*HTMLDoc.docclass.<locals>.spilldescriptorsc
s
t||�\}}|r	�j��|�x�|D]�\}}}}�jt�|�|��}t|�s�tj|�r�t|dd�}	nd}	|	dkr��d|�nB�jt|��j	����}	d|	}	�d||	f��d�q6W|S)NrWz<dl><dt>%s</dl>
z<dd><tt>%s</tt>z<dl><dt>%s%s</dl>
r)
rQrDr�r>�callablerrirrr�)
rHrIrMrJr)rkrKrJrKr#)rrrLrMr8rrCr@rr�	spilldata2s"


z#HTMLDoc.docclass.<locals>.spilldatacs@g|]6\}}}}t|d��r||||f�qS)r;)rg)r�r)rkrlrJ)rrrr�Gs	z$HTMLDoc.docclass.<locals>.<listcomp>rs�-rcs|d�kS)Nrr)r*)�	thisclassrrr+`sz"HTMLDoc.docclass.<locals>.<lambda>zdefined herezinherited from %sz:<br>
rIcSs|dS)Nrr)r*rrrr+msz
Methods %scSs|ddkS)Nr�methodr)r*rrrr+qszClass methods %scSs|ddkS)Nrzclass methodr)r*rrrr+sszStatic methods %scSs|ddkS)Nrz
static methodr)r*rrrr+uszData descriptors %scSs|ddkS)Nrzdata descriptorr)r*rrrr+wszData and other attributes %scSs|ddkS)Nrr=r)r*rrrr+ysrz*<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#ffc8d8r1)r&rCr
rr�getmror!rDr
r'rhr>rFr��popleftrQ�builtinsrr6r"rrr�r�)r@rr)r8rrr9�realnamer&r�rE�mrorKrNrOrQrIrIrkrKrJ�anchor�	inherited�tagr�r'r#r)	rrrLrMr8rrCr@rSrr��s�				



'	'

		!	








 $zHTMLDoc.docclasscCs|jd|j|��S)N�=)rr�)r@rrrr�formatvalue�szHTMLDoc.formatvaluecCsT|j}|p|}|r$|jp'dd|}	d}
d}t|�r�|jj}|r�||k	r�d|j||�}
nD|jdk	r�d|j|jj|�}
nd|j||�}
||kr�d|	|f}
ne|r0||jkr0|j||kr0d|jd||f}d	}n|}d
|	||f}
d}tj|�r�ytj|�}Wnt	t
fk
r�d}YnX|r�t|�}|dkr�d|}
|d	d�}|s�d
}|
|j|�|
o�|j
d|
�}|rd|S|jt|�|j|||�}|o?d|}d||fSdS)NrrRrz 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>
rv)r&rAr=r�r
�__dict__rr-�	signature�
ValueErrorr�r1r�rrrr�)r@rr)r8rrrHrGrXrZ�note�skipdocs�imclassr�Zreallink�argspecr`�declr#rrrr��sZ			
zHTMLDoc.docroutinecCsrg}|j}|r#|d|�|jdk	r[|jt|�|j�}|d|�|d�dj|�S)Nz!<dl><dt><strong>%s</strong></dt>
z<dd><tt>%s</tt></dd>
z</dl>
r)r
rWrrr�r")r@r)rJr8rjrCr#rrrrG�s	
zHTMLDoc._docdescriptorcCs|j|||�S)N)rG)r@rr)r8rGrrrr��szHTMLDoc.docpropertycGs'|rd|pd}||j|�S)Nz<strong>%s</strong> = r)r�)r@rr)r8r9Zlhsrrrr��szHTMLDoc.docothercCs|j|||�S)N)rG)r@rr)r8rGrrrr��szHTMLDoc.docdatacCs�g}|dkri}xhtj|g�D]T\}}}tdd�|D��rVq+|j|d|||kf�d||<q+W|j�|j||j�}|j|dd|�S)Ncss1|]'}dt|�ko&dknVqdS)i�i��N)�ord)r��chrrr�	<genexpr>�sz HTMLDoc.index.<locals>.<genexpr>rrz#ffffffz#ee77aa)r4r5�anyr
r6rrr�)r@rrr>r?r)r@r�rrr�index�s"
z
HTMLDoc.index)r&r'r]r��_repr_instancer�r�r�r�r�r�r�rrr	r
rrrrr!r�r�r^r�rGr�r�r�rkrrrrr��s8			
+y�;
r�c@sFeZdZdd�Zdd�Zdd�ZeZdd�Zd	S)
�TextReprcCs:tj|�d|_|_d|_d|_|_dS)Nr�r�r�)rror�r�r�r�r�)r@rrrro�s
	zTextRepr.__init__cCsxtt|�d�r\ddjt|�jj��}t||�r\t||�||�Sttt|��|j	�S)Nr&r�ra)
rer�r"r&r r>r5r7r�r�)r@rPr�r�rrrr�s
"zTextRepr.repr1cCs^t||j�}t|�}d|krZdt|dd�krZd|d||dS|S)Nruz\\rr�r)r5r�r�r0)r@rPr�r�r�rrrr�	s
$zTextRepr.repr_stringc
Cs=y ttt|��|j�SWnd|jjSYnXdS)Nz
<%s instance>)r5r7r�r�r�r&)r@rPr�rrrr�s zTextRepr.repr_instanceN)r&r'r]ror�r�r�r�rrrrrm�s
	rmc@s�eZdZe�ZejZdd�Zddd�Zdd�Zdd	d
d�Z	dddd
�Z
dddd�Zdd�Zddddd�Z
dd�Zddddd�Zddddd�Zddddddd�ZdS)�TextDoccCsdjdd�|D��S)Nrcss|]}|d|VqdS)�Nr)r�rhrrrri$szTextDoc.bold.<locals>.<genexpr>)r")r@r/rrr�bold"szTextDoc.boldz    csS|s
dS�fdd�|jd�D�}|rF|dj�|d<dj|�S)Nrcsg|]}�|�qSrr)r�ry)�prefixrrr�)s	z"TextDoc.indent.<locals>.<listcomp>rrrvrv)r rr")r@r/rqr$r)rqr�indent&s"zTextDoc.indentcCs.|j|�j�}|j|�d|dS)Nrz

)rrrrp)r@r�r�Zclean_contentsrrrr�-szTextDoc.sectionNrc
s�d}x�|D]�}t|�tf�kr�|\}}||t|��}|r�||fkr��fdd�|D�}	|ddj|	�}|d}q
t|�tg�kr
||j|�||d�}q
W|S)Nrc3s|]}t|��VqdS)N)r*)r�r%)r(rrri<sz%TextDoc.formattree.<locals>.<genexpr>z(%s)z, rz    )r�r*r"r!)
r@r"r(r#rqrr$r%r&r'r)r(rr!4s

	zTextDoc.formattreecCs�|j}tt|��\}}|jd||o:d|�}t|dd�}|j|�}|dk	r�||jd|d�}|r�||jd|�}g}	xotj|tj�D]X\}
}|dk	s�tj	|�p�||kr�t
|
||�r�|	j|
|f�q�Wg}xxtj|tj�D]a\}
}|dk	sttj
|�sttj	|�|kr8t
|
||�r8|j|
|f�q8Wg}
xEtj|t�D]1\}
}t
|
||�r�|
j|
|f�q�Wg}t�}t|d�r�xWtj|j�D]C\}}}|j|�|rR|j|d�q|j|�qW|j�||jd	d
j|��}g}xRtj|tj�D];\}
}|jj|d�r�|
|kr�|j|
�q�W|r|j�||jdd
j|��}|	r�d
d�|	D�}|jtj|d�|�g}x0|	D](\}
}|j|j||
|��qWW||jdd
j|��}|rg}x0|D](\}
}|j|j||
|��q�W||jdd
j|��}|
rdg}x6|
D].\}
}|j|j||
|dd��qW||jdd
j|��}t|d�r�t|j�}|dd�d"kr�|d#d�dkr�|dd$�j�}||jd|�}t|d�r||jdt|j ��}t|d�r6||jdt|j!��}t|d�rd||jdt|j"��}ytj#|�}Wnt$k
r�d }YnX||jd!|�}|S)%N�NAMEz - r-zMODULE REFERENCEa.

The following documentation is automatically generated from the Python
source files.  It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations.  When in doubt, consult the module reference at the
location listed above.
ZDESCRIPTIONr\z
 (package)zPACKAGE CONTENTSrrZ
SUBMODULEScSsg|]\}}|�qSrr)r�rIrJrrrr��s	z%TextDoc.docmodule.<locals>.<listcomp>r�CLASSES�	FUNCTIONSr3�FZDATAr_r(r)z
Revision: �VERSIONrVZDATErRZAUTHORrUZCREDITSz
(built-in)�FILEz$Revision: rvrv)%r&r%rr�r>r�rrBr,r3rgr
r-r:r.�setrer4r5r\�addr6r"r+rcr!r7r�r�r1r_rrVrRrUr�r�)r@rr)r8Zsynop�descrrfr�rrIrJrr=r>Z
modpkgs_namesr?r(r@Z
submodulesrAr�r<rxrrrr�Ds�	 ""$	"

	""
	  &,
zTextDoc.docmodulecs-�j}|p|}�j}�jdd�}||krRd�j|�}n�j|�d|}|r�t||�}	|ddj|	�}t��}
|
r�|
dgp�g}|j�tt	j
���}t|�dkr#�d	�x"|D]}
�d
||
��q�W�d�G�fdd
�d
�}|�������fdd�}����fdd�}�����fdd�}�fdd�t��D�}x0|r�|r�|j
��n|dd�t|�fdd��\}}�tjkr#|}q�n+��kr8d}ndt��j�}|j�|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)rB)r@rrrro�sz1TextDoc.docclass.<locals>.HorizontalRule.__init__cs$|jr�dd�d|_dS)NrRrvr)rB)r@)rCrrrD�s	z.TextDoc.docclass.<locals>.HorizontalRule.maybeN)r&r'r]rorDr)rCrrrE�srEcs�t||�\}}|r��j��|�xw|D]o\}}}}yt�|�}Wn+tk
r���j||���Yq6X��j||����q6W|S)N)rQrDr>rFrGr�)rHrIrMrJr)rkrKrJ)rLr8rrCr@rrrN�s


zTextDoc.docclass.<locals>.spillcsit||�\}}|re�j��|�x3|D]+\}}}}��j||���q6W|S)N)rQrDrG)rHrIrMrJr)rkrKrJ)rLr8rCr@rrrO�s

z*TextDoc.docclass.<locals>.spilldescriptorsc
s�t||�\}}|r��j��|�x�|D]�\}}}}t|�sctj|�rrt|�}nd}yt�|�}	Wntk
r�|j|}	YnX��j	|	|�ddd|�d�q6W|S)Nr3rvr#r)
rQrDrPrrirr>r�r_r�)
rHrIrMrJr)rkrKrJr#r;)rLr8rrCr@rrrQ�s


!z#TextDoc.docclass.<locals>.spilldatacs@g|]6\}}}}t|d��r||||f�qS)r;)rg)r�r)rkrlrJ)rrrr��s	z$TextDoc.docclass.<locals>.<listcomp>rcs|d�kS)Nrr)r*)rSrrr+sz"TextDoc.docclass.<locals>.<lambda>zdefined herezinherited from %szMethods %s:
cSs|ddkS)NrrTr)r*rrrr+szClass methods %s:
cSs|ddkS)Nrzclass methodr)r*rrrr+szStatic methods %s:
cSs|ddkS)Nrz
static methodr)r*rrrr+szData descriptors %s:
cSs|ddkS)Nrzdata descriptorr)r*rrrr+szData and other attributes %s:
cSs|ddkS)Nrr=r)r*rrrr+sz |  )r&rCr'rp�mapr"rr
rrrUr!rhrVrQrWrr*r6rrr)r@rr)r8r9rXr&r|r�r'r#r�rYrKrErNrOrQrIr[r\r)rLr8rrCr@rSrr��sl			


			!		







zTextDoc.docclasscCsd|j|�S)Nr])r�)r@rrrrr^&szTextDoc.formatvaluecCs�|j}|p|}d}d}t|�r�|jj}|ra||k	r�dt||�}n>|jdk	r�dt|jj|�}ndt||�}||kr�|j|�}	nE|r�||jkr�|j||kr�d}|j|�d|}	d}
tj|�r�ytj	|�}Wnt
tfk
rJd}YnX|r�t|�}
|dkr�|j|�d	}	|
dd�}
|
s�d
}
|	|
|}|r�|dSt
|�p�d}
|d|
o�|j|
�j�dSdS)
Nrrz from z method of %s instancez unbound %s methodrz = z<lambda>z lambda z(...)rrv)r&rAr=r�r*rpr_rr-r`rar�r1rrrr)r@rr)r8rGrXrbrcrdr�rer`rfr#rrrr�*sJ	zTextDoc.docroutinecCstg}|j}|r2||j|��|d�t|�pAd}|rg||j|��|d�dj|�S)Nrr)r
rprrrr")r@r)rJr8rjrCr#rrrrG\s	

zTextDoc._docdescriptorcCs|j|||�S)N)rG)r@rr)r8rGrrrr�iszTextDoc.docpropertycCs|j|||�S)N)rG)r@rr)r8rGrrrr�mszTextDoc.docdatac
Cs�|j|�}|r_|r%|dp(d|}|t|�}	|	dkr_|d|	�d}|rx|j|�dp{d|}|dk	r�|d|jt|��7}|S)Nz = rrz...r)r�r!rprrr1)
r@rr)r8r#r3r#r�ryZchoprrrr�qs#zTextDoc.docother)r&r'r]rmrlr�rprrr�r!r�r�r^r�rGr�r�r�rrrrrns		e}2
rnc@seZdZdd�ZdS)�
_PlainTextDoccCs|S)Nr)r@r/rrrrpsz_PlainTextDoc.boldN)r&r'r]rprrrrr~}sr~cCst�at|�dS)N)�getpager�pager)r/rrrr��s	r�cCs�ttjd�stSttjd�s,tStjj�sLtjj�rPtSdtjkr�tjdkrxdd�Stjj	d�dkr�d	d�Sd
d�Stjj	d�dkr�tStjdkr�dd�Sttd�rtj
d
�dkrdd�Sddl}|j�\}}tj
|�z:ttd�rgtj
d|�dkrgdd�StSWdtj|�XdS)N�isatty�PAGER�win32cSstt|�tjd�S)Nr�)�
tempfilepager�plainr	r�)r/rrrr+�szgetpager.<locals>.<lambda>ZTERM�dumb�emacscSstt|�tjd�S)Nr�)�	pipepagerr�r	r�)r/rrrr+�scSst|tjd�S)Nr�)r�r	r�)r/rrrr+�scSstt|�d�S)Nzmore <)r�r�)r/rrrr+�s�systemz(less) 2>/dev/nullrcSs
t|d�S)NZless)r�)r/rrrr+�sz	more "%s"cSs
t|d�S)NZmore)r�)r/rrrr+�s)r�r�)r�r�)rer�stdin�
plainpager�stdoutr�r	r��platformr~r��tempfile�mkstemp�close�ttypager�unlink)r��fdr�rrrr�s4 



$

(
rcCstjdd|�S)Nz.r)rr)r/rrrr��sr�c Cs�ddl}|j|ddd|j�}yLtj|jdd��-}y|j|�Wntk
rmYnXWdQRXWntk
r�YnXx(y|j	�PWq�tk
r�Yq�Xq�WdS)Nr�shellTr��errors�backslashreplace)
�
subprocess�Popen�PIPE�io�
TextIOWrapperr��write�KeyboardInterruptr��wait)r/�cmdr��proc�piperrrr��s 



r�cCsvddl}|j�}t|ddd��}|j|�WdQRXztj|d|d�Wdtj|�XdS)Nr�wr�r�z "r)r��mktempr�r�r	r�r�)r/r�r�r�rxrrrr��sr�cCs4ttjdd�pd}|j|d�j|�S)N�encodingzutf-8r�)r>rr��encode�decode)r/r�rrr�_escape_stdout�sr�c
Cs5tt|��jd�}yGddl}tjj�}|j|�}|j|�dd�}Wn0t	t
tjfk
r�d}dd�}YnXz|yt
tjjdd��}Wntk
r�d}YnX|dkr�d}|d}}tjjdj|d|��d�x�||d�rtjjd	�tjj�|�}	|	dkrrtjjd�Pn5|	dkr�tjjd||d�|d}q|	dkr�|||}|dkr�d}tjjddj||||��d�||}qWWd|r0|j||j|�XdS)NrrcSstjjd�S)Nr)rr�r�rrrrr+�szttypager.<locals>.<lambda>cSs!tjj�dd�dd�S)Nrrv)rr�rwrrrrr+�s�LINESr�z
-- more --�q�Qz
          
�
�b�B�)r�r�)r�r)r�r�r�)r�r�r �ttyrr��filenoZ	tcgetattrZ	setcbreakr�r�r��UnsupportedOperationrr	r�r~rar�r�r"�flushZ	tcsetattrZ	TCSAFLUSH)
r/r$r�r��oldZgetchar�hr�Zincr%rrrr��sL

'
	
/r�cCs tjjtt|���dS)N)rr�r�r�r�)r/rrrr�sr�cCs$tj|�rQ|jtjkr,d|jSt|d�rFd|jSd|jStj|�rkd|jStj|�r�d|jj	|jj|jfStj
|�r�d|jj	|jj|jfStj|�r�d|jStj|�r�d	|jStj
|�rd
|jSt|�jS)Nzbuilt-in module r\zpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%szclass z	function zmethod )rr+r&rr�rer:r��__objclass__r'r�r,r8r9r�)�thingrrr�describes.r�cCs�dd�|jd�D�}d\}}xW|t|�kr�tdj|d|d��|�}|r}||d}}q+Pq+W|r�|}nt}xD||d�D]2}yt||�}Wq�tk
r�dSYq�Xq�W|S)NcSsg|]}|r|�qSrr)r�r�rrrr�#s	zlocate.<locals>.<listcomp>rrr)Nr)r r!r�r"rWr>r�)rr�r:r��nZ
nextmodulerr�rrr�locate!s &	

r�cCsyt|t�rDt||�}|dkr:td|��||fSt|dd�}|t|t�rn|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�r1r�r�r>)r�r�rr)rrr�resolve:s

r�z Python Library Documentation: %scCs'|dkrt}t||�\}}t|�}tj|�}|rxd|krx|d|d|jd��7}n#|r�||k	r�|d|j7}tj|�p�tj|�p�tj	|�p�tj
|�p�tj|�p�t|t
�st|�}|d7}||d|j||�S)Nrz in z in module z objectz

)r/r�r�rr3�rfindr&r+r,r-r�r�r�r�r�r�)r�r�r�Zrendererrr)r{r�rrr�
render_docHs$$
r�cCs�yE|dkr(tt|||��n|jt|||t��Wn5ttfk
r|}zt|�WYdd}~XnXdS)N)r�r�r��	plaintextr�r��print)r�r�r��outputrJrrrr#as r#cCs�y~t||�\}}tjt|�tj||��}t|dddd��}|j|�WdQRXtd|d�Wn5tt	fk
r�}zt|�WYdd}~XnXdS)Nz.htmlr�r�zutf-8Zwrote)
r��htmlr�r�r�r�r�r�r�r�)r�r�rr)r�rxrJrrr�writedocls$r�rcCsI|dkri}x0tj|g|�D]\}}}t|�q(WdS)N)r4�
walk_packagesr�)r�pkgpath�doner?r(r@rrr�	writedocsws
%r�c�@s�eZdZddddddddddd	d5d
d6dd7dd8dd9dd:dddd;dddddd<dddd=dd>dd?d!d@d#d$d%dAd'dBd)dd*dd+dCd,dDd.dEddFd/dGddHd2dIi!Zd3dJd<dKd$dLdQdMdRdNd_dOd`dPiZdCdcd@dddedfdgdhdidjdkdldmdndod3dpdqdrdsdtdudvdwdxdwdydzd{dziZxaej�D]S\ZZxDeD]<Z	ej
e	e�Zeekr�ed|eZeee	<q�WquWd}dQd3dRd�dSd�dTd�dUd�dVd�dWd�dXd`dYd�dZd�d�d&d[d�d\d�d]d�d^d�d}d�d}d�d_djd`d�dad�dbd dcd�dd�ddd<d�d�d�d�ded�dfddgd�dhd�did"djd�dkd�dld�dmd�dnd�dod�d�d�d�d-dpd�dqd�drd�dsdqdtd�dud�d�d�dvd�dwd�dxd�dyd�dzd�d{d�d|d�d}d�d~ddddQd�d�d�d�d�d_d�d$d�dd�d�d	dd�dRd�dddd.dddddd�dd�dd�dd�iIZdddd�Ze
dd��Ze
dd��Zdd�Ze�Zedd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$d%d&�Zd'd(�Zd)d*�Zd+d,�Zdd-d.�Zdd/d0�Zd1d2�Zdd3d4�ZdS(��Helper�Falser�None�True�andZBOOLEAN�as�with�assert�break�	while for�class�CLASSES SPECIALMETHODS�continue�def�function�del�BASICMETHODS�elif�if�else�except�try�finally�for�break continue while�from�import�global�nonlocal NAMESPACES�
TRUTHVALUE�MODULES�in�SEQUENCEMETHODS�isZ
COMPARISON�lambdaru�nonlocal�global NAMESPACES�not�or�pass�raise�
EXCEPTIONS�return�while�break continue if TRUTHVALUE� CONTEXTMANAGERS EXCEPTIONS yield�yieldZSTRINGS�'�'''�r'�b'�"""r�r"�b"�	OPERATORS�+rR�*�**r��//�%�<<�>>r��|�^�~r�r��<=�>=�==�!=�<>ZUNARY�AUGMENTEDASSIGNMENT�+=�-=�*=�/=�%=�&=�|=�^=�<<=�>>=�**=�//=ZBITWISEZCOMPLEX�j�JzOPERATORS FORMATTINGZPOWER�,zTUPLES LISTS FUNCTIONSrz ATTRIBUTES FLOAT MODULES OBJECTSz...�ELLIPSIS�:zSLICINGS DICTIONARYLITERALS�@z	def classruraZPRIVATENAMESr`zPRIVATENAMES SPECIALMETHODS�`Z
BACKQUOTESrzTUPLES FUNCTIONS CALLSr �[zLISTS SUBSCRIPTS SLICINGS�]r��TYPES�types�RSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect�strings�4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPESZ
STRINGMETHODS�string-methods�STRINGS FORMATTINGZ
FORMATTING�
formatstrings�UNICODE�:encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPESZNUMBERS�numbers�INTEGER FLOAT COMPLEX TYPESZINTEGER�integers�	int range�FLOAT�floating�
float math�	imaginary�
complex cmathZ	SEQUENCES�typesseq�$STRINGMETHODS FORMATTING range LISTSZMAPPINGSZDICTIONARIES�typesfunctions�	def TYPESZMETHODS�typesmethods�class def CLASSES TYPESZCODEOBJECTS�bltin-code-objects�compile FUNCTIONS TYPESZTYPEOBJECTS�bltin-type-objects�types TYPESZFRAMEOBJECTSZ
TRACEBACKS�NONE�bltin-null-object�bltin-ellipsis-object�SLICINGSZSPECIALATTRIBUTES�specialattrsrt�!class SPECIALMETHODS PRIVATENAMES�typesmodulesZPACKAGES�EXPRESSIONS�operator-summary��lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIESZ
PRECEDENCEZOBJECTS�objectsZSPECIALMETHODS�specialnames�bBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES�
customization�hash repr str SPECIALMETHODSZATTRIBUTEMETHODS�attribute-access�ATTRIBUTES SPECIALMETHODSZCALLABLEMETHODS�callable-types�CALLS SPECIALMETHODS�sequence-types�(SEQUENCES SEQUENCEMETHODS SPECIALMETHODSZMAPPINGMETHODS�MAPPINGS SPECIALMETHODS�
NUMBERMETHODS�
numeric-types�*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODSZ	EXECUTION�	execmodel�%NAMESPACES DYNAMICFEATURES EXCEPTIONSZ
NAMESPACES�naming�3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURESZDYNAMICFEATURES�dynamic-featuresZSCOPINGZFRAMESr��try except finally raiseZCONVERSIONS�conversionsZIDENTIFIERS�identifiers�keywords SPECIALIDENTIFIERSZSPECIALIDENTIFIERS�
id-classes�atom-identifiersZLITERALS�
atom-literals�=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALSZTUPLESZ
TUPLELITERALS�	exprlists�TUPLES LITERALSZLISTS�typesseq-mutable�LISTLITERALS�lists�LISTS LITERALS�typesmapping�DICTIONARYLITERALSr�DICTIONARIES LITERALSZ
ATTRIBUTES�attribute-references�(getattr hasattr setattr ATTRIBUTEMETHODSZ
SUBSCRIPTS�
subscriptions�slicingsZCALLS�calls�power�unaryZBINARY�binaryZSHIFTING�shifting�bitwise�comparisons�EXPRESSIONS BASICMETHODS�booleans�EXPRESSIONS TRUTHVALUEZ	ASSERTIONZ
ASSIGNMENT�
assignment�	augassignZDELETIONZ	RETURNINGZ	IMPORTINGZCONDITIONALZLOOPING�compound�for while break continue�truth� if while and or not BASICMETHODSZ	DEBUGGING�debugger�pdbZCONTEXTMANAGERS�context-managersNcCs||_||_dS)N)�_input�_output)r@�inputr�rrrro*s	zHelper.__init__cCs|jptjS)N)r�rr�)r@rrrr+.szHelper.<lambda>cCs|jptjS)N)r�rr�)r@rrrr+/scCs?tj�dddkr%|�dSd|jj|jjfS)Nrr1�?rz<%s.%s instance>)r�stackr�r'r])r@rrr�__repr__1s
zHelper.__repr__cCsG||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__9s

	zHelper.__call__cCs�|jjd�x�y|jd�}|s,PWnttfk
rHPYnXt|dddd�j�}|j�d	krzP|dkr�|j�q|j	|�qWdS)
Nrzhelp> rrr�r��quitr)r�r�)
r�r��getliner��EOFErrorr0rr�r�r)r@r�rrrr�Fs
zHelper.interactcCsJ|jtjkrt|�S|jj|�|jj�|jj�SdS)N)r�rr�r�r�r�rw)r@�promptrrrr�Us


zHelper.getlinecCs�t|�td�kro|j�}|dkr=|j�q�|dkrV|j�q�|dkro|j�q�|dkr�|j�q�|dd�dkr�|j|j�d�q�||jkr�|j|�q�|dkr�t	t
|�d�q�||jkr|j|�q�||j
kr7|j|�q�|rVt	|dd
|j�q�t	tdd
|j�n/t|t�r�|�nt	|dd
|j�|jjd�dS)Nr�keywords�symbols�topicsr��zmodules rr�r�r�zHelp on %s:r�r)r�r�r�)r�r�listkeywords�listsymbols�
listtopics�listmodulesr r��
showsymbolr#�evalr��	showtopicr�r�r1r�r�r�r�)r@r�rrrr^s6




zHelper.helpcCs2|jjdttjdd�gd��dS)Na�
Welcome to Python %s's help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/%s/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".
r1r)r�r�rrr<)r@rrrr�ss	zHelper.intrort�Pc		Cs�tt|��}||}t|�|d|}x�t|�D]�}x�t|�D]t}|||}|t|�krT|jj||�||dkrT|jjdd|dt||��qTW|jjd�qAWdS)Nrr�r)r�sortedr!rr�r�)	r@�items�columnsr�Zcolwr�rowrrrrrr�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�rr�rF)r@rrrr��s	zHelper.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�rr�rF)r@rrrr��s	zHelper.listsymbolscCs*|jjd�|j|jj��dS)NzN
Here is a list of available topics.  Enter any topic name to get more help.

)r�r�rr�rF)r@rrrr��s	zHelper.listtopicscCs�yddl}Wn&tk
r8|jjd�dSYnX|jj||jj|��}|s~|jjdt|��dSt|�td�kr�|j	||�S|\}}y|jj|}Wn0t
k
r�|jjdt|��dSYnXt|j�d�|r'|pdd|}|r�ddl
}ddj|j��d}	|j|	d	�}
|jjd
dj|
��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�r~r�r�r�r��KeyErrorr�r�textwrapr"r �wrap)r@�topic�
more_xrefs�
pydoc_data�target�label�xrefsr#r�r/Zwrapped_textrrrr��s4
		!
	zHelper.showtopiccCs�yddl}Wntk
r(dSYnX|jj||jj|��}|s\td��t|t�r{|j||�S|\}}|jj|}|r�|p�dd|}||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�r~r�rar�r1�	_gettopic)r@r�r�r�r�r�r�r#rrrr��s	
	!zHelper._gettopiccCs9|j|}|jd�\}}}|j||�dS)Nr�)r��	partitionr�)r@�symbolr�r�rar�rrrr��s
zHelper.showsymbolcs�|r,|jjdj|��t|�np|jjd�i}|dd���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...

cSsS|r0|dd�dkr0|dd�d}|jd�dkrOd||<dS)	N�	z	.__init__z
 (package)rrri����i����)�find)rr(r{r�rrr�callback�sz$Helper.listmodules.<locals>.callbackcs�d|d�dS)Nr)r()r�rr�onerror�sz#Helper.listmodules.<locals>.onerrorr�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�runrrF)r@rIr�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�ru)r�r�)r�r)r�r�)r�ru)r�r�)r�r�)r�r�)r�r)r�r�r�r�r�rr�r�)r�rRr�rr�rrrrr�rrrr�r�rr	r
rr)r�r�rr	r
rr)rRr)rrrrrrrrrrrr)rrr�rrr)rr)r$r%)r&r')r(r))r*r�)r&r,)r-r.)r/r0)r2r3)r4r5)r6r7)r8r9)r:r;)r<r=)r>r?)rAr)rBrC)rDr)r$rE)rFr�)rHrI)rJr#)rKrL)rMrN)rOrP)rQrR)rSrT)rSrU)rWrX)rYrZ)r[r\)r]r)r�r^)r_r)r`ra)rbr)rcr)rdre)rfrg)rhri)rjrk)rlrm)rrn)rorp)rqr�)rrr�)rsrG)rtrG)rurG)rvrG)rwrG)rxrG)ryrz)r{r|)r}r
)r~rV)rr�)r�r�)r�r�)r�r�) r&r'r]r�Z_symbols_inverser�r�r�Zsymbols_r�r~r�ror�r�r�r�rr�r�r�r�rr�rr�r�r�r�r�r�r�rrrrr�~s4
	
	
r�c@s%eZdZddddd�ZdS)r�NcCs�|r|j�}d|_i}x�tjD]�}|dkr+d||<|dkrf|d|d�q+t|�jpxd}|jd�d}|d|}|j�j|�dkr+|d||�q+Wx�tj	d|�D]�\}	}}
|jr�P|dkr|d|d�q�ytj
|	|�}Wntk
rCw�YnX|j}t
|d	�r�y|j|�}
Wn%tk
r�|r�||�w�YnXttj|
��p�d}t
|d
�r�|j|�}qNd}nrytjj|�}Wn%tk
r|r||�w�YnX|jr6|jj�dnd}t|dd�}|d|}|j�j|�dkr�||||�q�W|r�|�dS)NF�__main__rrrrz - r��
get_source�get_filenamerX)r�r�rr�r�rWr r�r4r��	_get_specr�r{rer�rFrzr��StringIOr�r�r�r�r�r�r>)r@r�rIZ	completerr��seenr(r)r{r?r@r�r{�sourcerr�rrrr�s`	
"	
	

	

"zModuleScanner.run)r&r'r]r�rrrrr�sr�cCsVdd�}dd�}tj��+tjd�t�j||d|�WdQRXdS)NcSsE|dd�dkr*|dd�d}t||o=d|�dS)Nr�z	.__init__z
 (package)z- i����i����)r�)rr(r{rrrr�Cszapropos.<locals>.callbackcSsdS)Nr)r(rrrr�Gszapropos.<locals>.onerror�ignorer�)�warnings�catch_warnings�filterwarningsr�r�)rIr�r�rrrr�As


r�cs�ddl�ddl�ddl�ddl�Gdd�d�jj��G�fdd�d�jj��G�����fdd�d�j�}|||�}|j�x%|j	r�|j
r�tjd�q�W|S)	Nrc@s(eZdZdd�Zdd�ZdS)z!_start_server.<locals>.DocHandlercSsx|jjd�rd}nd}|jd�|jdd|�|j�|jj|j|j|�jd��dS)Nz.cssztext/cssz	text/html��zContent-Typez%s; charset=UTF-8zutf-8)	rrdZ
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�sr�cs:eZdZdd�Z�fdd�Zdd�ZdS)z _start_server.<locals>.DocServercSsMd|_|j|f|_||_|jj||j|j�d|_dS)N�	localhostF)�host�addressr�rKro�handlerr�)r@�portr�rrrro�s
		z)_start_server.<locals>.DocServer.__init__cs[xJ|jsL�j|jj�gggd�\}}}|r|j�qW|j�dS)Nr)r��select�socketr�Zhandle_requestZserver_close)r@Zrd�wr�ex)r�rr�serve_until_quit�s
-z1_start_server.<locals>.DocServer.serve_until_quitcSs*|jj|�|jr&|j|�dS)N)rK�server_activater�)r@rrrr��s	z0_start_server.<locals>.DocServer.server_activateN)r&r'r]ror�r�r)r�rr�	DocServer�sr�csUeZdZ�fdd�Z����fdd�Zdd�Zdd�Zd	S)
z#_start_server.<locals>.ServerThreadcs>||_t|�|_�jj|�d|_d|_dS)NF)r�rr��Threadro�serving�error)r@r�r�)�	threadingrrro�s
		z,_start_server.<locals>.ServerThread.__init__cs�ye�jj�_��_�jj�_t|j��_�|j	|j
�}||_|j�Wn.t
k
r�}z||_WYdd}~XnXdS)N)�server�
HTTPServerrKr�r�ZMessageZMessageClass�staticmethodr�r��ready�	docserverr�rFr�)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��s	z)_start_server.<locals>.ServerThread.readycSs"d|j_d|_d|_dS)NTF)r�r�r�r
)r@rrr�stop�s	z(_start_server.<locals>.ServerThread.stopN)r&r'r]ror�r�r�r)r�r�r�r�r�rr�ServerThread�s
r�g{�G�z�?)
Zhttp.serverZ
email.messager�r�r�ZBaseHTTPRequestHandlerr�r�rr�r��time�sleep)r�r�r��threadr)r�r�r�r�r�r�r�
_start_serverOs8"+"
r�z	text/htmlcs�G�fdd�dt�}|���fdd���fdd���fdd���fd	d
���fdd��	�fd
d���fdd���fdd���fdd�����������	f	dd�}|jd�r|dd�}|dkr{tjjtjjt��}tjj||�}t|��}dj|j	��SWdQRXn|dkr�||�St
d||f��dS)Ncs.eZdZ�fdd�Zdd�ZdS)z_url_handler.<locals>._HTMLDoccs'd}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.pagecSsd||fS)Nz<a href="getfile?key=%s">%s</a>r)r@r
rrrrr�sz'_url_handler.<locals>._HTMLDoc.filelinkN)r&r'r]r�rr)r�rr�_HTMLDoc�s
r�csU�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>&nbsp;
                    <form action="search" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Search">
                    </form>
                </div>
            </div>
            ZterseT)r�r�Zpython_versionZpython_buildZpython_compiler)r<)r�rrr�	s
z!_url_handler.<locals>.html_navbarcs�dd�}�jddd�}dd�tjD�}�j||�}|d�jd	dd
|�g}i}x*tjD]}|j�j||��q{W|jd�dd
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#7799eecSs"g|]}|dkr|�qS)r�r)r�r)rrrr�$	s	z4_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)	r�rr�rr�rr
rkr")r�r��namesr�r�r)r�rr�
html_index	sz _url_handler.<locals>.html_indexc	s�g��fdd�}tj��7tjd�dd�}t�j||d|�WdQRXdd�}g}�jd	d
d�}x+�D]#\}}|j||�|�q�W|�jd|d
d
dj|��}d|fS)NcsK|dd�dkr*|dd�d}�j||o@d|f�dS)Nr�z	.__init__z
 (package)z- i����i����)r
)rr(r{)�
search_resultrrr�9	sz3_url_handler.<locals>.html_search.<locals>.callbackr�cSsdS)Nr)r(rrrr�@	sz2_url_handler.<locals>.html_search.<locals>.onerrorr�cSsd||fS)Nz<a href="%s.html">%s</a>r)r)rrrr�E	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�r�r
r�r")	rIr�r�r�rjr�r)r{r�)r�)r�r�html_search4	s 

 	 z!_url_handler.<locals>.html_searchc
s�tjj|�}tj|��}�j|j��}WdQRXd|}�jddd�}|�jd|dd|�}d||fS)Nz
<pre>%s</pre>z3<big><big><strong>File Listing</strong></big></big>z#ffffffz#7799eezFile: %sz#ee77aaz
getfile %s)	r.r/�unquoter�r�r�r�r�r�)r�fpr$Zbodyr�r�)r�rr�html_getfileR	s
	z"_url_handler.<locals>.html_getfilecsndd�}�jddd�}ttjj��}�j||�}|�jddd|�}d|fS)NcSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r)rrrr�b	sz4_url_handler.<locals>.html_topics.<locals>.bltinlinkz,<big><big><strong>INDEX</strong></big></big>z#ffffffz#7799eeZTopicsz#ee77aa)r�r�r�r�rFrr�)r�r�r�r�)r�rr�html_topics_	s	z!_url_handler.<locals>.html_topicscsn�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�v	sz6_url_handler.<locals>.html_keywords.<locals>.bltinlinkZKeywordsz#ee77aa)r�r�r�r�rFrr�)r�r�r�r�)r�rr�
html_keywordso	s	z#_url_handler.<locals>.html_keywordscstj�}t||�}|j|�\}}||jkrHd}nd}�jd|dd�}d�j|�}�j|dd|�}|r�t|j	��}dd	�}�j
||�}�jd
dd|�}d||fdj|||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�r�rr�r�r rr�r")r��bufZhtmlhelpr�r�r�r�r�)r�rr�html_topicpage~	s&		
z$_url_handler.<locals>.html_topicpagecs^t|dd�}|dkr6|dkr6td��t|�}�j||�}||fS)Nr�rr�zcould not find object)r�rar�r�)r
r;r��content)r�rr�html_getobj�	sz!_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�)r�ry)r�rrri�	sz3_url_handler.<locals>.html_error.<locals>.<genexpr>z#bb0000z
Error - %s)r�r"rr�r�)r
r�r�r�)r�rr�
html_error�	s
z _url_handler.<locals>.html_errorcs
|}|jd�r%|dd
�}y�|dkrF��\}}ny|dkrd��\}}n[|dkr���\}}n=d|kr�|jd�\}}}|dkr��|�\}}q�|d	kr��|�\}}q�|d
kr4y�|�\}}Wq�tk
r0�|�\}}Yq�Xq�|dkr�|dkr^��\}}q�y�|�\}}Wq�tk
r��|�\}}Yq�Xq�td��n�|�\}}Wn:tk
r�}z�||�\}}WYdd}~XnX�j||�S)Nz.html�rrkr�r�r]z
search?keyzgetfile?keyz	topic?keyzget?keyz
bad pydoc url���)rrk)rrk)rdr�rarFr�)r
Zcomplete_urlr�r��oprar�)	r�r�r�r�r�r�r�r�r�rr�
get_html_page�	sB

(z#_url_handler.<locals>.get_html_pager�rztext/cssrz	text/htmlz"unknown content type %r for url %s)r�rcr	r�dirname�realpathrXr"r��	readlinesr�)r
r�r�r�Z	path_herer�r�r)
r�r�r�r�r�r�r�r�r�r�r�_url_handler�s,		

**
r�open_browserTcCs$ddl}tt|�}|jr5t|j�dS|jr d}|rZ|j|j�z�ytd|j�t|�x^|jr�td�}|j	�}|dkr�Pq}|dkr�|j|j�q}t|�q}WWnt
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�r
r�r�r�r�r�)r�rrZserverthreadZserver_help_msgr�rrr�browse�	s2	
	
	
rcCs%t|t�o$|jtj�dkS)Nr)r�r1r�r	�sep)rPrrr�ispath
srcCs�ddl}Gdd�dt�}dtjkr|tjjtjd�}|tjkritjj|�tjjdd�y�|jtjdd�d�\}}d}d}d}d}xp|D]h\}	}
|	d	kr�d
}d
}|	dkrt	|
�dS|	dkrd
}|
}|	d
kr�d
}q�W|r[|dkrGd}t
|d|�dS|sg|�x�|D]�}t|�r�tjj|�r�t
d|�Pyyt|�r�tjj|�r�t|�}|r
t|�rtjj|�rt|�qt|�n
tj|�Wqntk
rL}zt
|�WYdd}~XqnXqnWWnc|j|fk
r�tjjtjjtjd��d}
t
djd|
dtj��YnXdS)Nrc@seZdZdS)zcli.<locals>.BadUsageN)r&r'r]rrrr�BadUsage
sr	rrrzbk:p:wFz-bTz-kz-pz-wrzfile %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)�getoptrFrrr	r�argv�remove�insertr�rr�existsr�rpr�rr�r�rr�r�r�r�rr)r
r	Z	scriptdirZoptsr��writingZstart_serverrr��opt�val�argrJr�rrr�cli	
sd%




%)rr�)Vr-rRrVrUrWZimportlib._bootstrapr�Zimportlib._bootstrap_externalZimportlib.machinery�importlib.utilrr�r	r4r�rrr�r�Zurllib.parser.r��collectionsr�reprlibr�	tracebackrrrr%r*r.r0r5r�
IGNORECASEr6r7r<rArErQrgrhrrrzr�rFr�r�r�r�r�r�rmrnr~r�rr�r�r�r�r�r�r�r�r/r�r�r�r�r#r�r�r�rr�r�r�rrrrr&rrrr�<module>%s�			

'
0>*��- �d!,			
��	=��%V