Your IP : 3.136.18.192


Current Path : /opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/pydoc.cpython-38.opt-2.pyc

U

PP�f̠�@s�dgZdZdZdZddlZddlZddlZddlZddl	Zddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlmZd	d
�Zdd�Zd
d�Zdd�Z dd�Z!dd�Z"dd�Z#e�$dej%�Z&dd�Z'dd�Z(dd�Z)dd�Z*dwd d!�Z+d"d#�Z,d$d%�Z-d&d'�Z.d(d)�Z/ifd*d+�Z0Gd,d-�d-e1�Z2d.d/�Z3difd0d1�Z4Gd2d3�d3�Z5Gd4d5�d5e�Z6Gd6d7�d7e5�Z7Gd8d9�d9e�Z8Gd:d;�d;e5�Z9Gd<d=�d=e9�Z:d>d?�a;d@dA�Z<dBdC�Z=dDdE�Z>dFdG�Z?dHdI�Z@dJdK�ZAdLdM�ZBdNdO�ZCdxdPdQ�ZDe9�ZEe:�ZFe7�ZGdydRdS�ZHdzdUdV�ZId{dWdX�ZJd|dYdZ�ZKd}d\d]�ZLGd^d_�d_�ZMeM�ZNGd`da�da�ZOdbdc�ZPddde�ZQd~dgdh�ZRddidjdk�dldm�ZSdndo�ZTdpdq�ZUdrds�ZVdtdu�ZWeXdvk�r�eW�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}tjD]H}tj�|pd�}tj�|�}||krtj�|�r|�|�|�|�q|S�N�.)�sys�path�os�abspath�normcase�isdir�append)�dirsZnormdirs�dirZnormdir�r�*/opt/alt/python38/lib64/python3.8/pydoc.py�pathdirsPs

rcCs.t�|�pt�|�}|r*t�dd|���p,dS)Nz^ *
�)�inspect�getdocZgetcomments�re�sub�rstrip)�object�resultrrrr\srcCsf|���d�}t|�dkr&|ddfSt|�dkrX|d��sX|dd�|dd��fSdd�|�fS)N�
�rr�)�strip�split�lenr�join)�doc�linesrrr�splitdocasr%cCs"|j}|j|kr|jd|}|Sr)�__name__�
__module__)r�modname�namerrr�	classnamejs
r*cCs>t�|�p:t�|�p:t�|�p:t�|�p:t�|�p:t�|�S�N)r�ismodule�isclass�	isroutineZisframeZistracebackZiscode�rrrr�isdataqs����r0cGs.|r*|d�|�|d��}|dd�}q|S)Nrrr)r"r )�textZpairsrrr�replacewsr2cCsXt|�|krTtd|dd�}td|d|�}|d|�d|t|�|d�S|S)Nr�r�...)r!�max)r1�maxlenZpreZpostrrr�cram~s
$r7z at 0x[0-9a-f]{6,16}(>+)$cCst�d|�S)Nz\1)�_re_stripidr�r1rrr�stripid�sr:cCs<t�|�rdSt�|�r8t|dd�}t�|�p4|dkSdS)NT�__self__F)r�ismethod�	isbuiltin�getattrr,)�fn�selfrrr�_is_bound_method�s

rAcCs^i}t�|tj�D]\}}d||<q|jD]}|�t|��q*|��D]}t||�||<qF|S�Nr)r�
getmembersr.�	__bases__�update�
allmethods�keysr>)�cl�methods�key�value�baserrrrF�s

rFcCs8g}g}|D]"}||�r$|�|�q|�|�q||fSr+�r)�s�	predicateZyesZno�xrrr�_split_list�srQcCs\|dkrdS|�d�r$|�d�r$dS|�d�r<t|d�r<dS|dk	rL||kS|�d�SdS)N>�__file__�__credits__�__path__�__date__�__qualname__r&�	__slots__r'�__builtins__�
__author__�__spec__�__package__�__version__�
__cached__�__doc__�
__loader__r�__r�_�_fieldsT)�
startswith�endswith�hasattr)r)�all�objrrr�visiblename�srhcCsXg}t�|�D]D\}}}}t�|�r@d}t|t�r@|jdkr@d}|�||||f�q|S)N�data descriptor�readonly property)r�classify_class_attrs�isdatadescriptor�
isinstance�property�fsetr)r�resultsr)�kind�clsrKrrrrk�s
rkcs\t|dg��z�fdd�t��D��Wntk
r>i�YnX�fdd�}|j|d�dS)Nrbcsi|]\}}||t���qSr)r!)�.0�ir))�fieldsrr�
<dictcomp>�sz#sort_attributes.<locals>.<dictcomp>cs��|dd�|dfS�Nr)�get)�attr)�field_orderrr�<lambda>��z!sort_attributes.<locals>.<lambda>�rJ)r>�	enumerate�	TypeError�sort)�attrsrZkeyfuncr)rzrur�sort_attributes�s
r�cCs:tj�|�r6dD]$}tj�tj�|d|��rdSqdS)N)z.pyz.pyc�__init__TF)r
r	r
�isfiler")r	�extrrr�	ispackage�s
r�cCs�|��}|dd�dks |��s0|��}|sq0q|��}|dd�dkrT|dd�}|dd�dkr�|dd�}|dd�dkr�|dd�}|��s�|��}|s�q�q�|�d�d	��}nd}|S)
Nr�#�zr"""r3�"""����\r)�readlinerr )�file�linerrrr�source_synopsis�s&r�c
	Cs t�|�j}|�|d�\}}|dks.||k�r|�ttjj��rJtjj	}n |�ttjj
��rftjj}nd}|dkr�zt�
|�}Wntk
r�YdSX|�t|�}W5QRXn^|d|�}tjjd||d�}ztj�|�}	WnYdSXtjd=|	j�r|	j��dnd}||f||<|S)N)NNZ__temp__��loaderr)r
�stat�st_mtimerxrd�tuple�	importlib�	machinery�BYTECODE_SUFFIXES�SourcelessFileLoader�EXTENSION_SUFFIXES�ExtensionFileLoader�tokenize�open�OSErrorr��util�spec_from_file_location�
_bootstrap�_loadr�modulesr^�
splitlines)
�filename�cache�mtimeZ
lastupdaterZ
loader_clsr�r��spec�modulerrr�synopsis�s6



�r�c@seZdZdd�Zdd�ZdS)�ErrorDuringImportcCs||_|\|_|_|_dSr+)r��excrK�tb)r@r��exc_inforrrr�#szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)r�r&r�rK)r@r�rrr�__str__'szErrorDuringImport.__str__N)r&r'rVr�r�rrrrr�!sr�c		Cs�tjj}t|d��}||�t|��k}W5QRXtj�|�}tj�	|�\}}|r`tj
�||�}ntj
�||�}tjj
|||d�}ztj�|�WSt|t����YnXdS)N�rbr�)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+sr�c	s z^|rT�tjkrT�tjkrT�fdd�tjD�}�g|D]}tj|||<tj|=q8t��}Wnzt��\}}}}	�tjkr�ttj�j|	��n>|tkr�t|j|	��n(t	|t
�r�|j�kr�YdSt�t����YnX��d�dd�D].}
zt
||
�}Wq�tk
�rYdSXq�|S)Ncsg|]}|��d�r|�qS)r)rc)rs�m�r	rr�
<listcomp>Qszsafeimport.<locals>.<listcomp>rr)rr��builtin_module_names�
__import__r�r�rR�SyntaxErrorr��
issubclass�ImportErrorr)r r>�AttributeError)r	�	forceloadr�ZsubsrJr�r�rKr��info�partrr�r�
safeimport=s.


