ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python38/lib64/python3.8/__pycache__/pydoc.cpython-38.pyc

U

@�?e̠�@s�dZdgZdZdZdZddlZddlZddlZddl	Zddl
ZddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZdd	lmZd
d�Zdd
�Zdd�Z dd�Z!dd�Z"dd�Z#dd�Z$e�%dej&�Z'dd�Z(dd�Z)dd�Z*dd �Z+dxd!d"�Z,d#d$�Z-d%d&�Z.d'd(�Z/d)d*�Z0ifd+d,�Z1Gd-d.�d.e2�Z3d/d0�Z4difd1d2�Z5Gd3d4�d4�Z6Gd5d6�d6e�Z7Gd7d8�d8e6�Z8Gd9d:�d:e�Z9Gd;d<�d<e6�Z:Gd=d>�d>e:�Z;d?d@�a<dAdB�Z=dCdD�Z>dEdF�Z?dGdH�Z@dIdJ�ZAdKdL�ZBdMdN�ZCdOdP�ZDdydQdR�ZEe:�ZFe;�ZGe8�ZHdzdSdT�ZId{dVdW�ZJd|dXdY�ZKd}dZd[�ZLd~d]d^�ZMGd_d`�d`�ZNeN�ZOGdadb�db�ZPdcdd�ZQdedf�ZRddhdi�ZSd�djdkdl�dmdn�ZTdodp�ZUdqdr�ZVdsdt�ZWdudv�ZXeYdwk�r�eX�dS)�aGenerate Python documentation in HTML or text for interactive use.

At the Python interactive prompt, calling help(thing) on a Python object
documents the object, and calling help() starts up an interactive
help session.

Or, at the shell command line outside of Python:

Run "pydoc <name>" to show documentation on something.  <name> may be
the name of a function, module, package, or a dotted reference to a
class or function within a module or module in a package.  If the
argument contains a path segment delimiter (e.g. slash on Unix,
backslash on Windows) it is treated as the path to a Python source file.

Run "pydoc -k <keyword>" to search for a keyword in the synopsis lines
of all available modules.

Run "pydoc -n <hostname>" to start an HTTP server with the given
hostname (default: localhost) on the local machine.

Run "pydoc -p <port>" to start an HTTP server on the given port on the
local machine.  Port number 0 can be used to get an arbitrary unused port.

Run "pydoc -b" to start an HTTP server on an arbitrary unused port and
open a Web browser to interactively browse documentation.  Combine with
the -n and -p options to control the hostname and port used.

Run "pydoc -w <name>" to write out the HTML documentation for a module
to a file named "<name>.html".

Module docs for core modules are assumed to be in

    https://docs.python.org/X.Y/library/

This can be overridden by setting the PYTHONDOCS environment variable
to a different URL or to a local directory containing the Library
Reference Manual pages.
�helpzKa-Ping Yee <ping@lfw.org>z26 February 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)zAConvert sys.path into a list of absolute, existing, unique paths.�.)�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)z-Get the doc string or comments for an object.z^ *
�)�inspect�getdocZgetcomments�re�sub�rstrip)�object�resultrrrr\srcCsf|���d�}t|�dkr&|ddfSt|�dkrX|d��sX|dd�|dd��fSdd�|�fS)z>Split a doc string into a synopsis line (if any) and the rest.�
�rr�N)�strip�split�lenr�join)�doc�linesrrr�splitdocasr$cCs"|j}|j|kr|jd|}|S)z@Get a class name and qualify it with a module name if necessary.r)�__name__�
__module__)r�modname�namerrr�	classnamejs
r)cCs>t�|�p:t�|�p:t�|�p:t�|�p:t�|�p:t�|�S)z>Check if an object is of a type that probably means it's data.)r�ismodule�isclass�	isroutineZisframeZistracebackZiscode�rrrr�isdataqs����r.cGs.|r*|d�|�|d��}|dd�}q|S)z/Do a series of global replacements on a string.rrrN)r!r)�textZpairsrrr�replacewsr0cCsXt|�|krTtd|dd�}td|d|�}|d|�d|t|�|d�S|S)zCOmit part of a string if needed to make it fit in a maximum length.r�rN�...)r �max)r/�maxlenZpreZpostrrr�cram~s
$r5z at 0x[0-9a-f]{6,16}(>+)$cCst�d|�S)z>Remove the hexadecimal id from a Python object representation.z\1)�_re_stripidr�r/rrr�stripid�sr8cCs<t�|�rdSt�|�r8t|dd�}t�|�p4|dkSdS)zo
    Returns True if fn is a bound method, regardless of whether
    fn was implemented in Python or in C.
    T�__self__NF)r�ismethod�	isbuiltin�getattrr*)�fn�selfrrr�_is_bound_method�s

r?cCs^i}t�|tj�D]\}}d||<q|jD]}|�t|��q*|��D]}t||�||<qF|S�Nr)r�
getmembersr,�	__bases__�update�
allmethods�keysr<)�cl�methods�key�value�baserrrrD�s