r�c@sfeZdZej�ddejdd��Zddd�Z	d
dd�Z
e
ZZZ
ZZZe�d	�fd
d�ZdS)�Doc�
PYTHONDOCSz%https://docs.python.org/%d.%d/libraryNrcGs�||f|}zFt�|�r$|j|�WSt�|�r:|j|�WSt�|�rP|j|�WSWntk
rfYnXt�|�r||j	|�S|j
|�Sr+)rr,�	docmoduler-�docclassr.�
docroutiner�rl�docdata�docother)r@rr)�argsrrr�documentss




zDoc.documentcGs*d|odt|�t|�jf}t|��dS)Nz.don't know how to document object%s of type %s� )�repr�typer&r)r@rr)r��messagerrr�fail�s
�zDoc.failZstdlibcCs�zt�|�}Wntk
r&d}YnXtj�d|j�}tj�|�}t	|t
t��r�|jdksz|�|�r�|�tj�
|d��s�|jdkr�|�d�r�d|�d�|j��f}q�tj�
||j��d	�}nd}|S)
N�
(built-in)r�)
�errno�
exceptionsZgcZimp�marshal�posix�signalr�_threadZ	zipimportz
site-packages)z	xml.etreeztest.pydoc_mod)zhttp://zhttps://z%s/%s�/�.html)r�
getabsfilerr
�environrxr�r	rrmr�r&rcr"r�lower)r@rZbasedirr��doclocrrr�	getdocloc�s(
����
z
Doc.getdocloc)N)N)r&r'rVr
r�rxr�version_infor�r�r�r�r�r�r��docpropertyr��	sysconfigZget_pathr�rrrrr�ms��

r�c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZeZdd�Z	eZ
d
S)�HTMLReprcCs,t�|�d|_|_d|_d|_|_dS�N��
�d�rr��maxlist�maxtuple�maxdict�	maxstring�maxother�r@rrrr��s
zHTMLRepr.__init__cCst|dddddd�S)N�&z&amp;�<z&lt;�>z&gt;)r2�r@r1rrr�escape�szHTMLRepr.escapecCst�||�Sr+)rr��r@rrrrr��sz
HTMLRepr.reprcCsZtt|�d�r@dd�t|�j���}t||�r@t||�||�S|�ttt	|��|j
��S�Nr&�repr_ra)rer�r"r&r r>r�r7r:r�r��r@rP�levelZ
methodnamerrr�repr1�s

zHTMLRepr.repr1cCs^t||j�}t|�}d|krJdt|dd�krJd|d|�|�|dSt�dd|�|��S)Nr��\\r�rrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z<font color="#c040c0">\1</font>)r7r�r�r2r�rr�r@rPr�ZtestZtestreprrrr�repr_string�s�zHTMLRepr.repr_stringcCs@z|�ttt|��|j��WS|�d|jj�YSXdS�Nz
<%s instance>)r�r7r:r�r��	__class__r&�r@rPr�rrr�
repr_instance�szHTMLRepr.repr_instanceN)r&r'rVr�r�r�r�r��repr_strrZrepr_unicoderrrrr��sr�c@s�eZdZe�ZejZejZdd�Zd0dd�Zd1d	d
�Z	dd�Z
d
d�Zd2dd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdiiifdd�Zd3d d!�Zd4d"d#�Zddiifd$d%�Zd&d'�Zddiiidfd(d)�Zd5d*d+�ZeZd6d,d-�Zd7d.d/�ZdS)8�HTMLDoccCsd||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�s�z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>
    �&nbsp;r)r@r�fgcol�bgcolZextrasrrr�heading�s�zHTMLDoc.heading�Nrc	
Cs^|dkrdd|d}d|||f}	|r@|	d||||f}	n|	d|||f}	|	d|S)Nz<tt>rz</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@rr	r
r�widthZpreludeZ
marginaliaZgaprrrr�section�s�
��zHTMLDoc.sectioncGsd|}|j|f|��S)Nz<big><strong>%s</strong></big>)r)r@rr�rrr�
bigsectionszHTMLDoc.bigsectionc
Cs&|�|���}t|dddddddd�	S)N�

z
 
r�rr�<br>
)r��
expandtabsr2r�rrr�	preformat
s�zHTMLDoc.preformatr�cCs�d}t|�|d|}t|�D]X}|dd|}t|||||�D]$}|t|�krJ||||�d}qJ|d}q d|S)Nrrz<td width="%d%%" valign=top>r�rz</td>z7<table width="100%%" summary="list"><tr>%s</tr></table>)r!�range)r@�list�formatZcolsr�rows�colrtrrr�multicolumns
zHTMLDoc.multicolumncCsd|S)Nz<font color="#909090">%s</font>rr�rrr�greyr|zHTMLDoc.greycGs*|D] }||krd|||fSq|S)N�<a href="%s">%s</a>r)r@r)Zdicts�dictrrr�namelinkszHTMLDoc.namelinkcCsN|jtj�|j�}}t||�rDt||�|krDd|j|t||�fSt||�S)Nz<a href="%s.html#%s">%s</a>)r&rr�rxr'rer>r*)r@rr(r)r�rrr�	classlink%s�zHTMLDoc.classlinkcCsd|j|jfS�Nz<a href="%s.html">%s</a>)r&r�rrr�
modulelink-szHTMLDoc.modulelinkcCsR|\}}}}|r|�|�S|r,d||f}nd|}|rBd|}n|}d||fS)Nz
%s.%s.htmlz%s.htmlz"<strong>%s</strong>&nbsp;(package)r)r)r@Z
modpkginfor)r	r��shadowed�urlr1rrr�
modpkglink1s

zHTMLDoc.modpkglinkcCsd||fS)Nz<a href="file:%s">%s</a>r)r@r"r	rrr�filelink@szHTMLDoc.filelinkcCs�|p|j}g}d}t�d�}|�||�}	|	s0�qh|	��\}
}|�||||
���|	��\}}
}}}}|
r�||��dd�}|�d||f�n�|r�dt|�}|�d|||�f�n�|r�dt|�}|�d|||�f�n�|�r"|||d�d	k�r|�d
|�	||��n|�d|�n@|||d�d	k�rP|�|�	||||��n|�|�	||��|}q|�|||d���d�
|�S)
NrzD\b((http|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?(\w+))�"z&quot;rz'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�groupsr2�intrr")r@r1r��funcs�classesrIrp�here�pattern�match�start�endrfZschemeZrfcZpepZselfdotr)r"rrr�markupDs:

zHTMLDoc.markupc
Cs�d}|D]�}t|�td�kr�|\}}|d}||�||�}|r�||fkr�g}|D]}	|�|�|	|��qR|dd�|�d}|d}qt|�tg�kr|d|�|||�}qd	|S)
Nrrz"<dt><font face="helvetica, arial">r&�, �)z
</font></dt>z
<dd>
%s</dd>
z
<dl>
%s</dl>
)r�rrr"�
formattree)
r@�treer(�parentr�entry�c�bases�parentsrLrrrr6os&
�
zHTMLDoc.formattreec#
s�|j}z
|j}Wntk
r(d}YnX|�d�}g}tt|�d�D],}|�dd�|d|d��||f�qHd�||dd��}	d|	}
z&t�	|�}t
j�|�}��
||�}
Wntk
r�d}
YnXg}t|d��r6t|j�}|dd�d	k�r"|dd�d
k�r"|dd���}|�d��|��t|d��rX|���t|j���|�rp|
d
d�|�}
��|�}|dk	�r�dt�}nd}��|
ddd|
|�}t�|tj�}gi}}t�|tj�D]Z\}}|dk	�s�t�|��p�||k�r�t|||��r�|�||f�d|||<||<�q�|D]�\}}|jD]n}|j|j}}tj �!|�}||k�r@|�r@t||��r@t"||�|k�r@||k�r@|d|||<||<�q@�q2gi}}t�|tj#�D]p\}}|dk	�s�t�$|��s�t�|�|k�r�t|||��r�|�||f�d|||<t�%|��r�||||<�q�g}t�|t&�D]&\}}t|||��rN|�||f��qN��'t(|��j)||�}|�o�d|}|d|}t|d��rg}t*�+|j,�D]\}}} |�||| df��q�|�-���.|�j/�}!|��0ddd|!�}n.|�r<��.|�fdd��}!|��0ddd|!�}|�r�d d!�|D�}"��1t�2|"d�|�g}!|D]"\}}|!���3|||||���qj|��0d"dd#d$�|!��}|�r�g}!|D]"\}}|!���3|||||���q�|��0d%dd&d$�|!��}|�r:g}!|D]\}}|!���3||���q|��0d'dd(d)�|!��}t|d*��rn��'t|j4��j)�}!|��0d+dd|!�}t|d,��r���'t|j5��j)�}!|��0d-dd|!�}|S).Nrrz5<a href="%s.html"><font color="#ffffff">%s</font></a>r��)<big><big><strong>%s</strong></big></big>r�r\��$Revision: �$z
version %srUz (%s)r4z-<br><a href="%(docloc)s">Module Reference</a>r�#ffffff�#7799eez<a href=".">index</a><br>r�z.html#z#-z<tt>%s</tt>z
<p>%s</p>
rTrzPackage Contentsz#aa55cccs��|d�SrB)r ��tr�rrr{�r|z#HTMLDoc.docmodule.<locals>.<lambda>ZModulescSsg|]\}}|�qSrr�rsrJrKrrrr��sz%HTMLDoc.docmodule.<locals>.<listcomp>ZClasses�#ee77aar�Z	Functionsz#eeaa77ZDataz#55aa55rrYZAuthorrSZCredits)6r&�__all__r�r rr!rr"rr��urllib�parseZquoter$rre�strr\rr�rUr��localsrrCr,r-�	getmodulerhrDr'rr�rxr>r.r=�
isfunctionr0r3rr�pkgutil�iter_modulesrTr�rr#rr6�getclasstreer�rYrS)#r@rr)�mod�ignoredrf�partsZlinksrtZ
linkedname�headr	r"r$r��versionr�rr�r-ZcdictrJrKrLr(r�r,Zfdict�datar#�modpkgs�importer�ispkgr�	classlistrr�rr��s*


��


$


�

�

 

���
��������zHTMLDoc.docmodulec	s��j}|p|}�j}g}	|	j�G�fdd�d�}
|
��tt����}t|�dkr�����d�|D]}�d��|�j	��qd�d���������fdd�}
����fd	d
�}��������fdd�}�fd
d�t
��D�}i�|D]n\}}}}d|d|�|<}zt�|�}Wntk
�r4YnXz|�|<Wq�t
k
�rXYq�Xq�|�rj|�rr|���n|dd�t|�fdd��\}}�tjk	�r��tjk�r�|}�q\n"��k�r�d}nd����j	�}|d7}t|��|
d||dd��}|
d||dd��}|
d||dd��}|d||dd��}|d||d d��}|d!||d"d��}|}�q\d#�|	�}	||k�r�d$||f}nd%|||f}|�r�g}|D]}|���|�j	���q�|d&d'�|�}d#}zt���}Wntt
fk
�rd}YnX|�r8t|�}|�r8|d(k�r8|��|�d)}t��}|�rT||�pPd#}��|�j����}|�otd*|}��|d+d,|	d-|�S).Ncs eZdZdd�Z�fdd�ZdS)z(HTMLDoc.docclass.<locals>.HorizontalRulecSs
d|_dSrw�Zneedoner�rrrr�sz1HTMLDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�d�d|_dS)Nz<hr>
rr[r���pushrr�maybe	sz.HTMLDoc.docclass.<locals>.HorizontalRule.maybeN�r&r'rVr�r^rr\rr�HorizontalRulesr`rz&<dl><dt>Method resolution order:</dt>
z<dd>%s</dd>
�</dl>
cs�t||�\}}|r�����|�|D]d\}}}}zt�|�}Wn&tk
rf���||���YnX���||��������d�q&|S)Nr�rQr^r>�	Exceptionr�r���msgr�rO�okr)rq�homeclsrK�r-r,�hr�mdictrQrr]r@rr�spills"�
zHTMLDoc.docclass.<locals>.spillcsJt||�\}}|rF����|�|D]\}}}}���||���q&|Sr+�rQr^r�rd�rirQr]r@rr�spilldescriptors+sz*HTMLDoc.docclass.<locals>.spilldescriptorsc
s�t||�\}}|r�����|�|D]�\}}}}��t�|�|��}t|�sXt�|�rft|dd�}	nd}	|	dkr��d|�n0��t|��j	����}	d|	}	�d||	f��d�q&|S)Nr^z<dl><dt>%s</dl>
z<dd><tt>%s</tt>z<dl><dt>%s%s</dl>
r)
rQr^r�r>�callablerrlr3rr)
rer�rOrfr)rqrgrKrLr#rhrr�	spilldata4s(�
z#HTMLDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qS�)rg�rh�rsr)rqrrrKr/rrr�Is
�z$HTMLDoc.docclass.<locals>.<listcomp>r��-rcs|d�kS�NrrrC��	thisclassrrr{br|z"HTMLDoc.docclass.<locals>.<lambda>�defined here�inherited from %sz:<br>
z
Methods %scSs|ddkS�Nr�methodrrCrrrr{rr|zClass methods %scSs|ddkS�Nrzclass methodrrCrrrr{tr|zStatic methods %scSs|ddkS�Nrz
static methodrrCrrrr{vr|zReadonly properties %scSs|ddkS�NrrjrrCrrrr{xr|zData descriptors %scSs|ddkS�NrrirrCrrrr{zr|zData and other attributes %scSs|ddkS�NrrVrrCrrrr{|r|rz*<a name="%s">class <strong>%s</strong></a>z/<strong>%s</strong> = <a name="%s">class %s</a>�(%s)r4�()rz<tt>%s<br>&nbsp;</tt>z#000000z#ffc8d8r3)r&rDrrr�getmror!r^rr'rkr>rcr�popleftrQ�builtinsrr�r"�	signature�
ValueErrorrJr�rr3rr)r@rr)rQr,r-rR�realnamer;rr`�mrorLrkrnrpr�rJrqrgrK�anchor�	inherited�tagrr<�declr��argspecr#r)	r-r,rirjrQrr]r@rwrr��s�
�
	
�

�

�
�
�
�
�
�

��
zHTMLDoc.docclasscCs|�d|�|��S�N�=)rr�r�rrr�formatvalue�szHTMLDoc.formatvaluec	Cs�|j}|p|}|r|jpdd|}	d}
d}t|�r�|jj}|rZ||k	r�d|�||�}
n0|jdk	rzd|�|jj|�}
nd|�||�}
t�|�s�t�|�r�d}
nd}
||kr�d|	|f}nD|r�t�||g�|kr�d	|jd||f}d
}n|}d|	||f}d}t�	|��rlzt�
|�}Wnttfk
�r>d}YnX|�rlt
|�}|dk�rld
|}|d
d�}|�svd}|
||�|�|
�o�|�d|
�}|�r�d|S|�t|�|j|||�}|�o�d|}d||fSdS)Nrrtr� from � method of %s instance� unbound %s method�async z$<a name="%s"><strong>%s</strong></a>z<a href="#%s">%s</a>rz)<a name="%s"><strong>%s</strong></a> = %s�<lambda>z$<strong>%s</strong> <em>lambda</em> r��(...)z'<font face="helvetica, arial">%s</font>z<dl><dt>%s</dt></dl>
z<dd><tt>%s</tt></dd>z<dl><dt>%s</dt>%s</dl>
)r&rAr;rrr�iscoroutinefunction�isasyncgenfunction�getattr_staticr.r�r�rrJr�rr3rr)r@rr)rQr,r-rIrHr�r��note�skipdocs�imclass�asyncqualifierrZreallinkr�r�r�r#rrrr��s|
�
���

��zHTMLDoc.docroutinecCsNg}|j}|r|d|�|�t|�|j�}|r<|d|�|d�d�|�S)Nz!<dl><dt><strong>%s</strong></dt>
z<dd><tt>%s</tt></dd>
rar)rr3rrr"�r@rr)rQrHrpr]r#rrrr��szHTMLDoc.docdatacGs|rd|pd}||�|�S)Nz<strong>%s</strong> = r�r�)r@rr)rQrRZlhsrrrr��szHTMLDoc.docothercCs�g}|dkri}t�|g�D]<\}}}tdd�|D��r:q|�|d|||kf�d||<q|��|�||j�}|�|dd|�S)Ncss*|]"}dt|�kodknVqdS)i�i��N)�ord�rsZchrrr�	<genexpr>�sz HTMLDoc.index.<locals>.<genexpr>rrrArF)rNrO�anyrr�rr#r)r@rr!rWrXr)rYrrrr�index�s
z
HTMLDoc.index)r)rrNr)r�)N)NN)NNN)NN)N)r&r'rVr��_repr_instancer�r�rrrrrrrrrr r#r$r3r6r�r�r�r�r�r�r�r�rrrrr�sF

�

+

y&�
A

rc@s0eZdZdd�Zdd�Zdd�ZeZdd�Zd	S)
�TextReprcCs,t�|�d|_|_d|_d|_|_dSr�r�r�rrrr�
s
zTextRepr.__init__cCsTtt|�d�r@dd�t|�j���}t||�r@t||�||�Sttt|��|j	�Sr�)
rer�r"r&r r>r7r:r�r�r�rrrr�s

zTextRepr.repr1cCsHt||j�}t|�}d|krDdt|dd�krDd|d||dS|S)Nr�r�rr�r)r7r�r�r2r�rrrr�s
zTextRepr.repr_stringcCs4zttt|��|j�WSd|jjYSXdSr�)r7r:r�r�rr&rrrrr%szTextRepr.repr_instanceN)r&r'rVr�r�r�rrrrrrr�s
	r�c@szeZdZe�ZejZdd�Zddd�Zdd�Zdd
d�Z	ddd
�Z
ddd�Zdd�Zddd�Z
ddd�ZeZddd�ZdS)�TextDoccCsd�dd�|D��S)Nrcss|]}|d|VqdS)�Nrr�rrrr�5szTextDoc.bold.<locals>.<genexpr>)r"r�rrr�bold3szTextDoc.bold�    cs>|sdS�fdd�|�d�D�}|r4|d��|d<d�|�S)Nrcsg|]}�|�qSrr�rsr���prefixrrr�:sz"TextDoc.indent.<locals>.<listcomp>rr�)r rr")r@r1r�r$rr�r�indent7szTextDoc.indentcCs$|�|���}|�|�d|dS)Nrr)r�rr�)r@rrZclean_contentsrrrr>szTextDoc.sectionNrc
	s�d}|D]�}t|�td�krr|\}}||t|��}|rh||fkrh�fdd�|D�}	|dd�|	�}|d}qt|�tg�kr||�|�||d�}q|S)	Nrrc3s|]}t|��VqdSr+�r*)rsr:�r(rrr�Msz%TextDoc.formattree.<locals>.<genexpr>r�r4rr�)r�r*r"r6)
r@r7r(r8r�rr9r:r;r<rr�rr6Es"
�zTextDoc.formattreec	Cs$|j}tt|��\}}|�d||o(d|�}t|dd�}|�|�}|dk	r`||�d|d�}|rt||�d|�}g}	t�|tj�D]<\}
}|dk	s�t�	|�p�||kr�t
|
||�r�|	�|
|f�q�g}t�|tj�D]F\}
}|dk	�st�
|��st�	|�|kr�t
|
||�r�|�|
|f�q�g}
t�|t�D]&\}
}t
|
||��r.|
�|
|f��q.g}t�}t|d��r�t�|j�D]6\}}}|�|�|�r�|�|d�n
|�|��qx|��||�d	d
�|��}g}t�|tj�D]0\}
}|j�|d��r�|
|k�r�|�|
��q�|�r6|��||�dd
�|��}|	�r�d
d�|	D�}|�t�|d�|�g}|	D]\}
}|�|�||
|���qd||�dd
�|��}|�r�g}|D]\}
}|�|�||
|���q�||�dd
�|��}|
�r&g}|
D]"\}
}|�|j||
|dd���q�||�dd
�|��}t|d��r�t|j�}|dd�dk�rp|dd�dk�rp|dd���}||�d|�}t|d��r�||�dt|j ��}t|d��r�||�dt|j!��}t|d��r�||�d t|j"��}zt�#|�}Wnt$k
�rd!}YnX||�d"|�}|S)#N�NAME� - rGzMODULE 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.
ZDESCRIPTIONrT�
 (package)zPACKAGE CONTENTSrrZ