rDcCs8g}g}|D]"}||�r$|�|�q|�|�q||fS)z�Split sequence s via predicate, and return pair ([true], [false]).

    The return value is a 2-tuple of lists,
        ([x for x in s if predicate(x)],
         [x for x in s if not predicate(x)])
    �r
)�s�	predicateZyesZno�xrrr�_split_list�srOcCs\|dkrdS|�d�r$|�d�r$dS|�d�r<t|d�r<dS|dk	rL||kS|�d�SdS)	z3Decide whether to show documentation on a variable.>�__path__�__spec__�	__slots__�__builtins__�
__author__�__version__r&�__file__r%�
__cached__�__doc__�__credits__�
__loader__�__qualname__�__package__�__date__r�__r�_�_fieldsTN)�
startswith�endswith�hasattr)r(�all�objrrr�visiblename�srfcCsXg}t�|�D]D\}}}}t�|�r@d}t|t�r@|jdkr@d}|�||||f�q|S)zCWrap inspect.classify_class_attrs, with fixup for data descriptors.�data descriptorN�readonly property)r�classify_class_attrs�isdatadescriptor�
isinstance�property�fsetr
)r�resultsr(�kind�clsrIrrrri�s
rics\t|dg��z�fdd�t��D��Wntk
r>i�YnX�fdd�}|j|d�dS)zGSort the attrs list in-place by _fields and then alphabetically by namer`csi|]\}}||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>�rHN)r<�	enumerate�	TypeError�sort)�attrsrZkeyfuncr)rxrsr�sort_attributes�s
r�cCs:tj�|�r6dD]$}tj�tj�|d|��rdSqdS)z3Guess whether a path refers to a package directory.)z.pyz.pyc�__init__TF)r	rr�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"""r1�"""����\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)z.Get the one-line summary out of a module file.)NNNZ__temp__��loaderr)r	�stat�st_mtimervrb�tuple�	importlib�	machinery�BYTECODE_SUFFIXES�SourcelessFileLoader�EXTENSION_SUFFIXES�ExtensionFileLoader�tokenize�open�OSErrorr��util�spec_from_file_location�
_bootstrap�_loadr�modulesrX�
splitlines)
�filename�cache�mtimeZ
lastupdaterZ
loader_clsr�r��spec�modulerrr�synopsis�s6



�r�c@s eZdZdZdd�Zdd�ZdS)�ErrorDuringImportzEErrors that occurred while trying to import something to document it.cCs||_|\|_|_|_dS�N)r��excrI�tb)r>r��exc_inforrrr�#szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)r�r%r�rI)r>r�rrr�__str__'szErrorDuringImport.__str__N)r%r&r[rXr�r�rrrrr�!sr�c		Cs�tjj}t|d��}||�t|��k}W5QRXtj�|�}tj�	|�\}}|r`tj
�||�}ntj
�||�}tjj
|||d�}ztj�|�WSt|t����YnXdS)z<Import a Python source file or compiled file given its path.�rbr�N)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)a�Import a module; handle errors; return None if the module isn't found.

    If the module *is* found but an exception occurs, it's wrapped in an
    ErrorDuringImport exception and reraised.  Unlike __import__, if a
    package path is specified, the module at the end of the path is returned,
    not the package at the beginning.  If the optional 'forceload' argument
    is 1, we reload the module from disk (unless it's a dynamic extension).csg|]}|��d�r|�qS)r)ra)rq�m�rrr�
<listcomp>Qszsafeimport.<locals>.<listcomp>Nrr)rr��builtin_module_names�
__import__r�r�rV�SyntaxErrorr��
issubclass�ImportErrorr(rr<�AttributeError)r�	forceloadr�ZsubsrHr�r�rIr��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
|�S)z%Generate documentation for an object.)rr*�	docmoduler+�docclassr,�
docroutiner�rj�docdata�docother)r>rr(�argsrrr�documentss




zDoc.documentcGs*d|odt|�t|�jf}t|��dS)z+Raise an exception for unimplemented types.z.don't know how to document object%s of type %s� N)�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)z*Return the location of module docs or None�
(built-in)r�)
�errno�
exceptionsZgcZimp�marshal�posix�signalr�_threadZ	zipimportz
site-packages)z	xml.etreeztest.pydoc_mod)zhttp://zhttps://z%s/%s�/�.htmlN)r�
getabsfiler}r	�environrvr�rrrkr�r%rar!r�lower)r>rZbasedirr��doclocrrr�	getdocloc�s(
����
z
Doc.getdocloc)N)N)r%r&r[r	r�rvr�version_infor�r�r�r�r�r�r��docpropertyr��	sysconfigZget_pathr�rrrrr�ms��

r�c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZeZ	dd
�Z
eZdS)�HTMLReprzBClass for safely making an HTML representation of a Python object.cCs,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;)r0�r>r/rrr�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_r_)rcr�r!r%rr<r�r5r8r�r��r>rN�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>)r5r�r�r0r�rr�r>rNr�ZtestZtestreprrrr�repr_string�s�zHTMLRepr.repr_stringcCs@z|�ttt|��|j��WS|�d|jj�YSXdS�Nz
<%s instance>)r�r5r8r�r��	__class__r%�r>rNr�rrr�
repr_instance�szHTMLRepr.repr_instanceN)r%r&r[rXr�r�r�r�r��repr_strrZrepr_unicoderrrrr��sr�c@seZdZdZe�ZejZejZdd�Zd1dd�Z	d2d
d�Z
dd
�Zdd�Zd3dd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdiiifdd �Zd4d!d"�Zd5d#d$�Zddiifd%d&�Zd'd(�Zddiiidfd)d*�Zd6d+d,�ZeZd7d-d.�Zd8d/d0�ZdS)9�HTMLDocz'Formatter class for HTML documentation.cCsd||fS)�Format an HTML page.z�<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
%s
</body></html>r)r>�title�contentsrrr�page�s�zHTMLDoc.pagercCsd|||||pdfS)zFormat a page heading.a'
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="%s">
<td valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">&nbsp;<br>%s</font></td
><td align=right valign=bottom
><font color="%s" face="helvetica, arial">%s</font></td></tr></table>
    �&nbsp;r)r>r�fgcol�bgcolZextrasrrr�heading�s�zHTMLDoc.heading�Nrc	