SUBMODULEScSsg|]\}}|�qSrrrErrrr��sz%TextDoc.docmodule.<locals>.<listcomp>r�CLASSES�	FUNCTIONS�F)r6ZDATAr\r>r?r�r@ZVERSIONrUZDATErYZAUTHORrSZCREDITSr�ZFILE)%r&r%rrr>r�rrCr-rLrhrr.r=r0�setrerNrOrT�addr�r"r,rcr6rPr�r�rJr\rrUrYrSr�r)r@rr)rQZsynop�descrrfr�r-rJrKr,rVrWZ
modpkgs_namesrXr(rYZ
submodulesrZrrUr�rrrr�Us�
	�
��
��
�
$
zTextDoc.docmodulec	sL�j}|p|}�j}�jfdd�}||kr:d��|�}n��|�d|}|rlt||�}	|dd�|	�}g}
|
j�zt���}Wnt	t
fk
r�d}YnX|r�t|�}|r�|dkrʈ||d�t��}
|
r�|
d�t
t����}t|�d	k�r*�d
�|D]}�d||���q
�d�td
d�t���D�tjd�}t|�}d}|�r��d�|d|�D]}�d|��qn||k�r��dt||�d��d�G�fdd�d�}|�������fdd�}����fdd�}�����fdd�}�fdd�t��D�}|�r|�r*|���n|dd	�t|�fdd ��\}}�tjk	�rn�tjk�rn|}�qn ��k�r~d!}nd"t��j�}t|��|d#||d$d ��}|d%||d&d ��}|d'||d(d ��}|d)||d*d ��}|d+||d,d ��}|d-||d.d ��}|}�qd�|
�}
|
�s0|dS|d��|
��d/�dS)0NcSs
t||�Sr+r�)r:r�rrr�makename�sz"TextDoc.docclass.<locals>.makename�class z	 = class r�r4r�rrzMethod resolution order:r�rcss.|]&}|j�d�s|jdkrt|j�VqdS)rar�N)r&rcr'rJ)rsrrrrrr��s
�z#TextDoc.docclass.<locals>.<genexpr>r}r�zBuilt-in subclasses:z    ... and z other subclassescs eZdZdd�Z�fdd�ZdS)z(TextDoc.docclass.<locals>.HorizontalRulecSs
d|_dSrwr[r�rrrr��sz1TextDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�d�d|_dS)NzF----------------------------------------------------------------------rr[r�r\rrr^�sz.TextDoc.docclass.<locals>.HorizontalRule.maybeNr_rr\rrr`�sr`c
s�t||�\}}|r~����|�|D]V\}}}}zt�|�}Wn&tk
rf���||���Yq&X���||����q&|Sr+rbrd�rirQrr]r@rrrk�s�zTextDoc.docclass.<locals>.spillcsJt||�\}}|rF����|�|D]\}}}}���||���q&|Sr+rlrdrmrrrnsz*TextDoc.docclass.<locals>.spilldescriptorsc
	s�t||�\}}|r�����|�|D]v\}}}}t|�sDt�|�rNt|�}nd}zt�|�}	Wntk