Cs^|dkrdd|d}d|||f}	|r@|	d||||f}	n|	d|||f}	|	d|S)	z Format a section with a heading.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)z$Format a section with a big heading.z<big><strong>%s</strong></big>)r)r>rr�rrr�
bigsectionszHTMLDoc.bigsectionc
Cs&|�|���}t|dddddddd�	S)z!Format literal preformatted text.�

z
 
r�rr�<br>
)r��
expandtabsr0r�rrr�	preformat
s�zHTMLDoc.preformatr�cCs�d}t|�|d|}t|�D]X}|dd|}t|||||�D]$}|t|�krJ||||�d}qJ|d}q d|S)z0Format a list of items into a multi-column list.rrz<td width="%d%%" valign=top>r�rz</td>z7<table width="100%%" summary="list"><tr>%s</tr></table>)r �range)r>�list�formatZcolsr�rows�colrrrrr�multicolumns
zHTMLDoc.multicolumncCsd|S)Nz<font color="#909090">%s</font>rr�rrr�greyrzzHTMLDoc.greycGs*|D] }||krd|||fSq|S)z:Make a link for an identifier, given name-to-URL mappings.�<a href="%s">%s</a>r)r>r(Zdicts�dictrrr�namelinkszHTMLDoc.namelinkcCsN|jtj�|j�}}t||�rDt||�|krDd|j|t||�fSt||�S)zMake a link for a class.z<a href="%s.html#%s">%s</a>)r%rr�rvr&rcr<r))r>rr'r(r�rrr�	classlink%s�zHTMLDoc.classlinkcCsd|j|jfS)zMake a link for a module.�<a href="%s.html">%s</a>)r%r�rrr�
modulelink-szHTMLDoc.modulelinkcCsR|\}}}}|r|�|�S|r,d||f}nd|}|rBd|}n|}d||fS)z;Make a link for a module or package to display in an index.z
%s.%s.htmlz%s.htmlz"<strong>%s</strong>&nbsp;(package)r)r)r>Z
modpkginfor(rr��shadowed�urlr/rrr�
modpkglink1s

zHTMLDoc.modpkglinkcCsd||fS)zMake a link to source file.z<a href="file:%s">%s</a>r)r>r"rrrr�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)z�Mark up some plain text, given a context of symbols to look for.
        Each context dictionary maps object names to anchor names.rzD\b((http|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?(\w+))�"z&quot;rz'http://www.rfc-editor.org/rfc/rfc%d.txtz(http://www.python.org/dev/peps/pep-%04d/r�(zself.zself.<strong>%s</strong>Nr)r�r�compile�search�spanr
�groupsr0�intrr!)r>r/r��funcs�classesrGrn�here�pattern�match�start�endrdZschemeZrfcZpepZselfdotr(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)
zAProduce HTML for a class tree as given by inspect.getclasstree().rrz"<dt><font face="helvetica, arial">r&�, �)z
</font></dt>z
<dd>
%s</dd>
z
<dl>
%s</dl>
)r�rr
r!�
formattree)
r>�treer'�parentr�entry�c�bases�parentsrJrrrr6os&
�
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�dk�r"|d	d���}|�d��|��t|d
��rX|���t|j���|�rp|
dd�|�}
��|�}|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��}!|��0d dd|!�}|�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)/z/Produce HTML documentation for a module object.Nrrz5<a href="%s.html"><font color="#ffffff">%s</font></a>r��)<big><big><strong>%s</strong></big></big>r�rU��$Revision: �$z
version %sr]z (%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>
rPrzPackage Contentsz#aa55cccs��|d�Sr@)r ��tr�rrry�rzz#HTMLDoc.docmodule.<locals>.<lambda>ZModulescSsg|]\}}|�qSrr�rqrHrIrrrr��sz%HTMLDoc.docmodule.<locals>.<listcomp>ZClasses�#ee77aar�Z	Functionsz#eeaa77ZDataz#55aa55rrTZAuthorrYZCredits)6r%�__all__r�rrr r
r!rr��urllib�parseZquoter$r}rc�strrUrr�r]r��localsrrAr*r+�	getmodulerfrBr&rr�rvr<r,r;�
isfunctionr.r3rr�pkgutil�iter_modulesrPr~rr#rr6�getclasstreer�rTrY)#r>rr(�mod�ignoredrd�partsZlinksrrZ
linkedname�headrr"r$r��versionr�rr�r-ZcdictrHrIrJr'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�|�rx|�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��}|gk�spt�|}�q\d#�|	�}	||k�r�d$||f}nd%|||f}|�r�g}|D]}|���|�j	���q�|d&d'�|�}d#}zt���}Wntt
fk
�rd(}YnX|�rFt|�}|�rF|d)k�rF|��|�d*}t��}|�rb||�p^d#}��|�j����}|�o�d+|}��|d,d-|	d.|�S)/z.Produce HTML documentation for a class object.cs eZdZdd�Z�fdd�ZdS)z(HTMLDoc.docclass.<locals>.HorizontalRulecSs
d|_dSru�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&r[r�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�rOr^r<�	Exceptionr�r���msgrrM�okr(ro�homeclsrI�r-r,�hr�mdictrQrr]r>rr�spills"�
zHTMLDoc.docclass.<locals>.spillcsJt||�\}}|rF����|�|D]\}}}}���||���q&|Sr��rOr^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)NrXz<dl><dt>%s</dl>
z<dd><tt>%s</tt>z<dl><dt>%s%s</dl>
r)
rOr^r�r<�callablerrjr3rr)
rerrMrfr(rorgrIrJr"rhrr�	spilldata4s(�
z#HTMLDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qS�)re�rf�rqr(rorprIr-rrr�Is
�z$HTMLDoc.docclass.<locals>.<listcomp>r��-rcs|d�kS�NrrrC��	thisclassrrrybrzz"HTMLDoc.docclass.<locals>.<lambda>�defined here�inherited from %sz:<br>
z
Methods %scSs|ddkS�Nr�methodrrCrrrryrrzzClass methods %scSs|ddkS�Nrzclass methodrrCrrrrytrzzStatic methods %scSs|ddkS�Nrz
static methodrrCrrrryvrzzReadonly properties %scSs|ddkS�NrrhrrCrrrryxrzzData descriptors %scSs|ddkS�NrrgrrCrrrryzrzzData and other attributes %scSs|ddkS�NrrVrrCrrrry|rzrz*<a name="%s">class <strong>%s</strong></a>z/<strong>%s</strong> = <a name="%s">class %s</a>�(%s)r4N�()rz<tt>%s<br>&nbsp;</tt>z#000000z#ffc8d8r1)r%rBr
rr�getmror r^rr&rir<rcr}�popleftrO�builtinsrr��AssertionErrorr!�	signature�
ValueErrorrJr�rr3rr)r>rr(rQr,r-rR�realnamer;rr`�mrorJrkrnrprrHrorgrI�anchor�	inherited�tagrr<�declr��argspecr"r)	r-r,rirjrQrr]r>rwrr��s�
�
	
�

�

�
�
�
�
�
�

��
zHTMLDoc.docclasscCs|�d|�|��S�z)Format an argument default value as text.�=)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|}|dd�}|�svd}|
||�|�|
�o�|�d|
�}|�r�d|S|�t|�|j|||�}|�o�d|}d||fSdS)z;Produce HTML documentation for a function or method object.rrtr� from N� 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%r?r9r�rr�iscoroutinefunction�isasyncgenfunction�getattr_staticr,r�r�r}rJr�rr3rr)r>rr(rQr,r-rGrFr�r��note�skipdocs�imclass�asyncqualifierrZreallinkr�r�r�r"rrrr��s|
�
���

��zHTMLDoc.docroutinecCsNg}|j}|r|d|�|�t|�|j�}|r<|d|�|d�d�|�S)z1Produce html documentation for a data descriptor.z!<dl><dt><strong>%s</strong></dt>
z<dd><tt>%s</tt></dd>
rar)r
r3rrr!�r>rr(rQrFrnr]r"rrrr��szHTMLDoc.docdatacGs|rd|pd}||�|�S)z-Produce HTML documentation for a data object.z<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)z2Generate an HTML index for a directory of modules.Ncss*|]"}dt|�kodknVqdS)i�i��N)�ord�rqZchrrr�	<genexpr>�sz HTMLDoc.index.<locals>.<genexpr>rrrArF)rNrO�anyr
r~rr#r)r>rr!rWrXr(rYrrrr�index�s
z
HTMLDoc.index)r)rrNr)r�)N)NN)NNN)NN)N)r%r&r[rXr��_repr_instancer�r�rrrrrrrrrr r#r$r3r6r�r�r�r�r�r�r�r�rrrrr�sH

�

+

y&�
A

rc@s4eZdZdZdd�Zdd�Zdd�ZeZdd	�Zd
S)�TextReprzAClass for safely making a text representation of a Python object.cCs,t�|�d|_|_d|_d|_|_dSr�r�r�rrrr�
s
zTextRepr.__init__cCsTtt|�d�r@dd�t|�j���}t||�r@t||�||�Sttt|��|j	�Sr�)
rcr�r!r%rr<r5r8r�r�r�rrrr�s

zTextRepr.repr1cCsHt||j�}t|�}d|krDdt|dd�krDd|d||dS|S)Nr�r�rr�r)r5r�r�r0r�rrrr�s
zTextRepr.repr_stringcCs4zttt|��|j�WSd|jjYSXdSr�)r5r8r�r�r�r%rrrrr%szTextRepr.repr_instanceN)	r%r&r[rXr�r�r�rrrrrrr�s	r�c@s~eZdZdZe�ZejZdd�Zddd�Zdd�Z	ddd�Z
dd
d�Zddd�Zdd�Z
ddd�Zddd�ZeZddd�Zd	S) �TextDocz'Formatter class for text documentation.cCsd�dd�|D��S)z(Format a string in bold by overstriking.rcss|]}|d|VqdS)�Nrr�rrrr�5szTextDoc.bold.<locals>.<genexpr>)r!r�rrr�bold3szTextDoc.bold�    cs>|sdS�fdd�|�d�D�}|r4|d��|d<d�|�S)z6Indent text by prepending a given prefix to each line.rcsg|]}�|�qSrr�rqr���prefixrrr�:sz"TextDoc.indent.<locals>.<listcomp>rr�)rrr!)r>r/r�r#rr�r�indent7szTextDoc.indentcCs$|�|���}|�|�d|dS)z&Format a section with a given heading.rr)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)	zBRender in text a class tree as returned by inspect.getclasstree().rrc3s|]}t|��VqdSr��r))rqr:�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�dd�|	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)$z5Produce text documentation for a given module object.�NAME� - rGNzMODULE 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.
ZDESCRIPTIONrP�
 (package)zPACKAGE CONTENTSrrZ
SUBMODULEScSsg|]\}}|�qSrrrErrrr��sz%TextDoc.docmodule.<locals>.<listcomp>r�CLASSES�	FUNCTIONS�F)r4ZDATArUr>r?r�r@ZVERSIONr]ZDATErTZAUTHORrYZCREDITSr�ZFILE)%r%r$rrr<r�rrAr+rLrfr
r,r;r.�setrcrNrOrP�addr~r!r*rar6rPr�r�rJrUrr]rTrYr�r})r>rr(rQZsynop�descrrdr�r-rHrIr,rVrWZ
modpkgs_namesrXr'rYZ
submodulesrZrrUr�rrrr�Us�
	�
��
��
�
$
zTextDoc.docmodulec	sZ�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
�tdd�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|�fd d!��\}}�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!��}|gk�st�|}�qd	�|
�}
|
�s>|d	S|d	��|
��d0�d	S)1z4Produce text documentation for a given class object.cSs
t||�Sr�r�)r:r�rrr�makename�sz"TextDoc.docclass.<locals>.makename�class z	 = class r�r4Nr�rrzMethod resolution order:r�rcss.|]&}|j�d�s|jdkrt|j�VqdS)r_r�N)r%rar&rJ)rqrprrrr��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|_dSrur[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�)r4r"r)
rOr^rorrjrr<r��__dict__r�)
rerrMrfr(rorgrIr"rer�rrrps 
�z#TextDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qSrqrrrsr-rrr�+s
�z$TextDoc.docclass.<locals>.<listcomp>rcs|d�kSrurrCrvrrry4rzz"TextDoc.docclass.<locals>.<lambda>rxryzMethods %s:
cSs|ddkSrzrrCrrrryCrzzClass methods %s:
cSs|ddkSr|rrCrrrryErzzStatic methods %s:
cSs|ddkSr}rrCrrrryGrzzReadonly properties %s:
cSs|ddkSr~rrCrrrryIrzzData descriptors %s:
cSs|ddkSrrrCrrrryKrzzData and other attributes %s:
cSs|ddkSr�rrCrrrryMrzz |  )r%rBr&r��mapr!r
rr�r�r}rJrrr�r �sortedr��__subclasses__r�rir�rOr�rr)r�r�r�r)r>rr(rQrRr�r;r�rr<rr�r�r"r�rJZ
subclassesZno_of_subclassesZMAX_SUBCLASSES_TO_DISPLAYZsubclassnamer`rkrnrprr�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|
dSt|��ppd}|
d|�o�|�|���dSdS)z;Produce text documentation for a function or method object.rrr�Nr�r�r�r� = r�z lambda r�r�r)r%r?r9r�r)rr�r�r�r�r,r�r�r}rJrr�r)r>rr(rQrFr�r�r�r�r�rr�r�r�r"rrrr�[sV
�
�

zTextDoc.docroutinecCsTg}|j}|r$||�|��|d�t|�p.d}|rJ||�|��|d�d�|�S)z1Produce text documentation for a data descriptor.rr)r
r�rr�r!r�rrrr��szTextDoc.docdatac
Cs�|�|�}|rF|r|dpd|}|t|�}	|	dkrF|d|	�d}|rX|�|�dpZd|}|dk	r~|d|�t|��7}|S)z-Produce text documentation for a data object.r�rrNr2r)r�r r�r�rJ)
r>rr(rQr8r4r"r�r�Zchoprrrr��s
zTextDoc.docother)r�)Nr)NN)NN)NNN)NNN)NNNNN)r%r&r[rXr�r�r�r�r�rr6r�r�r�r�r�r�r�rrrrr�+s


e

7
r�c@seZdZdZdd�ZdS)�
_PlainTextDocz2Subclass of TextDoc which overrides string stylingcCs|Sr�rr�rrrr��sz_PlainTextDoc.boldN)r%r&r[rXr�rrrrr��sr�cCst�at|�dS)zCThe first time this is called, determine what kind of pager to use.N)�getpager�pagerr7rrrr��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)z2Decide what method to use for paging through text.�isattyZMANPAGERZPAGER�win32cstt|���Sr���
tempfilepager�plainr7�Z	use_pagerrrry�rzzgetpager.<locals>.<lambda>ZTERM)ZdumbZemacscstt|���Sr�)�	pipepagerr�r7r�rrry�rzcs
t|��Sr��r�r7r�rrry�rzcSstt|�d�S)Nzmore <r�r7rrrry�rz�systemz(less) 2>/dev/nullrcSs
t|d�S)NZlessr�r7rrrry�rzNz	more "%s"cSs
t|d�S)NZmorer�r7rrrry�rz)rcr�stdin�
plainpager�stdoutr�r	r�rv�platformr��tempfileZmkstemp�close�unlink�ttypager)r��fdr�rr�rr��s6


 r�cCst�dd|�S)z%Remove boldface formatting from text.z.r)rrr7rrrr��sr�c	Cs�ddl}|j|d|jd�}zDtj|jdd��*}z|�|�Wntk
rPYnXW5QRXWntk
rrYnXz|�	�Wq�Wqttk
r�YqtXqtdS)z3Page through text by feeding it to another program.rNT)�shellr��backslashreplace)�errors)
�
subprocess�Popen�PIPE�io�
TextIOWrapperr��write�KeyboardInterruptr��wait)r/�cmdr��proc�piperrrr��sr�c
Cs~ddl}|���d}tj�|d�}t|ddtjdkr<t�d�ndd��}|�	|�W5QRXt�
|d|d	�W5QRXdS)
z<Page through text by invoking a program on a temporary file.rNz	pydoc.out�wr�r�)r��encodingz "r%)r�ZTemporaryDirectoryr	rr!r�rr��device_encodingr�r�)r/r�r�Ztempdirr�r�rrrr��s
��r�cCs$ttjdd�pd}|�|d��|�S)Nr��utf-8r�)r<rr��encode�decode)r/r�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��|�}	|	dk�rtj�d��q�n,|	d
k�rJtj�d||d�|d}q�|	dk�rn|||}|dk�rnd}tj�dd�||||��d�||}q�W5|�r�|�
||j|�XdS)z%Page through text on a text terminal.rrNcSstj�d�Sr@)rr�r�rrrrryrzzttypager.<locals>.<lambda>cSstj��dd�dd�S)Nr�r)rr�r�rrrrryrzZLINESr�z
-- more --)�q�Qz
          
)�
r)�b�B�)r�r�r�ttyrr��filenoZ	tcgetattrZ	setcbreakr�r�r��UnsupportedOperationZ	tcsetattrZ	TCSAFLUSHr+r	r�rvr�r�r�r!�flush)
r/r#r�r��oldZgetchar�hr�Zincr:rrrr�	sL