r~|j|}	YnX��j	|	|�d|d�d�q&|S)Nr�)r6r#r)
rQr^rorrlrr>r��__dict__r�)
rer�rOrfr)rqrgrKr#rgr�rrrps 
�z#TextDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qSrqrrrsr/rrr�+s
�z$TextDoc.docclass.<locals>.<listcomp>rcs|d�kSrurrCrvrrr{4r|z"TextDoc.docclass.<locals>.<lambda>rxryzMethods %s:
cSs|ddkSrzrrCrrrr{Cr|zClass methods %s:
cSs|ddkSr|rrCrrrr{Er|zStatic methods %s:
cSs|ddkSr}rrCrrrr{Gr|zReadonly properties %s:
cSs|ddkSr~rrCrrrr{Ir|zData descriptors %s:
cSs|ddkSrrrCrrrr{Kr|zData and other attributes %s:
cSs|ddkSr�rrCrrrr{Mr|z |  )r&rDr'r��mapr"rrr�r�rrJrrr�r!�sortedr��__subclasses__r�rkr�rQr�rr*r�r�r)r@rr)rQrRr�r;r�rr<rr�r�r#r�rLZ
subclassesZno_of_subclassesZMAX_SUBCLASSES_TO_DISPLAYZsubclassnamer`rkrnrpr�r�r�r)rirQrr]r@rwrr��s�

�

��	
�

�

�
�
�
�
�
�
zTextDoc.docclasscCsd|�|�Sr�r�r�rrrr�WszTextDoc.formatvaluec	Cs�|j}|p|}d}d}t|�rn|jj}|rB||k	rndt||�}n,|jdk	r`dt|jj|�}ndt||�}t�|�s�t�|�r�d}	nd}	||kr�|�|�}
n,|r�t�	||g�|kr�d}|�|�d|}
d}t�
|��r<zt�|�}Wntt
fk
�rd}YnX|�r<t|�}|d	k�r<|�|�d
}
|dd�}|�sFd}|	|
||}
|�rd|
d
St|��ppd}|
d
|�o�|�|���d
SdS)Nrrr�r�r�r�r� = r�z lambda r�r�r)r&rAr;rr*rr�r�r�r�r.r�r�rrJrr�r)r@rr)rQrHr�r�r�r�r�rr�r�r�r#rrrr�[sV
�
�

zTextDoc.docroutinecCsTg}|j}|r$||�|��|d�t|�p.d}|rJ||�|��|d�d�|�S)Nrr)rr�rr�r"r�rrrr��szTextDoc.docdatac
Cs�|�|�}|rF|r|dpd|}|t|�}	|	dkrF|d|	�d}|rX|�|�dpZd|}|dk	r~|d|�t|��7}|S)Nr�rrr4r)r�r!r�r�rJ)
r@rr)rQr8r6r#r�r�Zchoprrrr��s
zTextDoc.docother)r�)Nr)NN)NN)NNN)NNN)NNNNN)r&r'rVr�r�r�r�r�rr6r�r�r�r�r�r�r�rrrrr�+s


e

7
r�c@seZdZdd�ZdS)�
_PlainTextDoccCs|Sr+rr�rrrr��sz_PlainTextDoc.boldN)r&r'rVr�rrrrr��sr�cCst�at|�dSr+)�getpager�pagerr9rrrr��sr�c	s@ttjd�stSttjd�s tStj��r4tj��s8tStj�d�pNtj�d���r�tj	dkrj�fdd�Stj�d�dkr��fd	d�S�fd
d�Stj�d�dkr�tStj	dkr�dd�Sttd�r�t�
d
�dkr�dd�Sddl}|��\}}t�
|�z8ttd��r$t�
d|�dk�r$dd�W�StW�SW5t�|�XdS)N�isattyZMANPAGERZPAGER�win32cstt|���Sr+��
tempfilepager�plainr9�Z	use_pagerrrr{�r|zgetpager.<locals>.<lambda>ZTERM)ZdumbZemacscstt|���Sr+)�	pipepagerr�r9r�rrr{�r|cs
t|��Sr+�r�r9r�rrr{�r|cSstt|�d�S)Nzmore <r�r9rrrr{�r|�systemz(less) 2>/dev/nullrcSs
t|d�S)NZlessr�r9rrrr{�r|z	more "%s"cSs
t|d�S)NZmorer�r9rrrr{�r|)rer�stdin�
plainpager�stdoutr�r
r�rx�platformr��tempfileZmkstemp�close�unlink�ttypager)r��fdr�rr�rr��s6


 r�cCst�dd|�S)Nz.r)rrr9rrrr��sr�c	Cs�ddl}|j|d|jd�}zDtj|jdd��*}z|�|�Wntk
rPYnXW5QRXWntk
rrYnXz|�	�Wq�Wqttk
r�YqtXqtdS)NrT)�shellr��backslashreplace)�errors)
�
subprocess�Popen�PIPE�io�
TextIOWrapperr��write�KeyboardInterruptr��wait)r1�cmdr��proc�piperrrr��sr�c
Cs~ddl}|���d}tj�|d�}t|ddtjdkr<t�d�ndd��}|�	|�W5QRXt�
|d|d�W5QRXdS)	Nrz	pydoc.out�wr�r�)r��encodingz "r%)r�ZTemporaryDirectoryr
r	r"r�rr��device_encodingr�r�)r1r�r�Ztempdirr�r�rrrr��s
��r�cCs$ttjdd�pd}|�|d��|�S)Nr��utf-8r�)r>rr��encode�decode)r1r�rrr�_escape_stdoutsr�c
Cs�tt|���d�}z2ddl}tj��}|�|�}|�|�dd�}Wn(t	t
tjfk
rld}dd�}YnX�z0zttj�dd��}Wntk
r�d}YnX|dkr�d}|d}}tj�d�|d|��d�||d��r�tj�d	�tj��|�}	|	d
k�rtj�d��q�n,|	dk�rJtj�d||d�|d}q�|	d
k�rn|||}|dk�rnd}tj�dd�||||��d�||}q�W5|�r�|�
||j|�XdS)NrrcSstj�d�SrB)rr�r�rrrrr{r|zttypager.<locals>.<lambda>cSstj��dd�dd�S)Nr�r)rr�r�rrrrr{r|ZLINESr�z
-- more --)�q�Qz
          
)�
r)�b�B�)r�r�r �ttyrr��filenoZ	tcgetattrZ	setcbreakr�r�r��UnsupportedOperationZ	tcsetattrZ	TCSAFLUSHr+r
r�rxr�r�r�r"�flush)
r1r$r�r��oldZgetchar�hr�Zincr:rrrr�	sL








&r�cCstj�tt|���dSr+)rr�r�r�r�r9rrrr�5sr�cCs�t�|�r>|jtjkr d|jSt|d�r4d|jSd|jSt�|�rRd|jSt�|�rtd|jj	|jj|jfSt�
|�r�d|jj	|jj|jfSt�|�r�d|jSt�|�r�d	|jSt�
|�r�d
|jSt|�jS)Nzbuilt-in module rTzpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%sr�z	function zmethod )rr,r&rr�rer=Zisgetsetdescriptor�__objclass__r'Zismemberdescriptorr-rMr<r�)�thingrrr�describe9s6







�
�





r�c	Cs�dd�|�d�D�}d\}}|t|�kr\td�|d|d��|�}|r\||d}}qq\q|rf|}nt}||d�D],}zt||�}Wqvtk
r�YdSXqv|S)NcSsg|]}|r|�qSrr)rsr�rrrr�Vszlocate.<locals>.<listcomp>rrwr)r r!r�r"r�r>r�)r	r�rSr��nZ
nextmodulerr�rrr�locateTs 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&)rmrJr�r�r>)r�r�rr)rrr�resolvems