&r�cCstj�tt|���dS)z>Simply print unformatted text.  This is the ultimate fallback.N)rr�r�r�r�r7rrrr�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)z/Produce a short description of the given thing.zbuilt-in module rPzpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%sr�z	function zmethod )rr*r%rr�rcr;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)z@Locate an object by name or dotted path, importing as necessary.cSsg|]}|r|�qSrr)rqr�rrrr�Vszlocate.<locals>.<listcomp>rruNr)rr r�r!r�r<r�)rr�rSr��nZ
nextmodulerr�rrr�locateTs r�cCsVt|t�r0t||�}|dkr(td|��||fSt|dd�}|t|t�rL|ndfSdS)zDGiven an object or a path to an object, get the object and its name.Nz~No Python documentation found for %r.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.r%)rkrJr�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)zBRender text documentation, given an object or a path to an object.Nrz in z in module z objectr)
r/rr�rrL�rfindr%r*r+r,rjr�r�)r�rr�Zrendererrr(r�r�rrr�
render_doc{s&

���rc
Csfz2|dkrtt|||��n|�t|||t��Wn.ttfk
r`}zt|�W5d}~XYnXdS)zCDisplay text documentation, given an object or a path to an object.N)r�rr��	plaintextr�r��print)r�rr��outputrIrrrr"�sr"c
Cs�z`t||�\}}t�t|�t�||��}t|dddd��}|�|�W5QRXtd|d�Wn.tt	fk
r�}zt|�W5d}~XYnXdS)z<Write HTML documentation to a file in the current directory.r�r�r�)r�ZwroteN)
r�htmlrr�r�r�r�rr�r�)r�r�rr(rr�rIrrr�writedoc�srrcCs2|dkri}t�|g|�D]\}}}t|�qdS)zAWrite out HTML documentation for all modules in a directory tree.N)rN�
walk_packagesr)r�pkgpathZdonerXr'rYrrr�	writedocs�s