�r�� Python Library Documentation: %scCs�|dkrt}t||�\}}t|�}t�|�}|rTd|krT|d|d|�d��7}n|rn||k	rn|d|j7}t�|�s�t�|�s�t�	|�s�t�
|�s�t|�}|d7}||d|�||�S)Nrz in z in module z objectr)
r1r�r�rrL�rfindr&r,r-r.rlr�r�)r�rr�Zrendererrr)r�r�rrr�
render_doc{s&

���rc
Csfz2|dkrtt|||��n|�t|||t��Wn.ttfk
r`}zt|�W5d}~XYnXdSr+)r�rr��	plaintextr�r��print)r�rr��outputrKrrrr#�sr#c
Cs�z`t||�\}}t�t|�t�||��}t|dddd��}|�|�W5QRXtd|d�Wn.tt	fk
r�}zt|�W5d}~XYnXdS)Nr�r�r�)r�Zwrote)
r��htmlrr�r�r�r�rr�r�)r�r�rr)rr�rKrrr�writedoc�srrcCs2|dkri}t�|g|�D]\}}}t|�qdSr+)rN�
walk_packagesr)r�pkgpathZdonerXr(rYrrr�	writedocs�s

r
cJ@s"eZdZddddddddddd	d
ddd
ddddddddddddddddddddd�#Zd d!�d"D�Zd�e�d'd(d)d*d+d,d-�Zd.d/d0d1d2d3d4d5d6d7d8d9d9d:d:d;�Ze��D]:\ZZ	e	D],Z
e�e
e�Zeekr�ed<eZeee
<q�q�d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdLdMdNdOdPdQddRdSdSdTdUdVdWdXdYdZd[d\d]d^d_d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{ddd|d}d~dd��IZd�d�d��Z
ed�d���Zed�d���Zd�d��Ze�Zefd�d��Zd�d��Zd�d��Zd�d��Zd�d��Zd�d�d��Zd�d��Zd�d��Zd�d��Zd�d�d��Zd�d�d��Zd�d��Zd�d�d��Z d�S)��Helperr�BOOLEAN�with)�assertr)�asyncr)�awaitr)�break�	while for)�classzCLASSES SPECIALMETHODS)�continuer)Zfunctionr)�del�BASICMETHODS�if)�elser�try)�forzbreak continue while�import)�globalznonlocal NAMESPACES)r�
TRUTHVALUE)r�MODULES)�in�SEQUENCEMETHODS�
COMPARISON)�lambdar�)�nonlocalzglobal NAMESPACES)�passr)�raise�
EXCEPTIONS)�returnr�)rr&)�whilezbreak continue if TRUTHVALUE)r
z CONTEXTMANAGERS EXCEPTIONS yield)�yieldr)#�False�None�True�and�asrrrrrr�defr�elifr�except�finallyr�fromrrrr�isr"r#�not�orr$r%r'rr(r
r)cCsg|]}dD]}||�qqS)��'r%r)rs�pr�rrrr��szHelper.<listcomp>)r��fr��ur8�'''r%r�)�+rt�*�**r�z//�%�<<�>>r��|�^�~r�r��<=�>=�==�!=�<>)r�r�rFrGrHrIrJ)rtrE)z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//=)rArBr�rCrDrE)�j�J)�STRINGS�	OPERATORSr!�UNARY�AUGMENTEDASSIGNMENT�BITWISE�COMPLEXzOPERATORS FORMATTING�POWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTS�ELLIPSISzSLICINGS DICTIONARYLITERALSz	def classrM�PRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ
BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)r@r?�,rr4�:�@r�rar`�`r&r5�[�]r�)�typeszRSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect)�stringsz4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES)zstring-methodszSTRINGS FORMATTING)Z
formatstringsrN)r]z: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 TYPES�TYPES)zbltin-null-objectr)zbltin-ellipsis-object�SLICINGS)Zspecialattrsr)r\z!class SPECIALMETHODS PRIVATENAMES)Ztypesmodulesr)zoperator-summaryz�lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES�EXPRESSIONS)Zobjectsr_)ZspecialnameszbBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES)Z
customizationzhash repr str SPECIALMETHODS)zattribute-accesszATTRIBUTES SPECIALMETHODS)zcallable-typeszCALLS SPECIALMETHODS)�sequence-typesz(SEQUENCES SEQUENCEMETHODS SPECIALMETHODS)rbzMAPPINGS SPECIALMETHODS)z
numeric-typesz*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS)Z	execmodelz%NAMESPACES DYNAMICFEATURES EXCEPTIONS)Znamingz3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES)zdynamic-featuresr�
NAMESPACES)r�ztry 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typesmapping�DICTIONARYLITERALS)rzDICTIONARIES LITERALS)zattribute-referencesz(getattr hasattr setattr ATTRIBUTEMETHODS)Z
subscriptionsr )Zslicingsr )Zcallsra)Zpowerra)Zunaryra)Zbinaryra)Zshiftingra)Zbitwisera)ZcomparisonszEXPRESSIONS BASICMETHODS)ZbooleanszEXPRESSIONS TRUTHVALUEr)Z
assignmentrP)Z	augassign�
NUMBERMETHODSrr')Zcompoundzfor while break continue)�truthz if while and or not BASICMETHODS)ZdebuggerZpdb)zcontext-managersr
)Ir_rMZ
STRINGMETHODSZ
FORMATTING�UNICODEZNUMBERSZINTEGERZFLOATrRrdZMAPPINGSr�ZMETHODSZCODEOBJECTSZTYPEOBJECTSZFRAMEOBJECTSZ
TRACEBACKSZNONErTZSPECIALATTRIBUTESr�rZPACKAGESrarNZ
PRECEDENCEZOBJECTSZSPECIALMETHODSrZATTRIBUTEMETHODSZCALLABLEMETHODSr ZMAPPINGMETHODSrgZ	EXECUTIONrcZDYNAMICFEATURESZSCOPINGZFRAMESr&ZCONVERSIONSZIDENTIFIERSZSPECIALIDENTIFIERSrUZLITERALSZTUPLESZ
TUPLELITERALSZLISTSrer^rfZ
ATTRIBUTESZ
SUBSCRIPTSr`ZCALLSrSrOZBINARYZSHIFTINGrQr!rZ	ASSERTIONZ
ASSIGNMENTrPZDELETIONZ	RETURNINGZ	IMPORTINGZCONDITIONALZLOOPINGrZ	DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dSr+)�_input�_output)r@�inputrrrrr�^szHelper.__init__cCs|jp
tjSr+)rjrr�r�rrrrlbszHelper.inputcCs|jp
tjSr+)rkrr�r�rrrrfsz
Helper.outputcCs2t��dddkr|�dSd|jj|jjfS)Nrr3�?rz<%s.%s instance>)r�stackrr'rVr�rrr�__repr__js�zHelper.__repr__cCs6||jk	r|�|�n|��|��|j�d�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�interactrr��r@Zrequestrrr�__call__rs

zHelper.__call__c	Cs�|j�d�z|�d�}|s Wq�Wnttfk
r>Yq�YnX|��}t|�dkr�|d|dkrpdkr�nn |d|dd�kr�|dd�}|��dkr�q�|d	kr�|��q|�	|�qdS)
Nrzhelp> rrr�r7r)r��quitr)
rr��getliner��EOFErrorrr!r�rqrrsrrrrrs"

,�
zHelper.interactcCs8|jtjkrt|�S|j�|�|j��|j��SdSr+)rlrr�rr�r�r�)r@�promptrrrrv�s

zHelper.getlinecCs<t|�td�k�r|��}|dkr,|��n�|dkr>|��n�|dkrP|��n�|dkrb|��n�|dd�dkr�|�|��d�n�||jkr�|�|�nj|d	kr�t	t
|�d
�nR||jkr�|�|�n<||j
kr�|�|�n&|r�t	|d
|jd�nt	td
|jd�n$t|t��r|�nt	|d
|jd�|j�d�dS)
Nr�keywords�symbols�topicsr��zmodules r)r,r*r+zHelp on %s:)rr)r�r�listkeywords�listsymbols�
listtopics�listmodulesr rz�
showsymbolr#�evalry�	showtopicr{rkrJrmrrr�rsrrrr�s6






zHelper.helpcCs$|j�d�dtjdd���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)rr�rrr�r�rrrrq�s
�zHelper.intror��Pc	
Cs�tt|��}||}t|�|d|}t|�D]v}t|�D]\}|||}|t|�kr<|j�||�||dkr<|j�dd|dt||��q<|j�d�q0dS)Nrr�r)rr�r!rrr�)	r@�items�columnsr
Zcolwr�rowrrtrrrr�s&zHelper.listcCs |j�d�|�|j���dS)NzN
Here is a list of the Python keywords.  Enter any keyword to get more help.

)rr�rryrGr�rrrr}�szHelper.listkeywordscCs |j�d�|�|j���dS)Nzx
Here is a list of the punctuation symbols which Python assigns special meaning
to. Enter any symbol to get more help.

)rr�rrzrGr�rrrr~�szHelper.listsymbolscCs |j�d�|�|j���dS)NzN
Here is a list of available topics.  Enter any topic name to get more help.

)rr�rr{rGr�rrrr�szHelper.listtopicscCs0zddl}Wn"tk
r.|j�d�YdSX|j�||j�|��}|sb|j�dt|��dSt|�td�kr~|�	||�S|\}}z|jj|}Wn*t
k
r�|j�dt|��YdSX|��d}|r�|p�dd|}|�r$ddl}dd�
|���d}	|�|	d	�}
|d
d�
|
�7}t|�dS)Nr�t
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
zno documentation found for %s
rrr��Related help topics: r4�Hz
%s
)�pydoc_data.topicsr�rr�r{rxryr�r�r��KeyErrorr�textwrapr"r Zwrapr�)r@�topic�
more_xrefs�
pydoc_data�target�label�xrefsr#r�r1Zwrapped_textrrrr��s4zHelper.showtopiccCs�zddl}Wntk
r"YdSX|j�||j�|��}|sFtd��t|t�r\|�||�S|\}}|jj|}|r�|pzdd|}||fS)Nr)r�rzcould not find topicrr�)	r�r�r{rxryr�rmrJ�	_gettopic)r@r�r�r�r�r�r�r#rrrr�s	
zHelper._gettopiccCs*|j|}|�d�\}}}|�||�dS)Nr�)rz�	partitionr�)r@�symbolr�r�rar�rrrr�!s
zHelper.showsymbolcsv|r |j�d�|��t|�nR|j�d�i}|fdd���fdd�}t�j�|d�|�|���|j�d�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}|�d�dkr:d||<dS)N����	.__init__r�rrr)�find)r	r(r�r�rrr�callback4sz$Helper.listmodules.<locals>.callbackcs�d|d�dSr+rr��r�rr�onerror9sz#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".
)rr�r�apropos�
ModuleScanner�runrrG)r@rJr�r�rr�rr�&s
�
zHelper.listmodules)r8r<r%r�)NN)r�r�)r)r)r)!r&r'rVryZ_strprefixesZ_symbols_inverserzr�r�Zsymbols_r�rxr{r�rnrlrrorrprtrrrvrrqrr}r~rr�r�r�r�rrrrr�sB�'���W



	


 
rc@seZdZddd�ZdS)r�Nc	Cs
|r|��}d|_i}tjD]p}|dkrd||<|dkrF|d|d�qt|�jpRd}|�d�d}|d|}|���|�dkr|d||�qtj	|d�D�]\\}	}}
|jr��q�|dkr�|d|d�q�zt�
|	|�}Wntk
r�Yq�YnX|j}t
|d	��rnz|�|�}
Wn(tk
�r:|�r2||�Yq�YnXtt�|
���pNd}t
|d
��rh|�|�}nd}n`ztj�|�}Wn(tk
�r�|�r�||�Yq�YnX|j�r�|j��dnd}t|dd�}|d|}|���|�dkr�||||�q�|�r|�dS)NF�__main__rrrrr�r��
get_source�get_filenamerR)r�rurr�r�r^r r�rNr�	_get_specr�r�rer�rcr�r��StringIOr�r�r�r�r�r�r>)r@r�rJZ	completerr��seenr(r)r�rXrYr�r��sourcer	r�rrrr�Gs`



zModuleScanner.run)NNN)r&r'rVr�rrrrr�Dsr�c	CsDdd�}dd�}t���"t�d�t�j|||d�W5QRXdS)NcSs6|dd�dkr |dd�d}t||o.d|�dS�Nr�r�r�z- )r�r	r(r�rrrr��szapropos.<locals>.callbackcSsdSr+rr�rrrr��szapropos.<locals>.onerror�ignorer�)�warnings�catch_warnings�filterwarningsr�r�)rJr�r�rrrr��s


r�cs�ddl�ddl�ddl�ddl�Gdd�d�jj��G�fdd�d�jj��G�����fdd�d�j�}||||�}|��|j	s�|j
s�t�d�q~|S)	Nrc@seZdZdd�Zdd�ZdS)z!_start_server.<locals>.DocHandlercSsX|j�d�rd}nd}|�d�|�dd|�|��|j�|�|j|��d��dS)Nz.css�text/css�	text/html��zContent-Typez%s; charset=UTF-8r�)	r	rdZ
send_responseZsend_headerZend_headersZwfiler��
urlhandlerr�)r@�content_typerrr�do_GET�s

��z(_start_server.<locals>.DocHandler.do_GETcWsdSr+r)r@r�rrr�log_message�sz-_start_server.<locals>.DocHandler.log_messageN)r&r'rVr�r�rrrr�
DocHandler�sr�cs(eZdZdd�Z�fdd�Zdd�ZdS)z _start_server.<locals>.DocServercSs6||_|j|f|_||_|j�||j|j�d|_dS�NF)�hostZaddressr�rLr��handlerru)r@r��portr�rrrr��s
z)_start_server.<locals>.DocServer.__init__cs>|js2��|j��gggd�\}}}|r|��q|��dSrB)ru�selectZsocketr�Zhandle_requestZserver_close)r@ZrdZwrZex�r�rr�serve_until_quit�s

z1_start_server.<locals>.DocServer.serve_until_quitcSs |j�|�|jr|�|�dSr+)rL�server_activater�r�rrrr��sz0_start_server.<locals>.DocServer.server_activateN)r&r'rVr�r�r�rr�rr�	DocServer�sr�cs:eZdZ�fdd�Z����fdd�Zdd�Zdd�Zd	S)
z#_start_server.<locals>.ServerThreadcs2||_||_t|�|_�j�|�d|_d|_dSr�)r�r�r+r��Threadr��serving�error)r@r�r�r�)�	threadingrrr��s
z,_start_server.<locals>.ServerThread.__init__c
sxzJ�jj�_��_�jj�_t|j��_�|j	|j
|j�}||_|�
�Wn(tk
rr}z
||_W5d}~XYnXdSr+)�server�
HTTPServerrLr�r�ZMessageZMessageClass�staticmethodr�r�r��ready�	docserverr�rcr�)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_|��d|_d|_d|_dS)NTF)r�rur"r�r"r�rrr�stop	s
z(_start_server.<locals>.ServerThread.stopN)r&r'rVr�r�r�r�r)r�r�r�r�r�rr�ServerThread�s
r�g{�G�z�?)
Zhttp.serverZ
email.messager�r�r�ZBaseHTTPRequestHandlerr�r�r1r�r��time�sleep)r��hostnamer�r��threadr)r�r�r�r�r�r�r�
_start_server�s8'r�r�c
s(G�fdd�dt�}|���fdd���fdd���fdd���fd	d
���fdd���fd
d���fdd���fdd����������fdd�}|�d�r�|dd�}|dk�rtj�tj�t��}tj�||�}t|��}d�|�	��W5QR�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@rr�css_pathZcss_link��html_navbarrrr2	s���z#_url_handler.<locals>._HTMLDoc.pageN)r&r'rVrrr�rr�_HTMLDoc0	sr�cs>��dt��t��dt��f�}d|��tjdd��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>
            T)Zterse)r�r�Zpython_versionZpython_buildZpython_compiler)rU�rrrr�B	s
��z!_url_handler.<locals>.html_navbarcs�dd�}��ddd�}dd�tjD�}��||�}|d��d	dd
|�g}i}tjD]}|���||��qT|�d�dd
�|�fS)NcSsd||fSrr�r)rrr�	bltinlink`	sz3_url_handler.<locals>.html_index.<locals>.bltinlinkz7<big><big><strong>Index of Modules</strong></big></big>rArBcSsg|]}|dkr|�qS)r�r)rsr)rrrr�f	s�z4_url_handler.<locals>.html_index.<locals>.<listcomp>z<p>zBuilt-in ModulesrFz|<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)	rrr�rrr	rr�r")r�r�namesrr�rr�rr�
html_index]	s*��
�z _url_handler.<locals>.html_indexc		s�g��fdd�}t���*t�d�dd�}t�j|||d�W5QRXdd�}g}��d	d
d�}�D]\}}|�||�|�qf|��d|d
d
d�|��}d|fS)Ncs:|dd�dkr |dd�d}��||o0d|f�dSr�rMr��Z
search_resultrrr�{	sz3_url_handler.<locals>.html_search.<locals>.callbackr�cSsdSr+rr�rrrr��	sz2_url_handler.<locals>.html_search.<locals>.onerrorr�cSsd||fSrrr�rrrr��	sz4_url_handler.<locals>.html_search.<locals>.bltinlinkz5<big><big><strong>Search Results</strong></big></big>rArBzkey = %srF�<br>zSearch Results)	r�r�r�r�r�rrrr")	rJr�r�r�rprr)r�rr�r�r�html_searchv	s,