rcJ@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)rz CONTEXTMANAGERS EXCEPTIONS yield)�yieldr)#�False�None�True�and�asrrrrrr�defr�elifr�except�finallyr�fromrrrr �isr#r$�not�orr%r&r(rr)rr*cCsg|]}dD]}||�qqS)��'r%r)rq�pr�rrrr��szHelper.<listcomp>)r��fr��ur9�'''r%r�)�+rt�*�**r�z//�%�<<�>>r��|�^�~r�r��<=�>=�==�!=�<>)r�r�rGrHrIrJrK)rtrF)z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//=)rBrCr�rDrErF)�j�J)�STRINGS�	OPERATORSr"�UNARY�AUGMENTEDASSIGNMENT�BITWISE�COMPLEXzOPERATORS FORMATTING�POWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTS�ELLIPSISzSLICINGS DICTIONARYLITERALSz	def classrN�PRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ
BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)rAr@�,rr2�:�@r�r_r^�`r&r5�[�]r�)�typeszRSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect)�stringsz4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES)zstring-methodszSTRINGS FORMATTING)Z
formatstringsrO)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)rczMAPPINGS 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!)Zcallsrb)Zpowerrb)Zunaryrb)Zbinaryrb)Zshiftingrb)Zbitwiserb)ZcomparisonszEXPRESSIONS BASICMETHODS)ZbooleanszEXPRESSIONS TRUTHVALUEr)Z
assignmentrQ)Z	augassign�
NUMBERMETHODSrr()Zcompoundzfor while break continue)�truthz if while and or not BASICMETHODS)ZdebuggerZpdb)zcontext-managersr)Ir`rNZ
STRINGMETHODSZ
FORMATTING�UNICODEZNUMBERSZINTEGERZFLOATrSreZMAPPINGSr�ZMETHODSZCODEOBJECTSZTYPEOBJECTSZFRAMEOBJECTSZ
TRACEBACKSZNONErUZSPECIALATTRIBUTESr�rZPACKAGESrbrOZ
PRECEDENCEZOBJECTSZSPECIALMETHODSrZATTRIBUTEMETHODSZCALLABLEMETHODSr!ZMAPPINGMETHODSrhZ	EXECUTIONrdZDYNAMICFEATURESZSCOPINGZFRAMESr'ZCONVERSIONSZIDENTIFIERSZSPECIALIDENTIFIERSrVZLITERALSZTUPLESZ
TUPLELITERALSZLISTSrfr_rgZ
ATTRIBUTESZ
SUBSCRIPTSraZCALLSrTrPZBINARYZSHIFTINGrRr"r
Z	ASSERTIONZ
ASSIGNMENTrQZDELETIONZ	RETURNINGZ	IMPORTINGZCONDITIONALZLOOPINGrZ	DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dSr�)�_input�_output)r>�inputrrrrr�^szHelper.__init__cCs|jp
tjSr�)rkrr�r�rrrrmbszHelper.inputcCs|jp
tjSr�)rlrr�r�rrrrfsz
Helper.outputcCs2t��dddkr|�dSd|jj|jjfS)Nrr1�?rz<%s.%s instance>)r�stackr�r&r[r�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�r8r)r��quitr)
rr��getliner��EOFErrorrr r�rrrrtrrrrss"