��z!_url_handler.<locals>.html_searchcsLdd�}��ddd�}ttj���}��||�}|��ddd|�}d|fS)NcSsd||fS�Nz<a href="topic?key=%s">%s</a>rr�rrrr��	sz4_url_handler.<locals>.html_topics.<locals>.bltinlink�,<big><big><strong>INDEX</strong></big></big>rArBZTopicsrF)rr�rr{rGrr)r�rr�rr�rr�html_topics�	s��z!_url_handler.<locals>.html_topicscsL��ddd�}ttj���}dd�}��||�}|��ddd|�}d|fS)Nr�rArBcSsd||fSr�rr�rrrr��	sz6_url_handler.<locals>.html_keywords.<locals>.bltinlinkZKeywordsrF)rr�rryrGrr)rr�r�rr�rr�
html_keywords�	s��z#_url_handler.<locals>.html_keywordscs�t��}t||�}|�|�\}}||jkr0d}nd}��d|dd�}d��|�}��|dd|�}|r�t|�	��}dd	�}��
||�}��d
dd|�}d||fd�|||f�fS)
NZKEYWORDZTOPICr=rArBz
<pre>%s</pre>rFcSsd||fSr�rr�rrrr��	sz7_url_handler.<locals>.html_topicpage.<locals>.bltinlinkr�z%s %sr)
r�r�rr�ryrr3rr�r rrr")r�ZbufZhtmlhelprr�rrr�r�rr�html_topicpage�	s2