,�
zHelper.interactcCs8|jtjkrt|�S|j�|�|j��|j��SdS)z.Read one line, using input() when appropriate.N)rmrr�rr�r�r�)r>�promptrrrrw�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�listmodulesrr{�
showsymbolr"�evalrz�	showtopicr|rlrJrkrrr�rtrrrr�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�rrrrr�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�rowrrrrrrr�s&zHelper.listcCs |j�d�|�|j���dS)NzN
Here is a list of the Python keywords.  Enter any keyword to get more help.

)rr�rrzrEr�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�rr{rEr�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|rEr�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|rvrzr�r�r��KeyErrorr�textwrapr!rZwrapr�)r>�topic�
more_xrefs�
pydoc_data�target�label�xrefsr"r�r/Zwrapped_textrrrr��s4zHelper.showtopiccCs�zddl}Wntk
r"YdSX|j�||j�|��}|sFtd��t|t�r\|�||�S|\}}|jj|}|r�|pzdd|}||fS)a*Return unbuffered tuple of (topic, xrefs).

        If an error occurs here, the exception is caught and displayed by
        the url handler.

        This function duplicates the showtopic method but returns its
        result directly so it can be formatted for display in an html page.
        rN)r�rzcould not find topicrr�)	r�r�r|rvrzr�rkrJ�	_gettopic)r>r�r�r�r�r�r�r"rrrr�s	
zHelper._gettopiccCs*|j|}|�d�\}}}|�||�dS)Nr�)r{�	partitionr�)r>�symbolr�r�r_r�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)rr'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�runrrE)r>rHr�r�rr�rr�&s
�
zHelper.listmodules)r9r=r%r�)NN)r�r�)r)r)r)!r%r&r[rzZ_strprefixesZ_symbols_inverser{r�r�Zsymbols_r�rvr|r�rlrmrrprrqrursrwrrrrr~rr�r�r�r�r�rrrrr�sB�'���W



	


 
rc@seZdZdZddd�ZdS)r�z7An interruptible scanner that searches module synopses.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_filenamerV)r�rvrr�r�rXrr�rNr	�	_get_specr�r�rcr�rcr�r��StringIOr�r�r�r�r�r�r<)r>r�rHZ	completerr��seenr'r(r�rXrYr�r��sourcerr�rrrr�Gs`



zModuleScanner.run)NNN)r%r&r[rXr�rrrrr�Dsr�c	CsDdd�}dd�}t���"t�d�t�j|||d�W5QRXdS)zAPrint all the one-line module summaries that contain a substring.cSs6|dd�dkr |dd�d}t||o.d|�dS�Nr�r�r�z- )r�rr'r�rrrr��szapropos.<locals>.callbackcSsdSr�rr�rrrr��szapropos.<locals>.onerror�ignorer�N)�warnings�catch_warnings�filterwarningsr�r�)rHr�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)
aAStart an HTTP server thread on a specific port.

    Start an HTML/text server thread, so HTML or text documents can be
    browsed dynamically and interactively with a Web browser.  Example use:

        >>> import time
        >>> import pydoc

        Define a URL handler.  To determine what the client is asking
        for, check the URL and content_type.

        Then get or generate some text or HTML code and return it.

        >>> def my_url_handler(url, content_type):
        ...     text = 'the URL sent was: (%s, %s)' % (url, content_type)
        ...     return text

        Start server thread on port 0.
        If you use port 0, the server will pick a random port number.
        You can then use serverthread.port to get the port number.

        >>> port = 0
        >>> serverthread = pydoc._start_server(my_url_handler, port)

        Check that the server is really started.  If it is, open browser
        and get first page.  Use serverthread.url as the starting page.

        >>> if serverthread.serving:
        ...    import webbrowser

        The next two lines are commented out so a browser doesn't open if
        doctest is run on this module.

        #...    webbrowser.open(serverthread.url)
        #True

        Let the server do its thing. We just need to monitor its status.
        Use time.sleep so the loop doesn't hog the CPU.

        >>> starttime = time.monotonic()
        >>> timeout = 1                    #seconds

        This is a short timeout for testing purposes.

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

        Print any errors that may have occurred.

        >>> print(serverthread.error)
        None
   rNc@seZdZdd�Zdd�ZdS)z!_start_server.<locals>.DocHandlercSsX|j�d�rd}nd}|�d�|�dd|�|��|j�|�|j|��d��dS)	z�Process a request from an HTML browser.

            The URL received is in self.path.
            Get an HTML page from self.urlhandler and send it.
            z.css�text/css�	text/html��zContent-Typez%s; charset=UTF-8r�N)	rrbZ
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&r[r�r�rrrr�
DocHandler�sr�cs(eZdZdd�Z�fdd�Zdd�ZdS)z _start_server.<locals>.DocServercSs6||_|j|f|_||_|j�||j|j�d|_dS�NF)�hostZaddressr�rJr��handlerrv)r>r��portr�rrrr��s
z)_start_server.<locals>.DocServer.__init__cs>|js2��|j��gggd�\}}}|r|��q|��dSr@)rv�selectZsocketr�Zhandle_requestZserver_close)r>ZrdZwrZex�r�rr�serve_until_quit�s