��
�z$_url_handler.<locals>.html_topicpagecs@t|dd�}|dkr$|dkr$td��t|�}��||�}||fS)Nr)r�r+zcould not find object)r�r�r�r�)r"rgr�contentr�rr�html_getobj�	sz!_url_handler.<locals>.html_getobjcsP��ddd�}d��fdd�tt|�|�D��}|��|dd|�}d||fS)	Nz,<big><big><strong>Error</strong></big></big>rArBr�c3s|]}��|�VqdSr+)r�r�r�rrr��	sz3_url_handler.<locals>.html_error.<locals>.<genexpr>z#bb0000z
Error - %s)rr"rr�r)r"r�rrr�rr�
html_error�	s���z _url_handler.<locals>.html_errorc
sr|}|�d�r|dd�}�z|dkr2��\}}n�|dkrF��\}}n�|dkrZ��\}}n�d|k�r$|�d�\}}}|dkr��|�\}}n�|dkr�z�|�\}}Wn tk
r��|�\}}YnXn\|d	k�r|dkr��\}}n4z�|�\}}Wn"tk
�r�|�\}}YnXntd
��n�|�\}}Wn2tk
�rd}z�||�\}}W5d}~XYnX��||�S)Nr����)rr�r{ryr�z
search?keyz	topic?keyzget?keyz
bad pydoc url)rdr�r�rcr)r"Zcomplete_urlrr��oprar�)rr�r�r�r�r�r�r�rr�
get_html_page�	s>



 z#_url_handler.<locals>.get_html_pager�rr�rr�z"unknown content type %r for url %s)rrcr
r	�dirname�realpathrRr"r��	readlinesr)r"r�r�r�Z	path_herer��fpr)	rr�r�r�r�r�r�r�r�r�_url_handler'	s*	
(


"
r�T�	localhost)�open_browserr�c	Cs�ddl}tt||�}|jr(t|j�dS|jr�d}|rB|�|j�z~zZtd|j�t|�|jr�t	d�}|�
�}|dkr|q�qZ|dkr�|�|j�qZt|�qZWnttfk
r�t�YnXW5|jr�|��td�XdS)Nrz"Server commands: [b]rowser, [q]uitzServer stoppedzServer ready atzserver> r�r�)
�
webbrowserr�r�r�rr�r�r"r�rlr�r�rw)r�r�r�r�ZserverthreadZserver_help_msgr�rrr�browse
s2
r�cCst|t�o|�tj�dkSrw)rmrJr�r
�sep)rPrrr�ispath9
sr�cCsvd|kstj|kst��|kr"dStj�t�}tj�|�}|��}||krbtj�||�sb|�|�|�	dt���|S)Nrr)
r
�curdir�getcwdr	r�rR�copy�samefile�remove�insert)Z
given_pathZargv0Z
stdlib_dirZ
script_dir�revised_pathrrr�_get_revised_path<
s

r�cCs,ttjtjd�}|dk	r(|tjdd�<dSrw)r�rr	�argv)r�rrr�_adjust_cli_sys_pathX
sr�cCs�ddl}Gdd�dt�}t��zv|�tjdd�d�\}}d}d}d}d}d}|D]\\}	}
|	dkrld	}d	}|	d
kr�t|
�WdS|	dkr�d	}|
}|	dkr�d	}|	d
krTd	}|
}qT|r�t|||d�WdS|s�|�|D]�}t|��rtj	�
|��std|��q�z`t|��r&tj	�|��r&t
|�}|�rXt|��rNtj	�|��rNt|�nt|�n
t�|�Wq�tk
�r�}zt|�W5d}~XYq�Xq�WnN|j|fk
�r�tj	�tj	�tjd��d}
tdj|
tjd��YnXdS)Nrc@seZdZdS)zcli.<locals>.BadUsageN)r&r'rVrrrr�BadUsagee
sr�rzbk:n:p:wFr�z-bTz-kz-pz-wz-n)r�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} -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.
)r�r�)�getoptrcr�rr�r�r�r�r
r	�existsrr�r�r
r
rrr�r�r�r�rr�)r�r�Zoptsr�ZwritingZstart_serverr�r�r��opt�val�argrKr�rrr�clib
sd

 �rr�)NN)r)r)rrN)rrN)r)rN)r�)r)YrGrYrUrSr�Zimportlib._bootstrapr�Zimportlib._bootstrap_external�importlib.machinery�importlib.utilrr�r
rNr�rrr�r�r�Zurllib.parserHr��collectionsr�reprlibr�	tracebackrrrr%r*r0r2r7r'�
IGNORECASEr8r:rArFrQrhrkr�r�r�r�rcr�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r1rrr�rr#rr
rrr�r�r�r�r�r�r�r�rr&rrrr�<module>'s�
	


'
0:*> ",

�
�


=
n%
U


?>