z1_start_server.<locals>.DocServer.serve_until_quitcSs |j�|�|jr|�|�dSr�)rJ�server_activater�r�rrrr��sz0_start_server.<locals>.DocServer.server_activateN)r%r&r[r�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}~XYnXdS)zStart the server.N)�server�
HTTPServerrJr�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)z&Stop the server and this thread nicelyTNF)r�rvr!r�r"r�rrr�stop	s
z(_start_server.<locals>.ServerThread.stopN)r%r&r[r�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)aThe pydoc url handler for use with the pydoc server.

    If the content_type is 'text/css', the _pydoc.css style
    sheet is read and returned if it exits.

    If the content_type is 'text/html', then the result of
    get_html_page(url) is returned.
    cseZdZ�fdd�ZdS)z_url_handler.<locals>._HTMLDoccsd}d|}d||��|fS)rzpydoc_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&r[rrr�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)zModule Index page.cSsd||fS�Nrr�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)rqr(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�rrrr
r�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)zSearch results page.cs:|dd�dkr |dd�d}��||o0d|f�dSr�rKr��Z
search_resultrrr�{	sz3_url_handler.<locals>.html_search.<locals>.callbackr�cSsdSr�rr�rrrr��	sz2_url_handler.<locals>.html_search.<locals>.onerrorr�cSsd||fSr�rr�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�rr
rr!)	rHr�r�r�rnrr(r�rr�r�r�html_searchv	s,

��z!_url_handler.<locals>.html_searchcsLdd�}��ddd�}ttj���}��||�}|��ddd|�}d|fS)zIndex of topic texts available.cSs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�rr|rErr)r�rr�rr�rr�html_topics�	s��z!_url_handler.<locals>.html_topicscsL��ddd�}ttj���}dd�}��||�}|��ddd|�}d|fS)zIndex of keywords.r�rArBcSsd||fSr�rr�rrrr��	sz6_url_handler.<locals>.html_keywords.<locals>.bltinlinkZKeywordsrF)rr�rrzrErr)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)
zTopic or keyword help page.ZKEYWORDZTOPICr=rArBz
<pre>%s</pre>rFcSsd||fSr�rr�rrrr��	sz7_url_handler.<locals>.html_topicpage.<locals>.bltinlinkr�z%s %sr)
r�r�rr�rzrr3rr�rrrr!)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"rer�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�|d	kr�z�|�\}}Wn tk
r��|�\}}YnXn\|d
k�r|dkr��\}}n4z�|�\}}Wn"tk
�r�|�\}}YnXntd��n�|�\}}Wn2tk
�rd}z�||�\}}W5d}~XYnX��||�S)zGenerate an HTML page for url.r�N���)rr�r|rzr�z
search?keyz	topic?keyzget?keyz
bad pydoc url)rbr�r�rcr)r"Zcomplete_urlrr��opr_r�)rr�r�r�r�r�r�r�rr�
get_html_page�	s>



 z#_url_handler.<locals>.get_html_pager�rNr�rr�z"unknown content type %r for url %s)rrar	r�dirname�realpathrVr!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)	z�Start the enhanced pydoc Web server and open a Web browser.

    Use port '0' to start the server on an arbitrary port.
    Set open_browser to False to suppress opening a browser.
    rNz"Server commands: [b]rowser, [q]uitzServer stoppedzServer ready atzserver> r�r�)
�
webbrowserr�r�r�rr�r�r"r�rmr�r�rx)r�r�r�r�ZserverthreadZserver_help_msgr�rrr�browse
s2
r�cCst|t�o|�tj�dkSru)rkrJr�r	�sep)rNrrr�ispath9
sr�cCsvd|kstj|kst��|kr"dStj�t�}tj�|�}|��}||krbtj�||�sb|�|�|�	dt���|S)z�Ensures current directory is on returned path, and argv0 directory is not

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

    Returns a new path entry list, or None if no adjustment is needed.
    rNr)
r	�curdir�getcwdrr�rV�copy�samefile�remove�insert)Z
given_pathZargv0Z
stdlib_dirZ
script_dir�revised_pathrrr�_get_revised_path<
s

r�cCs,ttjtjd�}|dk	r(|tjdd�<dS)z�Ensures current directory is on sys.path, and __main__ directory is not.

    Exception: __main__ dir is left alone if it's also pydoc's directory.
    rN)r�rr�argv)r�rrr�_adjust_cli_sys_pathX
sr�cCs�ddl}Gdd�dt�}t��zv|�tjdd�d�\}}d}d}d}d}d}|D]\\}	}
|	d	krld
}d
}|	dkr�t|
�WdS|	dkr�d
}|
}|	d
kr�d
}|	dkrTd
}|
}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)z@Command-line interface (looks at sys.argv to decide what to do).rNc@seZdZdS)zcli.<locals>.BadUsageN)r%r&r[rrrr�BadUsagee
srrzbk: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rrrr�r�r�r�rr�)rrZoptsr�ZwritingZstart_serverr�r�r��opt�val�argrIr�rrr�clib
sd

 �rr�)NN)r)r)rrN)rrN)r)rN)r�)r)ZrXrGrTr]rYr�Zimportlib._bootstrapr�Zimportlib._bootstrap_external�importlib.machinery�importlib.utilrr�r	rNr�rrr�r�r�Zurllib.parserHr��collectionsr�reprlibr�	tracebackrrrr$r)r.r0r5r'�
IGNORECASEr6r8r?rDrOrfrir�r�r�r�rcr�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r/rrrrr"rrrrr�r�r�r�r�r�r�r�rr%rrrr�<module>s�&
	


'
0:*> ",

�
�


=
n%
U


Zerion Mini Shell 1.0