Your IP : 3.136.19.136


Current Path : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/pydoc.cpython-311.opt-1.pyc

�

c��f�����dZdgZdZdZdZddlZddlZddlZddl	Zddl
ZddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZdd	lmZd
�Zd�Z d�Z!d
�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*ej+dej,��Z-d�Z.d�Z/d�Z0d�Z1e2ej3��Z4dTd�Z5d�Z6d�Z7d�Z8d�Z9ifd �Z:Gd!�d"e;��Z<d#�Z=difd$�Z>Gd%�d&��Z?Gd'�d(e��Z@Gd)�d*e?��ZAGd+�d,e��ZBGd-�d.e?��ZCGd/�d0eC��ZDd1�aEd2�ZFd3�ZGd4�ZHd5�ZId6�ZJd7�ZKd8�ZLd9�ZMdUd:�ZNeC��ZOeD��ZPeA��ZQdUd;�ZR		dVd=�ZS		dWd?�ZTdUd@�ZUdXdB�ZVGdC�dD��ZWeW��ZXGdE�dF��ZYdG�ZZdH�Z[dYdJ�Z\dUdKdLdM�dN�Z]dO�Z^dP�Z_dQ�Z`dR�ZaebdSkrea��dSdS)ZaGenerate 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_onlyc�F�g}g}tjD]�}tj�|pd��}tj�|��}||vrItj�|��r*|�|��|�|����|S)zAConvert sys.path into a list of absolute, existing, unique paths.�.)�sys�path�os�abspath�normcase�isdir�append)�dirs�normdirs�dir�normdirs    �,/opt/alt/python311/lib64/python3.11/pydoc.py�pathdirsrRs���
�D��H��x�%�%���g�o�o�c�j�S�)�)���'�"�"�3�'�'���(�"�"�r�w�}�}�S�'9�'9�"��K�K������O�O�G�$�$�$���K�c���tj�|j��}|�dS|j�d��dd�D]}t
||��}�tj|��sdS|S)Nr���)	r	�modules�get�
__module__�__qualname__�split�getattr�inspect�isclass)�func�cls�names   r�
_findclassr$^sw��

�+�/�/�$�/�
*�
*�C�
�{��t��!�'�'��,�,�S�b�S�1�!�!���c�4� � ����?�3�����t��Jrc�J�tj|��rZ|jj}|j}tj|��r*t
t
||d��d��|jur|}�n~|j}�nutj|��r.|j}t|��}|�t
||��|urdS�n3tj
|��rC|j}|j}tj|��r|jdz|z|jkr|}n�|j}n�t|t��r4|j}|j}t|��}|�t
||��|urdSn�tj|��stj|��ri|j}|j}t
||��|urdStj|��r2t
|dd��}t|t&��r||vr||SndS|jD]7}	t+t
||����}n#t,$rY�-wxYw|�|cS�8dS)N�__func__r�	__slots__)r�ismethodr&�__name__�__self__r r�	__class__�
isfunctionr$�	isbuiltinr�
isinstance�property�fget�ismethoddescriptor�isdatadescriptor�__objclass__�ismemberdescriptor�dict�__mro__�
_getowndoc�AttributeError)�objr#�selfr"r!�slots�base�docs        r�_finddocr>hsd�������(��|�$���|���O�D�!�!�	!��G�D�$��-�-�z�:�:�c�l�J�J��C�C��.�C�C�	�	�C�	 �	 ���|����o�o���;�'�#�t�,�,�C�7�7��4�8�	�	�3�	�	���|���|���O�D�!�!�	!����#�d�*�c�.>�>�>��C�C��.�C�C�	�C��	"�	"���x���}��������;�'�#�t�,�,�C�7�7��4�8�	�	#�C�	(�	(�
�G�,D�S�,I�,I�
��|������3����S�(�(��4��%�c�*�*�	#��C��d�3�3�E��%��&�&�
#�4�5�=�=��T�{�"���t������	��W�T�4�0�0�1�1�C�C���	�	�	��H�	�����?��J�J�J���4s�.H�
H�Hc���	t�|d��}|�dS|tur1t|��j}t	|t
��r||krdS|S#t$rYdSwxYw)zUGet the documentation string for an object if it is not
    inherited from its class.�__doc__N)�object�__getattribute__�typer@r.�strr8)r9r=�typedocs   rr7r7�s���
��%�%�c�9�5�5���;��4��d�?�?��3�i�i�'�G��'�3�'�'�
�G�s�N�N��t��
�������t�t����s�A�8A�A�
A+�*A+c���t|��}|�)	t|��}n#ttf$rYdSwxYwt	|t
��sdSt
j|��S)z�Get the documentation string for an object.

    All tabs are expanded to spaces.  To clean up docstrings that are
    indented to line up with blocks of code, any whitespace than can be
    uniformly removed from the second line onwards is removed.N)r7r>r8�	TypeErrorr.rDr�cleandoc)rAr=s  r�_getdocrI�sy���V�
�
�C�
�{�	��6�"�"�C�C���	�*�	�	�	��4�4�	�����c�3�����t���C� � � s�#�8�8c��t|��ptj|��}|r(tjdd|�����pdS)z-Get the doc string or comments for an object.z^ *
�)rIr�getcomments�re�sub�rstrip)rA�results  r�getdocrQ�sC��
�V�_�_�
;�� 3�F� ;� ;�F��:�b�f�W�b�&�-�-�/�/�:�:�@�b�@rc�\�|����d��}t|��dkr
|ddfSt|��dkr?|d���s%|dd�|dd���fSdd�|��fS)z>Split a doc string into a synopsis line (if any) and the rest.�
�rrK�N)�stripr�lenrO�join)r=�liness  r�splitdocrZ�s����I�I�K�K���d�#�#�E�
�5�z�z�Q����Q�x��|��	�U���q����q����!2�!2���Q�x����5����9�-�-�-�-�
�t�y�y�����rc�D�|j}|j|kr
|jdz|z}|S)z@Get a class name and qualify it with a module name if necessary.r)r)r�rA�modnamer#s   r�	classnamer^�s.���?�D�
��G�#�#�� �3�&��-���Krc��d|jvr:|j�d��d}|j|kr
|jdz|zS|S|j|kr|jSdS)z_Get a name of the enclosing class (qualified it with a module name
    if necessary) or module.rrN)r�
rpartitionrr\s   r�
parentnamera�sr���f�!�!�!��"�-�-�c�2�2�1�5�����'�'��$�s�*�T�1�1��K����'�'��$�$�(�'rc���tj|��pctj|��pOtj|��p;tj|��p'tj|��ptj|��S)z>Check if an object is of a type that probably means it's data.)r�ismoduler �	isroutine�isframe�istraceback�iscode)rAs r�isdatarh�s|��� ��(�(�F�G�O�F�,C�,C�F��!�&�)�)�F�-4�_�V�-D�-D�F��#�F�+�+�F�/6�~�f�/E�/E�G�Grc��|r@|d�|�|d����}|dd�}|�@|S)z/Do a series of global replacements on a string.rTrrUN)rXr)�text�pairss  r�replacerl�sM��
���Q�x�}�}�T�Z�Z��a��1�1�2�2���a�b�b�	�����Krc���t|��|krTtd|dz
dz��}td|dz
|z
��}|d|�dz|t|��|z
d�zS|S)zCOmit part of a string if needed to make it fit in a maximum length.r�rUN�...)rW�max)rj�maxlen�pre�posts    r�cramrt�sq��
�4�y�y�6����!�f�Q�h��]�#�#���1�f�Q�h�s�l�#�#���D�S�D�z�E�!�D��T���4����$9�9�9��Krz at 0x[0-9a-f]{6,16}(>+)$c�8�t�d|��S)z>Remove the hexadecimal id from a Python object representation.z\1)�_re_stripidrN�rjs r�stripidrx�s���?�?�5�$�'�'�'rc��tj|��rdStj|��r*t|dd��}tj|��p|duSdS)zo
    Returns True if fn is a bound method, regardless of whether
    fn was implemented in Python or in C.
    Tr*NF)rr(r-rrc)�fnr:s  r�_is_bound_methodr{�sb��
�������t������>��r�:�t�,�,���$�T�*�*�<�t�t�|�=�=��5rc�
�i}tj|tj��D]
\}}d||<�|jD]$}|�t|�����%|���D]}t||��||<�|S�NrT)r�
getmembersrd�	__bases__�update�
allmethods�keysr)�cl�methods�key�valuer<s     rr�r�s����G��(��W�->�?�?���
��U��������)�)�����z�$�'�'�(�(�(�(��|�|�~�~�(�(���r�3�'�'������Nrc��g}g}|D]8}||��r|�|���#|�|���9||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�	predicate�yes�no�xs     r�_split_listr�sX��
�C�	�B�
�����9�Q�<�<�	��J�J�q�M�M�M�M��I�I�a�L�L�L�L���7�Nrc�f�|dvrdS|�d��r|�d��rdS|�d��rt|d��rdS|tur4|tvr+tt
||d��tj��rd	S|�||vS|�d��S)
z3Decide whether to show documentation on a variable.>r@�__date__�__file__r)�__path__�__spec__r'�
__author__�
__cached__�
__loader__r�__credits__�__package__�__version__�__builtins__rr�__rT�_�_fieldsTNF)�
startswith�endswith�hasattr�
__future__�_future_feature_namesr.r�_Feature)r#�allr9s   r�visiblenamer�!s����H�H�H��q����t���>����t�!4�!4�>�Q�Q����s������Y� 7� 7���t�
�*����)>�!>�!>��g�c�4��.�.�
�0C�D�D�	��5�
���s�{���?�?�3�'�'�'�'rc��g}tj|��D]l\}}}}tj|��r!d}t|t��r	|j�d}n|dkrt
|��rd}|�||||f���m|S)zUWrap inspect.classify_class_attrs, with fixup for data descriptors and bound methods.�data descriptorN�readonly property�method�
static method)r�classify_class_attrsr2r.r/�fsetr{r)rA�resultsr#�kindr"r�s      rr�r�9s����G�$+�$@��$H�$H�1�1� ��t�S�%��#�E�*�*�	#�$�D��%��*�*�
+�u�z�/A�*���
�X�
�
�"2�5�"9�"9�
�"�D�����d�C��/�0�0�0�0��Nrc����t|dg���	�fd�t���D���n#t$ri�YnwxYw�fd�}|�|���dS)zGSort the attrs list in-place by _fields and then alphabetically by namer�c�<��i|]\}}||t���z
��S�)rW)�.0�ir#�fieldss   �r�
<dictcomp>z#sort_attributes.<locals>.<dictcomp>Ls)���O�O�O�	��D�t�a��F���m�O�O�Orc�L����|dd��|dfS�Nr)r)�attr�field_orders �r�<lambda>z!sort_attributes.<locals>.<lambda>Os"���K�O�O�D��G�Q�7�7��a��A�r�r�N)r�	enumeraterG�sort)�attrsrA�keyfuncr�r�s   @@r�sort_attributesr�Fs������V�Y��
+�
+�F��O�O�O�O�Y�v�=N�=N�O�O�O����������������A�A�A�A�G�	�J�J�7�J�����s�1�A�Ac���tj�|��rHdD]E}tj�tj�|d|z����rdS�FdS)z3Guess whether a path refers to a package directory.)z.pyz.pyc�__init__TF)rr
r�isfilerX)r
�exts  r�	ispackager�Tsc��	�w�}�}�T����"�	�	�C��w�~�~�b�g�l�l�4��c�1A�B�B�C�C�
��t�t�
��5rc�z�|���}|dd�dks|���s9|���}|sn"|dd�dk�%|����9|���}|dd�dkr
|dd�}|dd�dkr�|dd�}|dd�dkr
|dd�}|���s+|���}|sn|����+|�d��d	���}nd}|S)
NrT�#�zr"""rn�"""r�\r)�readlinerVr)�file�linerPs   r�source_synopsisr�\s4���=�=�?�?�D�
�r��r�(�c�/�/������/��}�}������U��r��r�(�c�/�/������/��:�:�<�<�D��B�Q�B�x�6���$�q�r�r�(�4��B�Q�B�x�5����A�B�B�x������9����T�#�2�#�Y�d��*�*�,�,�	��=�=�?�?�D�����*�*�,�,�	����E�"�"�1�%�+�+�-�-����&��Mrc�X�tj|��j}|�|d��\}}|�||k�rn|�ttjj����rtjj	}nE|�ttjj
����rtjj}nd}|�Q	tj
|��}n#t$rYdSwxYw|5t|��}ddd��n#1swxYwYn�|d|��}tj�d||���}	tj�|��}	n#YdSxYwt(jd=|	jr|	j���dnd}||f||<|S)z.Get the one-line summary out of a module file.�NNN�__temp__��loaderr)r�stat�st_mtimerr��tuple�	importlib�	machinery�BYTECODE_SUFFIXES�SourcelessFileLoader�EXTENSION_SUFFIXES�ExtensionFileLoader�tokenize�open�OSErrorr��util�spec_from_file_location�
_bootstrap�_loadr	rr@�
splitlines)
�filename�cache�mtime�
lastupdaterP�
loader_clsr�r��spec�modules
          r�synopsisr�ms����G�H���&�E����8�\�:�:��J����Z�%�/�/����U�9�#6�#H�I�I�J�J�	�"�,�A�J�J�
�
�
�u�Y�%8�%K�L�L�
M�
M�	�"�,�@�J�J��J���
��}�X�.�.�����
�
�
��t�t�
�����
/�
/�(��.�.��
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/�� �Z�
�H�5�5�F��>�9�9�*�h�AG�:�I�I�D�
�"�-�3�3�D�9�9����
��t�t������J�'�7=�~�O�V�^�.�.�0�0��3�3�4�F� �&�/��h���Ms0�C�
C*�)C*�/D�D�D�E&�&E+c��eZdZdZd�Zd�ZdS)�ErrorDuringImportzEErrors that occurred while trying to import something to document it.c�>�||_|\|_|_|_dS�N)r��excr��tb)r:r��exc_infos   rr�zErrorDuringImport.__init__�s�� ��
�(0�%���$�*�d�g�g�grc�D�|jj}d|j�d|�d|j��S)Nzproblem in � - z: )r�r)r�r�)r:r�s  r�__str__zErrorDuringImport.__str__�s)���h����+/�=�=�=�#�#�#�t�z�z�J�JrN)r)rrr@r�r�r�rrr�r��s=������O�O�1�1�1�K�K�K�K�Krr�c��tjj}t|d��5}||�t|����k}ddd��n#1swxYwYtj�|��}tj�	|��\}}|r!tj
�||��}n tj
�||��}tj�
|||���}	tj�|��S#t!|t#j�����xYw)z<Import a Python source file or compiled file given its path.�rbNr�)r�r��MAGIC_NUMBERr��readrWrr
�basename�splitext�_bootstrap_externalr��SourceFileLoaderr�r�r�r�r	r�)	r
�magicr��is_bytecoder�r#r�r�r�s	         r�
importfiler�sJ���N�'�E�	
�d�D�	�	�5�T��t�y�y��U���4�4�4��5�5�5�5�5�5�5�5�5�5�5����5�5�5�5��w����%�%�H��� � ��*�*�I�D�#��L��.�C�C�D�$�O�O����.�?�?��d�K�K���>�1�1�$��V�1�L�L�D�6��#�)�)�$�/�/�/��6���c�l�n�n�5�5�5���s�'A�A�A�D&�&#E	c����	|r_�tjvrQ�tjvrC�fd�tjD��}�g|zD]$}tj|||<tj|=�%t���}n�#tj��x\}}}}	�tjvr%ttj�j|	���|turt|j|	���t|t��r|j�krYdSt�tj�����xYw��d��dd�D]$}
t||
��}�#t$rYdSwxYw|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).c�D��g|]}|��dz���|��S)r)r�)r��mr
s  �r�
<listcomp>zsafeimport.<locals>.<listcomp>�s.���K�K�K�a�!�,�,�t�c�z�2J�2J�K��K�K�KrNrrT)r	r�builtin_module_names�
__import__r�r�r��SyntaxErrorr��
issubclass�ImportErrorr#rrr8)r
�	forceloadr��subsr�r�r�r�r��info�parts`          r�
safeimportr�s��� :�
�	)����,�,��3�3�3�3�L�K�K�K�3�;�K�K�K�� �6�D�=�)�)�C�!$��S�!1�E�#�J���C�(�(��D�!�!����:�"%�,�.�.�0���e�R�4��3�;���#�C�K��$5�$>��E�E�E�
�K�
�
�#�E�N�D�9�9�9�
��[�
)�
)�	:�e�j�D�.@�.@��4�4�$�D�#�,�.�.�9�9�9�����
�
�3������#�+�+���f�d�+�+�V�V���*�*�*�d�d�d�d�*�����Ms%�A0A4�4BD$�!D$�E�
E&�%E&c��eZdZej�ddejdd�z��Zd	d�Z	d	d�Z
e
xZxZxZ
xZxZZejd��fd�ZdS)
�Doc�
PYTHONDOCSz%https://docs.python.org/%d.%d/libraryNrUc�8�||f|z}	tj|��r
|j|�Stj|��r
|j|�Stj|��r
|j|�Sn#t$rYnwxYwtj|��r
|j	|�S|j
|�S)z%Generate documentation for an object.)rrc�	docmoduler �docclassrd�
docroutiner8r2�docdata�docother)r:rAr#�argss    r�documentzDoc.document�s�����~��$��
	����'�'�E�����0E�)E���v�&�&�C�}�t�}�d�/C�(C�� ��(�(�G����$�1G�*G�G���	�	�	��D�	�����#�F�+�+�G�L�D�L�$�4G�-G��t�}�d�#�#s�A$�A$�A$�$
A1�0A1c�x�d|odt|��z�dt|��j��}t|���)z+Raise an exception for unimplemented types.z!don't know how to document object� z	 of type )�reprrCr)rG)r:rAr#r�messages     r�failzDoc.fail�sB���
�%�S�4��:�:�%�%�%�t�F�|�|�'<�'<�>���� � � r�stdlibc��	tj|��}n#t$rd}YnwxYwtj�d|j��}tj�|��}t|tt����r�|jdvsH|�|��r�|�tj�
|d����s�|jdvr�|�d��rAd�|�d��|j�����}n=tj�
||j���d	z��}nd
}|S)z*Return the location of module docs or None�
(built-in)r)
�errno�
exceptions�gc�imp�marshal�posix�signalr	�_thread�	zipimportz
site-packages)z	xml.etreeztest.test_pydoc.pydoc_mod)zhttp://zhttps://z
{}/{}.html�/�.htmlN)r�
getabsfilerGr�environrrr
r
r.rCr)r�rX�formatrO�lower)r:rA�basedirr��doclocs     r�	getdoclocz
Doc.getdocloc�s`��	 ��%�f�-�-�D�D���	 �	 �	 ��D�D�D�	 ���������d�o�>�>���'�"�"�7�+�+���v�t�B�x�x�(�(�	�
�_�!9�9�9��o�o�g�&�&�9��/�/�"�'�,�,�w��"H�"H�I�I�	9�

�O�#M�M�M�� � �!8�9�9�
Q�%�,�,�V�]�]�3�-?�-?���AV�AV�AX�AX�Y�Y�������f�f�o�.C�.C�.E�.E��.O�P�P����F��
s��&�&r�)r)rrrr/rr	�version_inforrrrrrr�docpropertyr�	sysconfig�get_pathr4r�rrrr�s������������ G�"%�"2�2�A�2�"6�!7�8�8�J�$�$�$�$� !�!�!�!�LP�O�I�O��O�:�O��O�;��(:�	�(:�8�(D�(D������rrc�>�eZdZdZd�Zd�Zd�Zd�Zd�ZeZ	d�Z
eZdS)	�HTMLReprzBClass for safely making an HTML representation of a Python object.c�t�tj|��dx|_|_d|_dx|_|_dS�N��
�d�rr��maxlist�maxtuple�maxdict�	maxstring�maxother�r:s rr�zHTMLRepr.__init__�9���
�d����')�)���t�}����),�,������rc	�,�t|dddddd��S)N�&z&amp;�<z&lt;�>z&gt;)rl�r:rjs  r�escapezHTMLRepr.escape"s���t�S�'�3���V�D�D�Drc�,�tj||��Sr�)rr�r:rAs  rrz
HTMLRepr.repr%s���y��v�&�&�&rc	��tt|��d��rfdd�t|��j�����z}t||��rt||��||��S|�ttt|����|j
����S�Nr)�repr_r�)r�rCrXr)rrrMrtrxrrE�r:r��level�
methodnames    r�repr1zHTMLRepr.repr1(s����4��7�7�J�'�'�	;� �3�8�8�D��G�G�,<�,B�,B�,D�,D�#E�#E�E�J��t�Z�(�(�
;�0�w�t�Z�0�0��E�:�:�:��{�{�4���Q��� 0� 0�$�-�@�@�A�A�Arc��t||j��}t|��}d|vr=dt|dd��vr*d|dz|�|��z|dzStjdd|�|����S)Nr��\\rK�rrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z<span class="repr">\1</span>)rtrDrrlrMrMrN�r:r�rT�test�testreprs     r�repr_stringzHTMLRepr.repr_string/s����A�t�~�&�&����:�:���4�<�<�D���%��(D�(D�D�D���!��$�t�{�{�4�'8�'8�8�8�A�;�F�F��v�F�5��k�k�(�+�+�-�-�	-rc	���	|�ttt|����|j����S#|�d|jjz��cYSxYw�Nz
<%s instance>)rMrtrxrrDr+r)�r:r�rTs   r�
repr_instancezHTMLRepr.repr_instance<s`��	G��;�;�t�G�D��G�G�$4�$4�d�n�E�E�F�F�F��	G��;�;����1E�E�F�F�F�F�F���s�AA�$A*N)r)rrr@r�rMrrVr]�repr_strra�repr_unicoder�rrr:r:s�������L�L�-�-�-�E�E�E�'�'�'�B�B�B�	-�	-�	-��H�G�G�G��L�L�Lrr:c��eZdZdZe��ZejZejZd�Zdd�Z			dd�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zdiiifd�Zdd�Zdd�Zddiifd�Zd�Zddiiiddfd�Zd d�ZeZdd�Zdd�ZdS)!�HTMLDocz'Formatter class for HTML documentation.c��d|�d|�d�S)�Format an HTML page.zN<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Python: z</title>
</head><body>
z
</body></html>r�)r:�title�contentss   r�pagezHTMLDoc.pageMs����U�U�H�H�H�&�	&rrKc��d|�d|pd�d�S)zFormat a page heading.zU
<table class="heading">
<tr class="heading-text decor">
<td class="title">&nbsp;<br>z</td>
<td class="extra">�&nbsp;z</td></tr></table>
    r�)r:rh�extrass   r�headingzHTMLDoc.headingYs$����5�5�&�$�H�$�$�&�	&r�Nrlc��|�dd|zzdz}d|�d|�d�}|r|d|�d	|�d
|�d|�d|�d
�z}n|d|�d|�d|�d
�z}|d|zzS)z Format a section with a heading.Nz<span class="code">rlz</span>z-<p>
<table class="section">
<tr class="decor zD-decor heading-text">
<td class="section-title" colspan=3>&nbsp;<br>z</td></tr>
    z
<tr><td class="decor z-decor" rowspan=2>z</td>
<td class="decor z-decor" colspan=2>z</td></tr>
<tr><td>�</td>z-decor">z	</td><td>z.
<td class="singlecolumn">%s</td></tr></table>r�)	r:rhr"ri�width�prelude�
marginalia�gaprPs	         r�sectionzHTMLDoc.sectionbs�����.��E�1A�A�I�M�J��
�3�3����	��
�	N��V��c�c�:�:�:�s�s�s�G�G�G�S�S�S�:�:�F�F�
�V�8;���Z�Z�Z����N�N�F��I�H�T�T�Trc�(�d|z}|j|g|�R�S)z$Format a section with a big heading.z&<strong class="bigsection">%s</strong>)rv)r:rhrs   r�
bigsectionzHTMLDoc.bigsectionws&��8�5�@���t�|�E�)�D�)�)�)�)rc�~�|�|�����}t|dddddddd�	�	S)z!Format literal preformatted text.�

z
 
rrlrS�<br>
)rM�
expandtabsrlrLs  r�	preformatzHTMLDoc.preformat|sB���{�{�4�?�?�,�,�-�-���t�V�W�f�g� �(�D�(�<�<�	<rc��d}t|��dzdz}td��D]R}|dz}t||z||z|z��D],}|t|��kr||||��zdz}�-|dz}�Sd|zS)z0Format a list of items into a multi-column list.rKrnr�z<td class="multicolumn">r{rqz<table><tr>%s</tr></table>)rW�range)r:�listr0rP�rows�colr�s       r�multicolumnzHTMLDoc.multicolumn�s������D�	�	�A�
�!�#����8�8�	&�	&�C��8�8�F��4��8�T�#�X�d�]�3�3�
A�
A���s�4�y�y�=�=�#�f�f�T�!�W�o�o�5��@�F���g�%�F�F�+�f�4�4rc��d|zS)Nz<span class="grey">%s</span>r�rLs  r�greyzHTMLDoc.grey�s
��!?�$�!F�Frc�:�|D]}||vrd||�d|�d�cS�|S)z:Make a link for an identifier, given name-to-URL mappings.�	<a href="�">�</a>r�)r:r#�dictsr5s    r�namelinkzHTMLDoc.namelink�sE���	B�	B�D��t�|�|�|�04�T�
�
�
�D�D�D�A�A�A�A���rc	��|jtj�|j��}}t||��r1t
||��|urd|j�d|�dt||���d�St||��S)zMake a link for a class.r��.html#r�r�)r)r	rrrr�rr^)r:rAr]r#r�s     r�	classlinkzHTMLDoc.classlink�s����������8I�(J�(J�f���6�4� � �	C�W�V�T�%:�%:�f�%D�%D�%D��������y���'A�'A�'A�'A�C�
C����)�)�)rc��d}|jtj�|j��}}t||��rnt
||��|ur\d|jvr>|j�d��d}|j|kr
|j�d|��}nd|z}n|j|kr
d|jz}|rd|�dt||���d	�St||��S)
z.Make a link for the enclosing class or module.Nrrr�z#%s�%s.htmlr�r�r�)
r)r	rrrr�rrr`ra)r:rAr]�linkr#r�s      r�
parentlinkzHTMLDoc.parentlink�s������������8I�(J�(J�f���6�4� � �		7�W�V�T�%:�%:�f�%D�%D��f�)�)�)��*�5�5�c�:�:�1�=���$��/�/�+1�?�?�?�D�D�A�D�D� �4�<�D�D��$��/�/�$�v��6�D��	/�	/�,0�D�D�*�V�W�2M�2M�2M�2M�N�N��f�g�.�.�.rc�(�d|j�d|j�d�S)zMake a link for a module.r��.html">r�)r)rOs  r�
modulelinkzHTMLDoc.modulelink�s���-3�_�_�_�f�o�o�o�N�Nrc��|\}}}}|r|�|��S|r	|�d|�d�}nd|z}|rd|z}n|}d|�d|�d�S)z;Make a link for a module or package to display in an index.rr-r�z"<strong>%s</strong>&nbsp;(package)r�r�r�)r�)r:�
modpkginfor#r
r��shadowed�urlrjs        r�
modpkglinkzHTMLDoc.modpkglink�s{��*4�'��d�I�x��	#��9�9�T�?�?�"��	#�"&�$�$����-�C�C��d�"�C��	�7�$�>�D�D��D��(+���T�T�T�2�2rc��d|�d|�d�S)zMake a link to source file.z<a href="file:r�r�r�)r:r�r
s   r�filelinkzHTMLDoc.filelink�s���-0�S�S�$�$�$�7�7rc��|p|j}g}d}tjd��}	|�||��}	|	s�n�|	���\}
}|�||||
�����|	���\}}
}}}}|
r=||���dd��}|�d|�d|�d����n3|r8d	t|��z}|�d|�d||���d���n�|r8d
t|��z}|�d|�d||���d���n�|rW|||dz�dkr-|�d
|�	||��z��n|�d|z��nf|||dz�dkr,|�|�	||||����n)|�|�	||����|}���|�|||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.rzJ\b((http|https|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?(\w+))T�"z&quot;r�r�r�z(https://www.rfc-editor.org/rfc/rfc%d.txtz!https://peps.python.org/pep-%04d/rT�(zself.zself.<strong>%s</strong>NrK)rMrM�compile�search�spanr�groupsrl�intr�rX)r:rjrM�funcs�classesr�r��here�pattern�match�start�endr��scheme�rfc�pep�selfdotr#r�s                   r�markupzHTMLDoc.markup�su���&�4�;�������*�3�4�4��	��N�N�4��.�.�E���%������J�E�3��N�N�6�6�$�t�E�z�"2�3�3�4�4�4�38�<�<�>�>�0�C���c�7�D��
=��f�S�k�k�)�)�#�x�8�8���������S�S�S�A�B�B�B�B��
=�@�3�s�8�8�K���������V�V�C�[�[�[�[�I�J�J�J�J��

=�9�C��H�H�D���������V�V�C�[�[�[�[�I�J�J�J�J��

=���C��E�	�?�c�)�)��N�N�7�T�]�]�4��-I�-I�#I�J�J�J�J��N�N�#=��#D�E�E�E�E��c�#�a�%�i��C�'�'����t�}�}�T�7�E�7�K�K�L�L�L�L����t�}�}�T�7�;�;�<�<�<��D�7	�8	���v�v�d�4�5�5�k�*�*�+�+�+��w�w�w���rc���d}|D]�}t|��td��ur�|\}}|dz}||�||��z}|rU||fkrNg}|D]+}	|�|�|	|�����,|dzd�|��zdz}|dz}��t|��tg��ur|d|�|||��zz}��d	|zS)
zAProduce HTML for a class tree as given by inspect.getclasstree().rKr�z<dt class="heading-text">r��, �)z
</dt>z
<dd>
%s</dd>
z
<dl>
%s</dl>
)rCr�rrX�
formattree)
r:�treer]�parentrP�entry�c�bases�parentsr<s
          rr�zHTMLDoc.formattree�s�����
	'�
	'�E��E�{�{�d�2�h�h�&�&� ���5��"=�=���$�.�.��G�"<�"<�<���E�U�v�i�/�/� �G� %�F�F�����t�~�~�d�G�'D�'D�E�E�E�E�#�c�\�D�I�I�g�,>�,>�>��D�F��)�+����e����R���(�(��"3�d�o�o��7�A�7'�7'�#'�'��� �6�)�)rc
����|j}	|j}n#t$rd}YnwxYw|�d��}g}t	t|��dz
��D]B}|�dd�|d|dz����d||�d����Cd�||dd�z��}	d|	z}
	tj	|��}tj�|��}��
||��}
n#t$rd	}
YnwxYwg}t|d
��rwt!|j��}|dd�dkr*|dd�d
kr|dd����}|�d��|��z��t|d��r:|���t!|j������|r|
dd�|��zz}
��|��}|�dt-��z}nd}��|
d|
z|z��}tj|tj��}gi}}tj|tj��D]T\}}|�tj|��p||ur5t9|||��r$|�||f��d|zx||<||<�U|D]z\}}|jD]m}|j|j}}t>j �!|��}||kr8|r6t||��r&tE||��|ur||vr|dz|zx||<||<�n�{gi}}tj|tj#��D]�\}}|�*tj$|��stj|��|urOt9|||��r>|�||f��d|z||<tj%|��r||||<��g}tj|tL��D]-\}}t9|||��r|�||f���.��'tQ|���j)||��}|od|z}|d|zz}t|d��r�g}tUj+|j,��D]\}}} |�||| df��� |�-����.|�j/��}!|��0dd|!��z}n5|r3��.|�fd���}!|��0dd|!��z}|r�d �|D��}"��1tj2|"d��|��g}!|D]1\}}|!���3|||||�����2|��0d!d"d#�|!����z}|rcg}!|D]1\}}|!���3|||||�����2|��0d$d%d#�|!����z}|r`g}!|D].\}}|!���3||�����/|��0d&d'd(�|!����z}t|d)��rG��'t!|j4���j)��}!|��0d*d+|!��z}t|d,��rG��'t!|j5���j)��}!|��0d-d.|!��z}|S)/z/Produce HTML documentation for a module object.NrrTr�z.html" class="white">r�r�!<strong class="title">%s</strong>r"r���$Revision: �$z
version %sr�z (%s)r�z-<br><a href="%(docloc)s">Module Reference</a>rKz<a href=".">index</a><br>r�r�z#-z<span class="code">%s</span>z
<p>%s</p>
r�rzPackage Contentszpkg-contentc�:����|d��Sr})r�)�tr:s �rr�z#HTMLDoc.docmodule.<locals>.<lambda>[s���4�?�?�1�Q�4�#8�#8�r�Modulesc��g|]\}}|��Sr�r��r�r�r�s   rrz%HTMLDoc.docmodule.<locals>.<listcomp>`s��;�;�;�<�C���;�;�;r�Classes�indexr�	Functions�	functions�Data�datar{r��Author�authorr��Credits�credits)6r)�__all__r8rrrWrrXrr.�urllib�parse�quoter�rGr�rDr�rVrMr�r4�localsrnr~rcr �	getmoduler�rrr	rrrrdr-r,rhr�rQr}�pkgutil�iter_modulesr�r�r�r�rxr��getclasstreerr�r�)#r:rAr#�mod�ignoredr��parts�linksr��
linkedname�headr
r�r�r
�versionr3rPrr��cdictr�r�r<r]r�r��fdictr�r=�modpkgs�importer�ispkgri�	classlists#`                                  rrzHTMLDoc.docmodules!������	��.�C�C���	�	�	��C�C�C�	�����
�
�3�������s�5�z�z�!�|�$�$�	3�	3�A��L�L�L����%���1���+�&�&�&�&��a����2�
3�
3�
3�
3��X�X�e�e�B�C�C�j�0�1�1�
�2�Z�?��	$��%�f�-�-�D��,�$�$�T�*�*�C��}�}�S�$�/�/�H�H���	$�	$�	$�#�H�H�H�	$�������6�=�)�)�	=��&�,�-�-�G��s��s�|�1�1�1�g�b�c�c�l�c�6I�6I�!�"�R�%�.�.�.�0�0���K�K��t�{�{�7�';�';�;�<�<�<��6�:�&�&�	;��K�K����C���$8�$8�9�9�:�:�:��	4��'�D�I�I�d�O�O�3�3�D�����'�'����D�v�x�x�O�F�F��F����d�$?�(�$J�V�$S�T�T���$�V�W�-=�>�>���R���!�,�V�W�_�E�E�	:�	:�J�C�����"�5�)�)�3�V��>�>��s�C��0�0�:��N�N�C��<�0�0�0�03�c�	�9�E�#�J��u���!�	P�	P�J�C����
P�
P��#�}�d�o�W�������1�1���d�?�?�v�?�'�&�#�2F�2F�?��v�s�+�+�t�3�3�"�e�|�|�7>��7I�C�7O�O�E�#�J��t���

P��2�u��!�,�V�W�5F�G�G�	L�	L�J�C�����!�%�(�(� �,3�,=�e�,D�,D��,N�,N��s�C��0�0�L��L�L�#�u��.�.�.�!%���E�#�J��)�%�0�0�K��s��%��,����!�,�V�V�<�<�	*�	*�J�C���3��V�,�,�
*����S�%�L�)�)�)���k�k�&��.�.�$�.�%��G�G���:�4�s�:���-�#�-�-���6�:�&�&�	4��G�,3�,@���,Q�,Q�
:�
:�(��'�5������u�a�8�9�9�9�9��L�L�N�N�N��'�'����A�A�H��d�o�o�"�M�8�=�=�=�F�F�
�	4��'�'��8�8�8�8�:�:�H��d�o�o��=�(�4�4�4�F��	8�;�;�7�;�;�;�I����� 4�Y�� B� B�D�I�I�K�H�%�
O�
O�
��U�����
�
�e�S�$��u� M� M�N�N�N�N��d�o�o��7�C�H�H�X�$6�$6�8�8�8�F��	>��H�#�
O�
O�
��U�����
�
�e�S�$��u� M� M�N�N�N�N��d�o�o��[�#�(�(�8�*<�*<�>�>�>�F��	9��H�"�
;�
;�
��U�����
�
�e�S� 9� 9�:�:�:�:��d�o�o����
�
�h� 7� 7�9�9�9�F��6�<�(�(�	L��{�{�3�v�'8�#9�#9�4�>�J�J�H��d�o�o�h��(�K�K�K�F��6�=�)�)�	N��{�{�3�v�'9�#:�#:�D�N�K�K�H��d�o�o�i��H�M�M�M�F��
s��!�!�A	D
�
D�Dc�*�������� �!��j}|p|}�j}g}	|	j� G� fd�d��}
|
���tt	j�����}t
|��dkrV����� d��|D])}� d��|�j	��z���*� d��������� �fd�}
��� �fd�}������� �fd	�}�fd
�t���D��}i�|D]O\}}}}d|zdz|zx�|<}	t�|��}n#t$rYnwxYw	|�|<�@#t$rY�LwxYw|r�|r|����!n|d
d�!t|�!fd���\}}�t jur�!t jur|}�\�!�urd}nd���!�j	��z}|dz
}t%|���|
d|z|d���}|
d|z|d���}|
d|z|d���}|d|z|d���}|d|z|d���}|d|z|d���}|}|��d�|	��}	||kr
d|�d |�d!�}nd"|�d#|�d$|�d%�}|rPg}|D]0}|���|�j	�����1|d&d'�|��zz}d}	t	j���}n#t*tf$rd(}YnwxYw|r2t-|��}|r!|d)kr|��|��zd*z}t1���}|r||pdz}��|�j�����}|od+|z}��|d,|	d-|��S).z.Produce HTML documentation for a class object.c� ��eZdZd�Z�fd�ZdS)�(HTMLDoc.docclass.<locals>.HorizontalRulec��d|_dSr���needonerFs rr�z1HTMLDoc.docclass.<locals>.HorizontalRule.__init__��
�� ����rc�:��|jr�d��d|_dS)Nz<hr>
rTr��r:�pushs �r�maybez.HTMLDoc.docclass.<locals>.HorizontalRule.maybe��%����<�#��D��N�N�N� ����rN�r)rrr�r��r�s�r�HorizontalRuler���=�������
!�
!�
!�
!�
!�
!�
!�
!�
!�
!rr�rUz&<dl><dt>Method resolution order:</dt>
z<dd>%s</dd>
�</dl>
c
�h��t||��\}}|r��
����|��|D]y\}}}}	t�
|��}���||��	���
|����n0#t$r#���||�����YnwxYw�d���z|S)NrS�r�r�rr�	Exceptionr)�msgr�r��okr#r��homeclsr�r�r��hr�mdictr�rAr�r:s        ��������r�spillzHTMLDoc.docclass.<locals>.spill�s���#�E�9�5�5�I�B���

����
�
�
���S�	�	�	�24�
�
�.�D�$���Q� '��� 5� 5����T�]�]�5�$��(-�w��v�w�P�P�Q�Q�Q�Q��%�=�=�=���T�\�\�%��s�;�;�<�<�<�<�<�=�����D��J�J�J�J��Ls�A6�6*B#�"B#c����t||��\}}|rI�����
|��|D]'\}}}}�
��||�	�����(|Sr��r�r�r�r�r�r�r�r#r�r�r�r�r�r�r:s        ����r�spilldescriptorsz*HTMLDoc.docclass.<locals>.spilldescriptors��x���#�E�9�5�5�I�B���
9����
�
�
���S�	�	�	�24�9�9�.�D�$����D����e�T�3�7�7�8�8�8�8��Lrc���t||��\}}|r������|��|D]�\}}}}��t�|��|���}t	|��}	|	s�d|z��nA��t	|���j��
�
��}	d|	z}	�d|�|	�d����d����|S)Nz<dl><dt>%s</dl>
z <dd><span class="code">%s</span>�<dl><dt>r�rS)r�r�rrrQr�r})r�r�r�r�r#r�r�r�r<r=r�r�r�r�r�rAr�r:s          ��������r�	spilldataz#HTMLDoc.docclass.<locals>.spilldata�s����#�E�9�5�5�I�B���

����
�
�
���S�	�	�	�24�
�
�.�D�$����=�=����)>�)>��c�J�J�D� ��-�-�C��B���0�4�7�8�8�8�8�"�k�k�&��-�-���*/��%�A�A��@�3�F�����d�d�C�C�C�@�A�A�A��D��J�J�J�J��Lrc�H��g|]\}}}}t|�����||||f��S�)r9�r��r�r#r�r"r�rAs     �rrz$HTMLDoc.docclass.<locals>.<listcomp>��L���3�3�3�+�T�4��e���&�1�1�1�3�$��c�5�)�3�3�3rr��-rc���|d�uS�NrUr��r��	thisclasss �rr�z"HTMLDoc.docclass.<locals>.<lambda>�����A�a�D�I�<M�r�defined here�inherited from %sz:<br>
z
Methods %sc��|ddkS�NrTr�r��r�s rr�z"HTMLDoc.docclass.<locals>.<lambda>����A�a�D�H�$4�rzClass methods %sc��|ddkS�NrTzclass methodr�rs rr�z"HTMLDoc.docclass.<locals>.<lambda>����A�a�D�N�$:�rzStatic methods %sc��|ddkS�NrTr�r�rs rr�z"HTMLDoc.docclass.<locals>.<lambda>����A�a�D�O�$;�rzReadonly properties %sc��|ddkS�NrTr�r�rs rr�z"HTMLDoc.docclass.<locals>.<lambda>����q��t�7J�/J�rzData descriptors %sc��|ddkS�NrTr�r�rs rr�z"HTMLDoc.docclass.<locals>.<lambda>����q��t�7H�/H�rzData and other attributes %sc��|ddkS�NrTr�r�rs rr�z"HTMLDoc.docclass.<locals>.<lambda>�����!����rrK�	<a name="z">class <strong>�
</strong></a>z<strong>z</strong> = <a name="z">class r��(%s)r�N�()rzz&<span class="code">%s<br>&nbsp;</span>rhrn)r)rrrr�getmrorWr�r�rr�rr�rG�popleftr��builtinsrAr�rX�	signature�
ValueErrorrDrMrQr�r}rv)"r:rAr#r�r�r�r��realnamer�rir��mror<r�rrr�r�r�r�r��anchor�	inherited�tagrhr��declr.�argspecr=r�r�r�rs"`` ```                        @@@@rrzHTMLDoc.docclass|s�������������?����x��� �������	!�	!�	!�	!�	!�	!�	!�	!�	!�	!��^�
�
���G�N�6�*�*�+�+���s�8�8�a�<�<��H�H�J�J�J��D�:�;�;�;��
J�
J����_�t�~�~�d�6<�6G�(I�(I�I�J�J�J�J��D��O�O�O�	�	�	�	�	�	�	�	�	�	�	�	�$	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�$3�3�3�3�/C�F�/K�/K�3�3�3����).�
	�
	�%�C��w��"%��*�s�"2�S�"8�8�E�#�J��
����-�-�����
�
�
���
����
� &��e�����
�
�
���
�����!	��
(��K�K�M�M�	�	�!�!�H�Q�K�	�*�5�2M�2M�2M�2M�N�N��E�9��X�_�,�,��h�o�1M�1M�!����f�$�$�$���)�D�N�N�9�;A�;L�-N�-N�N���9��C��E�6�*�*�*��E�,��,�e�4�4�6�6�E��E�,�s�2�E�:�:�<�<�E��E�-��3�U�;�;�=�=�E�$�$�%=��%C�U�%J�%J�L�L�E�$�$�%:�S�%@�%�%H�%H�J�J�E��I�<�s�B�E�6�6�8�8�E��E�C�!	�F�7�7�8�$�$���8�������h�h�h� �E�E��
���d�d�d�H�H�H�&�E��	8��G��
H�
H�����t�~�~�d�F�4E�F�F�G�G�G�G��F�T�Y�Y�w�%7�%7�7�7�E���	��)�&�1�1�I�I���I�&�	�	�	��I�I�I�	�����	<��)�n�n�G��
<�7�d�?�?��d�k�k�'�2�2�2�V�;���V�n�n���	%��#�)��$�C��k�k�#�t�~�u�g�u�E�E���D�>��D���|�|�E�7�H�a��=�=�=s6�D0�0
D=�<D=�E�
E�E�K2�2L�Lc�X�|�d|�|��z��S�z)Format an argument default value as text.�=)r�rrOs  r�formatvaluezHTMLDoc.formatvalues%���y�y��t�y�y��0�0�0�1�1�1rc	���|j}	|p|	}|�|}|�dn|jdz|z}
d}d}d}
t|��rj|j}||urt|dd��}
n�t	j|��rd|�||��z}n�d|�|j|��z}n|t	j|��st	j	|��rR	|j
}|�d|�||��z}n0||urd	|�||��z}n#t$rYnwxYw|}
t	j|
��rE|�C|
j
|j
ks|
j|jd
z|	zkr|�|
|��}|rd|z}t	j|��st	j|��rd}nd}||	kr
d
|
�d|	�d�}nU|�Ft	j||	g��|ur.d|jdz|	z�d|	�d�}d}|�d	��rd}n|	}d
|
�d|�d|��}d}t	j|��r\	t	j|��}n#t,t.f$rd}YnwxYw|r+t1|��}|	dkrd|z}|js
|dd�}|sd}||z|�|��z|o|�d|z��z}|rd|zS|�t;|��|j|||��}|od|z}d|�d|�d�S) z;Produce HTML documentation for a function or method object.NrKrFr&� class method of %s� method of %s instance� unbound %s method� from r� from %s�async r'z
"><strong>r(z
<a href="#r�r�Tz</strong></a> = �<lambda>z$<strong>%s</strong> <em>lambda</em> rTr�(...)z$<span class="heading-text">%s</span>z<dl><dt>%s</dt></dl>
z%<dd><span class="code">%s</span></dd>rz</dt>r�)r)r{r*rrr r�r+r1�ismethodwrapperr3r8r,rrr��iscoroutinefunction�isasyncgenfunction�getattr_staticr�rdr.r/rGrD�__annotations__rMr�r�rQr})r:rAr#r�r�r�r�r�r�r0r2�note�skipdocs�imfunc�imself�objclass�pname�asyncqualifierrh�reallinkr6r.r5r=s                        rrzHTMLDoc.docroutine"s����?����x���?��G��
�"�"���s�:�T�A���������F�#�#�	��_�F���|�|� ���T�:�:������(�(�
+�,�t�~�~�f�c�/J�/J�J���/�$�.�.��$�c�3+�3+�+����(��0�0�	��%�f�-�-�	�
D�!�.���:�/�$�.�.��3�2O�2O�O�D�D��W�,�,�#�d�n�n�X�s�&C�&C�C�D���
"�
�
�
���
�����F���f�%�%�	*�'�*=����!3�3�3���7�#7�#�#=��#H�H�H��O�O�F�C�0�0�E��
*�!�E�)���'��/�/�	 ��*�6�2�2�	 �%�N�N��N��8����>D�f�f�h�h�h�O�E�E����&�r�8�R�8�8�F�B�B�B��K�#�%��0�0�0�(�(�(�<�����?�?�8�,�,���D��#���������h�h�(�E�����V�$�$�
	0�
!�#�-�f�5�5�	�	���	�*�
!�
!�
!� �	�	�	�
!�����
0��i�.�.���z�)�)�B�T�I�E�"�1�0�")�!�B�$�-���	��G���%����G�(<�(<�<��AH��y�y�?�$�F�G�G�I���	<�+�d�2�2��+�+��v������w��I�I�C��G�A�C�G�C�C�15���s�s�s�;�;s$�	D
�

D�D�H3�3I	�I	c���g}|j}|r|d|z��|�t|��|j��}|r|d|z��|d��d�|��S)z1Produce html documentation for a data descriptor.z!<dl><dt><strong>%s</strong></dt>
z&<dd><span class="code">%s</span></dd>
r�rK)rr�rQr}rX�	r:rAr#r�r�r�r�r�r=s	         rrzHTMLDoc.docdata{s������~���	>��D�5��<�=�=�=��k�k�&��.�.�$�.�9�9���	B��D�:�S�@�A�A�A���Y�����w�w�w���rc�D�|rd|zpd}||�|��zS)z-Produce HTML documentation for a data object.z<strong>%s</strong> = rK�r)r:rAr#r�r��lhss      rrzHTMLDoc.docother�s.���6�/�$�6�<�"���T�Y�Y�v�&�&�&�&rc�F�g}|�i}tj|g��D]@\}}}td�|D����r� |�|d|||vf��d||<�A|���|�||j��}|�|d|��S)z2Generate an HTML index for a directory of modules.Nc3�PK�|]!}dt|��cxkodkncV��"dS)i�i��N)�ord�r��chs  r�	<genexpr>z HTMLDoc.index.<locals>.<genexpr>�sD����@�@�R�F�c�"�g�g�/�/�/�/��/�/�/�/�@�@�@�@�@�@rrKrTr�)r�r��anyrr�r�r�rx)r:rr�r�r�r#r�ris        rr�z
HTMLDoc.index�s��������X�%,�%9�3�%�%@�%@�	�	�!�H�d�E��@�@�4�@�@�@�@�@�
���N�N�D�"�e�T�X�-=�>�?�?�?��H�T�N�N��������#�#�G�T�_�=�=�����s�G�X�6�6�6r�rK)rorKNrlr�r��NNN)r)rrr@r:�_repr_instancerrMrjrnrvrxr}r�r�r�r�r�r�r�r�r�r�rrr:rrr6rr�r�rrrereDs�������1�1��X�Z�Z�N���D�
�
"�F�
&�
&�
&�&�&�&�&�34�19�U�U�U�U�**�*�*�
<�<�<�
5�
5�
5�G�F�F����*�*�*�/�/�/�&O�O�O�
3�
3�
3�8�8�8�#'�b�"�b�' �' �' �' �V*�*�*�*�&s�s�s�s�j%)�d�"�b�`>�`>�`>�`>�D2�2�2�'+���R���d�W<�W<�W<�W<�r � � � ��K�'�'�'�'�

7�
7�
7�
7�
7�
7rrec�.�eZdZdZd�Zd�Zd�ZeZd�ZdS)�TextReprzAClass for safely making a text representation of a Python object.c�t�tj|��dx|_|_d|_dx|_|_dSr<r@rFs rr�zTextRepr.__init__�rGrc�f�tt|��d��rfdd�t|��j�����z}t||��rt||��||��St
tt|����|j	��SrQ)
r�rCrXr)rrrtrxrrErSs    rrVzTextRepr.repr1�s����4��7�7�J�'�'�	;� �3�8�8�D��G�G�,<�,B�,B�,D�,D�#E�#E�E�J��t�Z�(�(�
;�0�w�t�Z�0�0��E�:�:�:��G�D��G�G�$�$�d�m�4�4�4rc��t||j��}t|��}d|vr*dt|dd��vrd|dz|z|dzS|S)Nr�rXrKrYr)rtrDrrlrZs     rr]zTextRepr.repr_string�sa���A�t�~�&�&����:�:���4�<�<�D���%��(D�(D�D�D���!��$�t�+�h�q�k�9�9��rc��	ttt|����|j��S#d|jjzcYSxYwr_)rtrxrrDr+r)r`s   rrazTextRepr.repr_instance�sF��	:����Q���(�(�$�.�9�9�9��	:�"�Q�[�%9�9�9�9�9���s	�.1�AN)	r)rrr@r�rVr]rbrar�rrrara�s]������K�K�-�-�-�5�5�5�����H�:�:�:�:�:rrac��eZdZdZe��ZejZd�Zdd�Zd�Z	dd�Z
dd	�Zdd
�Zd�Z
dd�Zdd
�ZeZdddd�d�ZdS)�TextDocz'Formatter class for text documentation.c�@�d�d�|D����S)z(Format a string in bold by overstriking.rKc3�&K�|]}|dz|zV��
dS)�Nr�rYs  rr[zTextDoc.bold.<locals>.<genexpr>�s*����5�5�"�r�D�y�2�~�5�5�5�5�5�5r)rXrLs  r�boldzTextDoc.bold�s#���w�w�5�5��5�5�5�5�5�5r�    c���|sdS�fd�|�d��D��}|r|d���|d<d�|��S)z6Indent text by prepending a given prefix to each line.rKc���g|]}�|z��Sr�r�)r�r��prefixs  �rrz"TextDoc.indent.<locals>.<listcomp>�s���<�<�<�4��$��<�<�<rrSr)rrOrX)r:rjrorYs  ` r�indentzTextDoc.indent�sb�����B�B�<�<�<�<�4�:�:�d�+;�+;�<�<�<���0�e�B�i�.�.�0�0�%��)��y�y����rc��|�|�����}|�|��dz|zdzS)z&Format a section with a given heading.rSrz)rprOrk)r:rhri�clean_contentss    rrvzTextDoc.section�s@�����X�.�.�5�5�7�7���y�y����$�&��7�&�@�@rNrKc	�p��d}|D]�}t|��td��urS|\}}||zt|���z}|r0||fkr)�fd�|D��}	|dd�|	��zz}|dz}�st|��tg��ur||�|�||dz��z}��|S)zBRender in text a class tree as returned by inspect.getclasstree().rKr�c3�8�K�|]}t|���V��dSr��r^)r�r�r]s  �rr[z%TextDoc.formattree.<locals>.<genexpr>�s-�����D�D��y��G�4�4�D�D�D�D�D�Drr)r�rSrl)rCr^rXr�)
r:r�r]r�rorPr�r�r�r�s
  `       rr�zTextDoc.formattree�s�������
	8�
	8�E��E�{�{�d�2�h�h�&�&� ���5��&��9�Q��+@�+@�@���B�U�v�i�/�/�D�D�D�D�e�D�D�D�G�#�f�t�y�y��/A�/A�&A�A�F��$�����e����R���(�(��$�/�/��7�A�v���#8�#8�8����
rc	��|j}tt|����\}}|�d||od|zz��}t	|dd��}|�|��}	|	�||�d|	dz��z}|r||�d|��z}g}
t
j|tj��D]G\}}|�t
j	|��p||ur(t|||��r|
�||f���Hg}
t
j|tj��D]Y\}}|�*t
j
|��st
j	|��|ur(t|||��r|
�||f���Zg}t
j|t��D]-\}}t|||��r|�||f���.g}t��}t!|d��r�t#j|j��D]K\}}}|�|��|r|�|d	z���6|�|���L|���||�d
d�|����z}g}t
j|tj��D];\}}|j�|dz��r||vr|�|���<|r@|���||�d
d�|����z}|
r�d�|
D��}|�t
j|d��|��g}|
D]/\}}|�|�|||�����0||�dd�|����z}|
r`g}|
D]/\}}|�|�|||�����0||�dd�|����z}|rbg}|D]1\}}|�|�|||d������2||�dd�|����z}t!|d��ret;|j��}|dd�dkr*|dd�dkr|dd����}||�d|��z}t!|d��r+||�dt;|j ����z}t!|d��r+||�dt;|j!����z}t!|d��r+||�d t;|j"����z}	t
j#|��}n#tH$rd!}YnwxYw||�d"|��z}|S)#z5Produce text documentation for a given module object.�NAMEr�r�NzMODULE REFERENCEa.

The following documentation is automatically generated from the Python
source files.  It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations.  When in doubt, consult the module reference at the
location listed above.
�DESCRIPTIONr��
 (package)zPACKAGE CONTENTSrSr�
SUBMODULESc��g|]\}}|��Sr�r�r�s   rrz%TextDoc.docmodule.<locals>.<listcomp>+s��9�9�9�:�3���9�9�9rrT�CLASSES�	FUNCTIONS�F)rq�DATAr�r�r�rr��VERSIONr��DATEr��AUTHORr��CREDITSr"�FILE)%r)rZrQrvrr4rr~r r�r�rrdr-rh�setr�r�r�r��addr�rXrcr�r�r�rrrDr�rVr�r�r�r.rG)r:rAr#r�r��synop�descrPr�r3r�r�r�r�r�r��
modpkgs_namesr�r]r��
submodulesr�rir�r�s                         rrzTextDoc.docmodule�s\������v�f�~�~�.�.���t����f�d�e�.E���
�&F�G�G���f�i��.�.������'�'�����d�l�l�+=�v�I�@����F��	@��d�l�l�=�$�?�?�?�F���!�,�V�W�_�E�E�	1�	1�J�C�����%�e�,�,�6��6�A�A��s�C��0�0�1��N�N�C��<�0�0�0����!�,�V�W�5F�G�G�	/�	/�J�C�����!�%�(�(� �,3�,=�e�,D�,D��,N�,N��s�C��0�0�/��L�L�#�u��.�.�.����!�,�V�V�<�<�	*�	*�J�C���3��V�,�,�
*����S�%�L�)�)�)�������
��6�:�&�&�
	8�,3�,@���,Q�,Q�
,�
,�(��'�5��!�!�'�*�*�*��,��N�N�7�\�#9�:�:�:�:��N�N�7�+�+�+�+��L�L�N�N�N��d�l�l�"�D�I�I�g�$6�$6�8�8�8�F��
�!�,�V�W�5E�F�F�	'�	'�J�C���~�(�(����4�4�
'��M�9Q�9Q��!�!�#�&�&�&���	5��O�O�����d�l�l��d�i�i�
�3�3�5�5�5�F��	K�9�9��9�9�9�I�����$�Y��2�2�D�:�:�;�H�%�
A�
A�
��U�����
�
�e�S�$� ?� ?�@�@�@�@��d�l�l�9�d�i�i��6I�6I�J�J�J�F��	M��H�#�
A�
A�
��U�����
�
�e�S�$� ?� ?�@�@�@�@��d�l�l�;��	�	�(�8K�8K�L�L�L�F��	H��H�"�
L�
L�
��U�����
�
�e�S�$�r�
� J� J�K�K�K�K��d�l�l�6�4�9�9�X�3F�3F�G�G�G�F��6�=�)�)�	?��&�,�-�-�G��s��s�|�1�1�1�g�b�c�c�l�c�6I�6I�!�"�R�%�.�.�.�0�0���d�l�l�9�g�>�>�>�F��6�:�&�&�	I��d�l�l�6�3�v��3G�3G�H�H�H�F��6�<�(�(�	M��d�l�l�8�S��9J�5K�5K�L�L�L�F��6�=�)�)�	O��d�l�l�9�c�&�:L�6M�6M�N�N�N�F�	 ��%�f�-�-�D�D���	 �	 �	 ��D�D�D�	 �����$�,�,�v�t�4�4�4���
s�9W�W�Wc�R��������j}|p|}�j}�jfd�}||krd��|��z}n��|��dz|z}|r+t	||��}	|dd�|	��zz}g}
|
j�	tj���}n#ttf$rd}YnwxYw|r(t|��}|r|dkr�||zdz��t���}
|
r�|
dz��ttj�����}t|��d	kr2�d
��|D]}�d||��z����d��t!d
�t"����D��tj���}t|��}d}|rX�d��|d|�D]}�d|z���||kr!�dt||z
��zdz���d��G�fd�d��}|��������fd�}����fd�}�����fd�}�fd�t)���D��}|r�|r|����n|dd	�t-|�fd���\}}�t.jur�t.jur|}�\��urd}ndt3��j��z}t5|���|d|z|d���}|d|z|d ���}|d!|z|d"���}|d#|z|d$���}|d%|z|d&���}|d'|z|d(���}|}|��d�|
��}
|
s|dzS|dz��|
���d)��zdzS)*z4Produce text documentation for a given class object.c�"�t||��Sr�ru)r�rs  r�makenamez"TextDoc.docclass.<locals>.makenameVs���Q��?�?�"r�class z	 = class r)r�Nr*rSrUzMethod resolution order:rlrKc3�K�|]=}|j�d��s!|jdk�'t|j��V��>dS)r�r-N)r)r�rrD)r�r"s  rr[z#TextDoc.docclass.<locals>.<genexpr>{sa����
S�
S�3��L�+�+�C�0�0�
S�58�^�z�5Q�5Q����
�
�5Q�5Q�5Q�5Q�
S�
Srr�r�zBuilt-in subclasses:z    ... and z other subclassesc� ��eZdZd�Z�fd�ZdS)�(TextDoc.docclass.<locals>.HorizontalRulec��d|_dSr�r�rFs rr�z1TextDoc.docclass.<locals>.HorizontalRule.__init__�r�rc�:��|jr�d��d|_dS)NzF----------------------------------------------------------------------rTr�r�s �rr�z.TextDoc.docclass.<locals>.HorizontalRule.maybe�r�rNr�r�s�rr�r��r�rr�c
�J��t||��\}}|r������|��|D]j\}}}}	t�
|��}���||�	�
|�����;#t$r#���||�	����Y�gwxYw|Sr�r�)
r�r�r�r�r#r�r�r�r�r�rAr�r:s
        �����rr�zTextDoc.docclass.<locals>.spill�s����#�E�9�5�5�I�B���
E����
�
�
���S�	�	�	�24�	E�	E�.�D�$���E� '��� 5� 5����T�]�]�5�(,�c�6�7�D�D�E�E�E�E��%�=�=�=���T�\�\�%��s�;�;�<�<�<�<�<�=�����Ls�A3�3*B �B c����t||��\}}|rI�����
|��|D]'\}}}}�
��||�	�����(|Sr�rrs        ����rrz*TextDoc.docclass.<locals>.spilldescriptors�rrc
�L��t||��\}}|r��
����
|��|D]k\}}}}t|��}	t�|��}	n#t$r|j|}	YnwxYw�
��|	|�d|���dz���l|S)Nr~�rqr=rS)r�r�rQrr8�__dict__r)r�r�r�r�r#r�r�r�r=r9r�r�rAr�r:s          �����rrz#TextDoc.docclass.<locals>.spilldata�s����#�E�9�5�5�I�B���

����
�
�
���S�	�	�	�24���.�D�$��� ��-�-�C�5�%�f�d�3�3����)�5�5�5�%�.�t�4����5�����D����s�D�#�b�c��J�J��������Ls�A � A:�9A:c�H��g|]\}}}}t|�����||||f��Srr	r
s     �rrz$TextDoc.docclass.<locals>.<listcomp>�rrrc���|d�uSrr�rs �rr�z"TextDoc.docclass.<locals>.<lambda>�rrrrzMethods %s:
c��|ddkSrr�rs rr�z"TextDoc.docclass.<locals>.<lambda>�rrzClass methods %s:
c��|ddkSrr�rs rr�z"TextDoc.docclass.<locals>.<lambda>�rrzStatic methods %s:
c��|ddkSrr�rs rr�z"TextDoc.docclass.<locals>.<lambda>�rrzReadonly properties %s:
c��|ddkSrr�rs rr�z"TextDoc.docclass.<locals>.<lambda>�r rzData descriptors %s:
c��|ddkSr"r�rs rr�z"TextDoc.docclass.<locals>.<lambda>�r#rzData and other attributes %s:
c��|ddkSr%r�rs rr�z"TextDoc.docclass.<locals>.<lambda>�r&rz |  )r)rrrk�maprXrrr.r/rGrDrQrr+rW�sortedrC�__subclasses__r1r�r,r�r-rAr^r�rprO)r:rAr#r�r�r0r�r�rhr�rir.r6r=r1r<�
subclasses�no_of_subclasses�MAX_SUBCLASSES_TO_DISPLAY�subclassnamer�r�rrr�r3r4r�r�rs`` `                       @@@rrzTextDoc.docclassPs����������?����x��� �� �+�	#�	#�	#�	#��8����t�y�y��2�2�2�E�E��I�I�d�O�O�k�1�H�<�E��	8��(�E�*�*�G��F�T�Y�Y�w�%7�%7�7�7�E������	��)�&�1�1�I�I���I�&�	�	�	��I�I�I�	�����	,��)�n�n�G��
,�7�d�?�?���T�G�^�d�*�+�+�+��V�n�n���	��D��t������G�N�6�*�*�+�+���s�8�8�a�<�<��D�+�,�,�,��
.�
.����V�h�h�t�n�n�,�-�-�-�-��D��H�H�H��
S�
S�$�*=�*=�f�*E�*E�
S�
S�
S��	�
�
�
�
�
�z�?�?��$%�!��	��D�'�(�(�(� *�+E�,E�+E� F�
,�
,����V�l�*�+�+�+�+��";�;�;���^��)�,E�E�F�F�G�(�)�*�*�*�
�D��H�H�H�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!��^�
�
��	�	�	�	�	�	�	�	�	�"	�	�	�	�	�	�	�	�
	�
	�
	�
	�
	�
	�
	�
	�
	�3�3�3�3�/C�F�/K�/K�3�3�3���!	��
(��K�K�M�M�	�	�!�!�H�Q�K�	�*�5�2M�2M�2M�2M�N�N��E�9��X�_�,�,��h�o�1M�1M�!����f�$�$�$���)�I�i�6<�6G�-I�-I�I��
�E�6�*�*�*��E�/�C�/��4�4�6�6�E��E�/�#�5�u�:�:�<�<�E��E�0�3�6��;�;�=�=�E�$�$�%@�3�%F��%J�%J�L�L�E�$�$�%=��%C�U�%H�%H�J�J�E��I�?�#�E�u�6�6�8�8�E��E�C�!	�F�9�9�X�&�&���	 ��4�<���t�|�d�k�k�(�/�/�*;�*;�V�D�D�D�t�K�Ks�B)�)B?�>B?c�2�d|�|��zSr8rTrOs  rr:zTextDoc.formatvalue�s���T�Y�Y�v�&�&�&�&rc�v�|j}|p|}|�|}d}d}d}	t|��r^|j}
|
|urt|dd��}	n�t	j|
��rdt
|
|��z}n�dt
|
j|��z}npt	j|��st	j	|��rF	|j
}|�dt
||��z}n*||urdt
||��z}n#t$rYnwxYw|}	t	j|	��r?|�=|	j
|j
ks|	j|jd	z|zkrt|	|��}|rd
|z}t	j|��st	j|��rd}
nd}
||kr|�|��}nN|�1t	j||g��|urd}|�d��rd}|�|��d
z|z}d}t	j|��ro	t	j|��}n#t.t0f$rd}YnwxYw|r>t3|��}|dkr)|�|��dz}|js
|dd�}|sd}|
|z|z|z}|r|dzSt7|��pd}|dz|o)|�|�����dzzS)z;Produce text documentation for a function or method object.NrKFr&r<r=r>r?rr@rAT� = rBz lambda rTrrCrS)r)r{r*rrr r^r+r1rDr3r8r,rrrarErFrkrGr�rdr.r/rGrDrHrQrprO)r:rAr#r�r�r�r0rIrJrKrLrMrNrOrhr6r.r5r=s                   rrzTextDoc.docroutine�sd���?����x���?��G��������F�#�#�	��_�F���|�|� ���T�:�:������(�(�
+�,�y���/E�/E�E���/�)��$�c�3+�3+�+����(��0�0�	��%�f�-�-�	�
?�!�.���:�/�)�H�c�2J�2J�J�D�D��W�,�,�#�i��#�&>�&>�>�D���
"�
�
�
���
�����F���f�%�%�	*�'�*=����!3�3�3���7�#7�#�#=��#H�H�H��v�s�+�+�E��
*�!�E�)���'��/�/�	 ��*�6�2�2�	 �%�N�N��N��8����I�I�h�'�'�E�E����&�r�8�R�8�8�F�B�B����?�?�8�,�,���D��I�I�d�O�O�e�+�h�6�E�����V�$�$�
	0�
!�#�-�f�5�5�	�	���	�*�
!�
!�
!� �	�	�	�
!�����
0��i�.�.���z�)�)� �I�I�d�O�O�j�8�E�"�1�0�")�!�B�$�-���	��G���%��/�$�6���	L��$�;����.�.�&�B�C��$�;�#�"J�$�+�+�c�*:�*:�*A�*A�*C�*C�d�*J�K�Ks$�,C!�!
C.�-C.�4H	�	H�Hc��g}|j}|r)||�|����|d��t|��pd}|r)||�|����|d��d�|��S)z1Produce text documentation for a data descriptor.rSrK)rrkrQrprXrRs	         rrzTextDoc.docdata=s������~���	��D����4���!�!�!��D��J�J�J��V�n�n�"����	��D����S�!�!�"�"�"��D��J�J�J��w�w�w���rr�c�P�|�|��}|r1|r|dzpd|z}	|t|	��z
}
|
dkr
|d|
�dz}|r|�|��dzpd|z}	|st|��}|r+|	d|�t|����zdzz
}	|	S)z-Produce text documentation for a data object.r�rKrNrorS)rrWrkrQrprD)r:rAr#r�r�rqr=r�rr��chops           rrzTextDoc.docotherMs����y�y�� � ���	4��)�T�E�\�/�R�4�7�D��C��I�I�%�D��a�x�x��U�d�U��e� 3���0����4���5�0�6�B�$�>���	!���.�.�C��	8��D�4�;�;�s�3�x�x�0�0�0�4�7�7�D��r)rl)NrKr�)NNNNr^)r)rrr@rar_rrkrprvr�rrr:rrr6rr�rrrgrg�s������1�1��X�Z�Z�N���D�6�6�6� � � � �A�A�A����� c�c�c�c�JXL�XL�XL�XL�t'�'�'�ML�ML�ML�ML�^ � � � ��K�
��$�
�
�
�
�
�
�
rrgc��eZdZdZd�ZdS)�
_PlainTextDocz2Subclass of TextDoc which overrides string stylingc��|Sr�r�rLs  rrkz_PlainTextDoc.bold^s���rN)r)rrr@rkr�rrr�r�\s)������<�<�����rr�c�@�t��at|��dS)zCThe first time this is called, determine what kind of pager to use.N)�getpager�pagerrws rr�r�cs��
�J�J�E�	�$�K�K�K�K�Krc�h��ttjd��stSttjd��stStj���rtj���stStjdkrtStj�	d��ptj�	d����r@tjdkr�fd�Stj�	d��dvr�fd	�S�fd
�Stj�	d��dvrtStjdkrd�Sttd��rtj
d
��dkrd�Sddl}|���\}}tj
|��	ttd��r2tj
d|z��dkrd�tj|��Sttj|��S#tj|��wxYw)z2Decide what method to use for paging through text.�isatty�
emscripten�MANPAGER�PAGER�win32c�>��tt|�����Sr���
tempfilepager�plain�rj�	use_pagers �rr�zgetpager.<locals>.<lambda>vs���
�e�D�k�k�9� E� E�r�TERM)�dumb�emacsc�>��tt|�����Sr�)�	pipepagerr�r�s �rr�zgetpager.<locals>.<lambda>xs���	�%��+�+�y� A� A�rc�$��t|���Sr��r�r�s �rr�zgetpager.<locals>.<lambda>zs���	�$�	� :� :�rc�<�tt|��d��S)Nzmore <r�rws rr�zgetpager.<locals>.<lambda>~s��M�%��+�+�x�@�@�r�systemz(less) 2>/dev/nullrc�"�t|d��S)N�lessr�rws rr�zgetpager.<locals>.<lambda>�s��I�d�F�3�3�rNz	more "%s"c�"�t|d��S)N�morer�rws rr�zgetpager.<locals>.<lambda>�s��	�$�� 7� 7�r)r�r	�stdin�
plainpager�stdoutr��platformrr/rr��tempfile�mkstemp�close�unlink�ttypager)r��fdr�r�s   @rr�r�is����3�9�h�'�'�����3�:�x�(�(�����9������S�Z�%6�%6�%8�%8����
�|�|�#�#����
���z�*�*�E�b�j�n�n�W�.E�.E�I��;��<�7�"�"�E�E�E�E�E�
�Z�^�^�F�
#�
#�'8�
8�
8�A�A�A�A�A�:�:�:�:�:�	�z�~�~�f���!2�2�2���
�|�w���@�@�@��r�8���4���+?�!@�!@�A�!E�!E�3�3�3��O�O�O��%�%�'�'�N�R���H�R�L�L�L���2�x� � �	�R�Y�{�X�/E�%F�%F�!�%K�%K�7�7�	�	�(������
�	�(�������	�(�������s�92H�H�H1c�.�tjdd|��S)z%Remove boldface formatting from text.z.rK)rMrNrws rr�r��s��
�6�%��T�"�"�"rc�H�ddl}|�|d|jd���}	|j5}	|�|��n#t
$rYnwxYwddd��n#1swxYwYn#t$rYnwxYw		|���dS#t
$rYnwxYw�()z3Page through text by feeding it to another program.rNT�backslashreplace)�shellr��errors)�
subprocess�Popen�PIPEr��write�KeyboardInterruptr��wait)rj�cmdr��proc�pipes     rr�r��s4���������C�t�:�?�#5��7�7�D�	
�
�Z�	�4�
��
�
�4� � � � ��$�
�
�
���
����	�	�	�	�	�	�	�	�	�	�	����	�	�	�	����
�
�
���
�����	��I�I�K�K�K��E�� �	�	�	�
�D�	����	si�A+�A�A�A�
A�
A�A�A�A+�A#�#A+�&A#�'A+�+
A8�7A8�=B�
B �B c	��ddl}|���5}tj�|d��}t|ddtjdkrtjd��nd���5}|�	|��ddd��n#1swxYwYtj
|dz|zd	z��ddd��dS#1swxYwYdS)
z<Page through text by invoking a program on a temporary file.rNz	pydoc.out�wr�r�)r��encodingz "r�)r��TemporaryDirectoryrr
rXr�r	r��device_encodingr�r�)rjr�r��tempdirr�r�s      rr�r��sY���O�O�O�	�	$�	$�	&�	&�/�'��7�<�<���5�5��
�(�C�(:��,�'�)�)��-�a�0�0�0�/3����	���J�J�t����		�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
	�	�#��*�x�'�#�-�.�.�.�/�/�/�/�/�/�/�/�/�/�/�/����/�/�/�/�/�/s6�AC�1B�C�B	�C�B	� C�C�Cc��ttjdd��pd}|�|d���|��S)Nr��utf-8r�)rr	r��encode�decode)rjr�s  r�_escape_stdoutr��s=���s�z�:�t�4�4�?��H��;�;�x�!3�4�4�;�;�H�E�E�Erc	��tt|�����d��}	ddl}tj���}|�|��}|�|��d�}n'#tttjf$rd}d�}YnwxYw		ttj�dd����}n#t"$rd}YnwxYw|dkrd}|dz
x}}tj�d�|d|���dz��||d��rtj�d	��tj���|��}	|	d
vr tj�d��n�|	dvr1tj�d||zdz��|dz}��|	d
vr||z
|z
}|dkrd}tj�dd�||||z���zdz��||z}||d���|r|�||j|��dSdS#|r|�||j|��wwxYw)z%Page through text on a text terminal.rSrNc�@�tj�d��Sr})r	r�r�r�rrr�zttypager.<locals>.<lambda>�s��#�)�.�.��+�+�rc�^�tj���dd�dd�S)NrrT)r	r�r�r�rrr�zttypager.<locals>.<lambda>�s&��#�)�,�,�.�.�s��s�3�B�Q�B�7�r�LINESrT�z
-- more --)�q�Qz
          
)�
rS)�b�B�)r�r�r�ttyr	r��fileno�	tcgetattr�	setcbreakr
r8�io�UnsupportedOperationr�rr/rr/r�r�rX�flush�	tcsetattr�	TCSAFLUSH)
rjrYr�r��old�getchar�hrY�incr�s
          rr�r��s����.��&�&�'�'�-�-�d�3�3�E�8��
�
�
�
�Y�
�
�
�
���m�m�B�����
�
�b����+�+�������)@�A�8�8�8���7�7����8����2�	��B�J�N�N�7�A�.�.�/�/�A�A���	�	�	��A�A�A�	������6�6��A��a�%���C��
������5��#��;�/�/�$�6�7�7�7��A�B�B�i�	��J���\�*�*�*��J��������	�	�A��J����
� � �!1�2�2�2���l�"�"��
� � �!1�E�!�H�!<�t�!C�D�D�D���E����&�&�&���G�c�M���q�5�5�a�!��J���T�D�I�I�e�A�a��e�G�n�$=�$=�=��D�E�E�E��C��A�!�A�B�B�i�	�&�	2��M�M�"�c�m�S�1�1�1�1�1�	2�	2��3�	2��M�M�"�c�m�S�1�1�1�1�	2���s=�AB�!B%�$B%�*-C�I*�C'�$I*�&C'�'E!I*�*!Jc�x�tj�tt	|������dS)z>Simply print unformatted text.  This is the ultimate fallback.N)r	r�r�r�r�rws rr�r��s.���J���U�>�$�/�/�0�0�1�1�1�1�1rc��tj|��rA|jtjvr
d|jzSt|d��r
d|jzSd|jzStj|��r
d|jzStj|��r$d|jj	�d|jj�d|j��Stj
|��r$d|jj	�d|jj�d|j��Stj|��r
d	|jzStj|��r
d
|jzStj
|��r
d|jzSt|��jS)z/Produce a short description of the given thing.zbuilt-in module r�zpackage zmodule zbuilt-in function zgetset descriptor rzmember descriptor r�z	function zmethod )rrcr)r	rr�r-�isgetsetdescriptorr3rr4r r,r(rC)�things r�describer�s|�������.��>�S�5�5�5�%���6�6��5�*�%�%�	.����.�.��u�~�-�-������5�#�e�n�4�4��!�%�(�(�����)�)�)�5�+=�+F�+F�+F��N�N��	��!�%�(�(�����)�)�)�5�+=�+F�+F�+F��N�N��	���u���)��%�.�(�(���%� � �,��U�^�+�+������*��5�>�)�)���;�;��rc��d�|�d��D��}d\}}|t|��krLtd�|d|dz���|��}|r||dz}}nn|t|��k�L|r|}nt}||d�D]%}	t||��}�#t$rYdSwxYw|S)z@Locate an object by name or dotted path, importing as necessary.c��g|]}|�|��Sr�r�)r�rs  rrzlocate.<locals>.<listcomp>s��6�6�6�d��6�T�6�6�6rrr�NrT)rrWrrXr-rr8)r
rr�r��n�
nextmodulerArs        r�locaters���6�6�d�j�j��o�o�6�6�6�E��I�F�A�
�c�%�j�j�.�.������t��!��t�� 5� 5�y�A�A�
��	�:�q�1�u�q�v�v���c�%�j�j�.�.���������a�b�b�	����	��V�T�*�*�F�F���	�	�	��4�4�4�	�����Ms�B.�.
B=�<B=c���t|t��r(t||��}|�td|z���||fSt	|dd��}|t|t��r|ndfS)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))r.rDrr
r)rrrAr#s    r�resolvers����%����
>���y�)�)���>��,�/4�4�5�5�
5��u�}���u�j�$�/�/���j��s�3�3�=�d�d��=�=r� Python Library Documentation: %sc�N�|�t}t||��\}}t|��}tj|��}|r(d|vr$|d|d|�d���zz
}n|r||ur
|d|jzz
}tj|��swtj|��sctj	|��sOtj
|��s;t|��s,t|d��r|j
}nt|��}|dz
}||zdz|�||��zS)zBRender text documentation, given an object or a path to an object.Nrz in z in module �
__origin__z objectrz)rjrrrr��rfindr)rcr rdr2rIr�rrCr)rrhr�rendererrAr#r�r�s        r�
render_docr,sL�������5�)�,�,�L�F�D��F���D�
�
�v�
&�
&�F��0��t������.�t�z�z�#���.�/�/�/���	�0�F�&�(�(��
���/�/����V�$�$���o�f�%�%�����'�'���&�v�.�.���f�o�o�	��6�<�(�(�	��&�F�F��&�\�\�F��I��D��4�<�&� �8�#4�#4�V�T�#B�#B�B�BrFc�H�|�K	tt|||����dS#t$r}|r�t|��Yd}~dSd}~wwxYw	t|||t��}n&#t$r}t|��}Yd}~nd}~wwxYw|�|��dS)zCDisplay text documentation, given an object or a path to an object.N)r�rr
�print�	plaintextrDr�)rrhr�output�is_clir�r�s       rr=r=Gs����~�	��*�U�E�9�5�5�6�6�6�6�6���	�	�	��
���#�J�J�J�J�J�J�J�J�J�����	����
	��5�%��I�>�>�A�A���	�	�	��C���A�A�A�A�A�A�����	�������Q�����s,�$�
A�A�A�A'�'
B
�1B�B
c�X�t||��\}}t�t|��t�||����}t|dzdd���5}|�|��ddd��n#1swxYwYtd|dz��dS)z<Write HTML documentation to a file in the current directory.r-r�r�)r�N�wrote)r�htmlrjrrr�r�r)rrrAr#rjr�s      r�writedocr"Xs����5�)�,�,�L�F�D��9�9�X�f�%�%�t�}�}�V�T�'B�'B�C�C�D�	
�d�W�n�c�G�	4�	4�	4����
�
�4����������������������	�'�4�'�>�"�"�"�"�"s�*B�B�BrKc�f�|�i}tj|g|��D]\}}}t|���dS)zAWrite out HTML documentation for all modules in a directory tree.N)r��
walk_packagesr")r�pkgpath�doner�r]r�s      r�	writedocsr'`sF���|�B�T�$+�$9�3�%��$I�$I��� ��'�5�������
�Frc�>�eZdZidd�dd�dd�dd�dd�d	d
�dd�d
d�dd�dd�dd�dd�dd�dd�dd�dd�dd�id d!�d"d#�d$d%�dd&�d#d'�d(d)�d*d+�d,d-�d.d/�d0d�d1d�d2d3�d4d5�d6d7�dd8�d9d:�dd;��d<d=i�Zd>�d?D��Zd@dAdBdCge�RdDdEdFdGdHdIdJ�ZdKdLdMdNdOdPdQdRdSdTdUdVdVdWdWdX�Ze���D]1\ZZ	e	D])Z
e�e
e��ZeevredYzezZeee
<�*�2[[	[
[idZd[�dRd\�d]d^�d_d`�dadb�dcdd�dedf�dgdh�didj�dkdl�dmdn�dodp�dqdr�dsdt�dudv�dwdZ�dxdZ�idydz�dOd{�d|d}�d~d�d�d��d�d#�d�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d���id�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d��dSd��d�d��d�dk�d�d��d�d��d�d��dnd��d�d���id�d��d�d��d�d��d�d��dLd��d�d��d�d��d�d“d�dēd+dœddƓd�d	�d�dɓd�d˓d�d�d�d6�d�d#��dd�d�d�d�dӜ�Zd�dՄZ
edք��Zedׄ��Zd؄Ze��ZefdلZdڄZdۄZd�d݄ZdބZd�d�Zd�Zd�Zd�Zd�d�Zd�d�Zd�Zd�d�Z d�S)��Helper�FalserK�None�True�and�BOOLEAN�as�with�assert)r1rK�async)r2rK�await)r3rK�break)r4�	while for�class)r6zCLASSES SPECIALMETHODS�continue)r7r5�def)�functionrK�del)r:�BASICMETHODS�elif�if�else)r>r5�except�try�finally�for)rBzbreak continue while�from�import�global)rEznonlocal NAMESPACES)r=�
TRUTHVALUE)rD�MODULES�in)rH�SEQUENCEMETHODS�is�
COMPARISON�lambda)rLr}�nonlocal)rMzglobal NAMESPACES�not�or�pass)rPrK�raise)rQ�
EXCEPTIONS�return)rSr})r@rR�while)rTzbreak continue if TRUTHVALUE)r0z CONTEXTMANAGERS EXCEPTIONS yield�yield)rUrKc�"�g|]}dD]}||z���
S)��'r�r�)r��pr�s   rrzHelper.<listcomp>�s)��L�L�L�a��L�L�A�A��E�L�L�L�Lr)r��frY�urXz'''r�r�)�+r�*�**r,z//�%�<<�>>rI�|�^�~rJrK�<=�>=�==�!=�<>)rJrKrerfrgrhri)rrd)z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//=)r`rarIrbrcrd)�j�J)�STRINGS�	OPERATORSrK�UNARY�AUGMENTEDASSIGNMENT�BITWISE�COMPLEXzOPERATORS FORMATTING�POWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTS�ELLIPSISzSLICINGS DICTIONARYLITERALSz	def classrl�PRIVATENAMESzPRIVATENAMES SPECIALMETHODS�
BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)r_r^�,rro�:�@r�r�r��`r�r��[�]r�TYPES)�typeszRSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect)�stringsz4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES�
STRINGMETHODS)zstring-methodszSTRINGS FORMATTING�
FORMATTING)�
formatstringsrm�UNICODE)r~z:encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPES�NUMBERS)�numberszINTEGER FLOAT COMPLEX TYPES�INTEGER)�integersz	int range�FLOAT)�floatingz
float mathrq)�	imaginaryz
complex cmath�	SEQUENCES)�typesseqz$STRINGMETHODS FORMATTING range LISTS�MAPPINGS�DICTIONARIESr})�typesfunctionsz	def TYPES�METHODS)�typesmethodszclass def CLASSES TYPES�CODEOBJECTS)zbltin-code-objectszcompile FUNCTIONS TYPES�TYPEOBJECTS)zbltin-type-objectsztypes TYPES�FRAMEOBJECTS�
TRACEBACKS�NONE)zbltin-null-objectrK)zbltin-ellipsis-object�SLICINGS�SPECIALATTRIBUTES)�specialattrsrKr|)r}z!class SPECIALMETHODS PRIVATENAMESrG)�typesmodulesrD�PACKAGES�EXPRESSIONS)zoperator-summaryz�lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIESrm�
PRECEDENCE�OBJECTS)�objectsr|�SPECIALMETHODS)�specialnameszbBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSESr;)�
customizationzhash repr str SPECIALMETHODS�ATTRIBUTEMETHODS)zattribute-accesszATTRIBUTES SPECIALMETHODS�CALLABLEMETHODS)zcallable-typeszCALLS SPECIALMETHODSrI)�sequence-typesz(SEQUENCES SEQUENCEMETHODS SPECIALMETHODS�MAPPINGMETHODS)r�zMAPPINGS SPECIALMETHODS�
NUMBERMETHODS)z
numeric-typesz*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS�	EXECUTION)�	execmodelz%NAMESPACES DYNAMICFEATURES EXCEPTIONS�
NAMESPACES)�namingz3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES�DYNAMICFEATURES)zdynamic-featuresrK�SCOPING�FRAMESrR)r$ztry except finally raise�CONVERSIONS)�conversionsrK�IDENTIFIERS)�identifierszkeywords SPECIALIDENTIFIERS�SPECIALIDENTIFIERS)z
id-classesrK)zatom-identifiersrK�LITERALS)z
atom-literalsz=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS�TUPLES�
TUPLELITERALS)�	exprlistszTUPLES LITERALS�LISTS)ztypesseq-mutable�LISTLITERALSr�)�listszLISTS LITERALS)�typesmapping�DICTIONARYLITERALSr�)r5zDICTIONARIES LITERALS�
ATTRIBUTES)zattribute-referencesz(getattr hasattr setattr ATTRIBUTEMETHODS�
SUBSCRIPTS)�
subscriptionsrIr�)�slicingsrI�CALLS)�callsr�)�powerr�rn)�unaryr��BINARY)�binaryr��SHIFTING)�shiftingr�rp)�bitwiser�)�comparisonszEXPRESSIONS BASICMETHODS)�booleanszEXPRESSIONS TRUTHVALUE�	ASSERTION�
ASSIGNMENT)�
assignmentroro)�	augassignr��DELETION�	RETURNING�	IMPORTING)�compoundzfor while break continue)�truthz if while and or not BASICMETHODS)�debugger�pdb)zcontext-managersr0)�CONDITIONAL�LOOPINGrF�	DEBUGGING�CONTEXTMANAGERSNc�"�||_||_dSr�)�_input�_output)r:�inputrs   rr�zHelper.__init__s���������rc�(�|jptjSr�)r�r	r�rFs rr�zHelper.inputs���{�'�c�i�'rc�(�|jptjSr�)r�r	r�rFs rrz
Helper.outputs���|�)�s�z�)rc��tj��dddkr|��dSd|jj�d|jj�d�S)NrTrn�?rKrJrz
 instance>)r�stackr+rrrFs r�__repr__zHelper.__repr__#s\���=�?�?�1��a� �C�'�'��D�F�F�F��2�(�&*�^�%>�%>�%>�%)�^�%@�%@�%@�B�	Brc�6�||jurM	|�|��dS#t$r(}|j�|�d���Yd}~dSd}~wwxYw|���|���|j�d��dS)NrSa
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.
)�_GoInteractiverr
rr��intro�interact)r:�request�es   r�__call__zHelper.__call__+s����$�-�-�-�
,��	�	�'�"�"�"�"�"���
,�
,�
,���!�!�Q�(�(�(�+�+�+�+�+�+�+�+�+�����
,����
�J�J�L�L�L��M�M�O�O�O��K����
�
�
�
�
s�"�
A�A�Ac���|j�d��		|�d��}|sdSn#ttf$rYdSwxYw|���}t
|��dkr6|d|dcxkrdvrnn|d|dd�vr
|dd�}|���d	vrdS|d
kr|���n|�	|����)NrSTzhelp> rUrrrWrT)r��quitr)
rr��getliner��EOFErrorrVrWr1r�r)r:r�s  rr�zHelper.interact;s������$����	#�
��,�,�x�0�0���%���%��%�x�0�
�
�
����
�����m�m�o�o�G��G���q� � �W�Q�Z�7�2�;�%L�%L�%L�%L�*�%L�%L�%L�%L�%L���
�'�!�B�$�-�7�7�!�!�B�$�-���}�}���-�/�/����&� � ��
�
������	�	�'�"�"�"�#	#s�7�A�Ac���|jtjurt|��S|j�|��|j���|j���S)z.Read one line, using input() when appropriate.)r�r	r�rr�rr�)r:�prompts  rr�zHelper.getlinePs[���:���"�"���=�=� ��K���f�%�%�%��K�������:�&�&�(�(�(rFc���t|t���rz|���}|dkr|����n�|dkr|����nf|dkr|����nJ|dkr|����n.|dd�dkr.|�|���d��n�||jvr|�	|��n�|dvr tt|��d	|�
��n�||jvr|�
|��n�||jvr|�
|��nq|rt|d	|j|���nVttd	|j|���n8t|t ��r|��nt|d	|j|���|j�d��dS)
N�keywords�symbols�topicsr�zmodules rT)r,r*r+zHelp on %s:�r)rrrS)r.rDrV�listkeywords�listsymbols�
listtopics�listmodulesrr��
showsymbolr=�evalr��	showtopicr�r�r)rr�)r:r�rs   rrzHelper.helpYs����g�s�#�#�	N��m�m�o�o�G��*�$�$�d�&7�&7�&9�&9�&9�&9��I�%�%�t�'7�'7�'9�'9�'9�'9��H�$�$�d�o�o�&7�&7�&7�&7��I�%�%�t�'7�'7�'9�'9�'9�'9���!���
�*�*�� � �������!3�4�4�4�4��D�L�(�(�$�/�/�'�*B�*B�*B�*B��5�5�5��D��M�M�=��@�@�@�@�@��D�M�)�)�4�>�>�'�+B�+B�+B�+B��D�K�'�'�����)@�)@�)@�)@��
N�#�g�}�T�\�RX�Y�Y�Y�Y�Y��c�=���f�M�M�M�M�M�
���
(�
(�	N�$�$�&�&�&�&��'�=���f�M�M�M�M�����$�����rc��|j�d�dtjdd�z����dS)Na�Welcome to Python {0}'s help utility! If this is your first time using
Python, you should definitely check out the tutorial 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 get a list of available
modules, keywords, symbols, or topics, enter "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",
enter "modules spam".

To quit this help utility and return to the interpreter,
enter "q" or "quit".
z%d.%drU)rr�r0r	r5rFs rr�zHelper.intronsK������� �F�7�S�%�b�q�b�)�)�*�*�!	,�	,�	,�	,�	,rr��Pc���tt|����}||z}t|��|zdz
|z}t|��D]�}t|��D]}||z|z}|t|��krb|j�||��||dz
kr9|j�dd|dz
t||��z
zz����|j�d����dS)NrTrrS)r�r�rWrrr�)	r:�items�columnsrr�colwr��rowr�r�s	         rr�zHelper.list�s���V�E�]�]�#�#�������E�
�
�W�$�q�(�W�4����;�;�	$�	$�C��W�~�~�
R�
R���$�J��$���s�5�z�z�>�>��K�%�%�e�A�h�/�/�/��W�q�[�(�(���)�)�#��t�a�x�#�e�A�h�-�-�7O�0P�*P�Q�Q�Q���K���d�#�#�#�#�	$�	$rc��|j�d��|�|j�����dS)NzN
Here is a list of the Python keywords.  Enter any keyword to get more help.

)rr�r�r�r�rFs rr�zHelper.listkeywords�sI�������	�	�	�	
�	�	�$�-�$�$�&�&�'�'�'�'�'rc��|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�r�r�r�rFs rr�zHelper.listsymbols�sI�������	�	�	�
	
�	�	�$�,�#�#�%�%�&�&�&�&�&rc��|j�d��|�|j�����dS)NzN
Here is a list of available topics.  Enter any topic name to get more help.

)rr�r�r�r�rFs rr�zHelper.listtopics�sI�������	�	�	�	
�	�	�$�+�"�"�$�$�%�%�%�%�%rc�f�	ddl}n+#t$r|j�d��YdSwxYw|j�||j�|����}|s,|j�dt|��z��dSt|��td��ur|�	||��S|\}}	|jj|}n;#t$r.|j�dt|��z��YdSwxYw|���dz}|r
|pddz|z}|rbddl}dd�
|�����zdz}	|�|	d	��}
|d
d�
|
��zz
}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
rKrSr�Related help topics: r��Hz
%s
)�pydoc_data.topicsr
rr�r�rr�rrCr��KeyErrorrV�textwraprXr�wrapr�)r:�topic�
more_xrefs�
pydoc_data�target�label�xrefsr=rrj�wrapped_texts           rr�zHelper.showtopic�s���	�$�$�$�$�$���	�	�	��K����
�
�
�
�F�F�	����������
�(9�(9�%�(@�(@�A�A���	��K���?�$�u�+�+�M�N�N�N��F���<�<�4��8�8�#�#��>�>�&�*�5�5�5����u�	��#�*�5�1�C�C���	�	�	��K���?�$�u�+�+�M�N�N�N��F�F�	�����i�i�k�k�D� ���	5��[�b�C�'�*�4�E��	6��O�O�O�*�T�Y�Y�u�{�{�}�}�-E�-E�E��L�D�#�=�=��r�2�2�L��8�d�i�i��5�5�5�5�C�
�c�
�
�
�
�
s��$/�/�
C � 4D�Dc�\�	ddl}n#t$rYdSwxYw|j�||j�|����}|std���t
|t��r|�||��S|\}}|jj|}|r
|pddz|z}||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	rKzcould not find topicrKr)	rr
r�rr�r/r.rD�	_gettopic)r:rrrrrrr=s        rrzHelper._gettopic�s���	
�$�$�$�$�$���	
�	
�	
�
�
�
�	
����
������
�(9�(9�%�(@�(@�A�A���	5��3�4�4�4��f�c�"�"�	6��>�>�&�*�5�5�5����u���&�u�-���	5��[�b�C�'�*�4�E��E�z�s��
�c�~�|j|}|�d��\}}}|�||��dS)Nr)r��	partitionr�)r:�symbolrrr�rs      rr�zHelper.showsymbol�sA����f�%�� �*�*�3�/�/���q�%����u�e�$�$�$�$�$rc���|r>|j�d�|����t|��dS|j�d��i}|fd���fd�}t	����|���|�|�����|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...

c��|r|dd�dkr
|dd�dz}|�d��dkrd||<dSdS)N����	.__init__ryrrrT)�find)r
r]r�rs    r�callbackz$Helper.listmodules.<locals>.callback�s]���:�w�r�s�s�|�{�:�:�%�c�r�c�l�\�9�G��<�<��$�$�q�(�(�'(�G�G�$�$�$�)�(rc�"���d|d��dSr�r�)r]r!s �r�onerrorz#Helper.listmodules.<locals>.onerror�s������w��-�-�-�-�-r�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�r0�apropos�
ModuleScanner�runr�r�)r:r�rr#r!s    @rr�zHelper.listmodules�s�����	��K�����F�3�K�K�	
�
�
�

�C�L�L�L�L�L��K����
�
�
��G�6=�
)�
)�
)�
)�

.�
.�
.�
.�
.��O�O����'��:�:�:��I�I�g�l�l�n�n�%�%�%��K����
�
�
�
�
rr�)F)r�r�r])!r)rrr��_strprefixes�_symbols_inverser�rr�symbols_rrr�r�r/r�rr�rAr�r�r�r�rr�r�r�r�r�r�rr�r�r�rrr)r)gs�������$���$���$�	��$�	�y�	$�
	
�f�$�	�.�
$�	��$�	��$�	�'�$�	�4�$�	�-�$�	��$�	�&�$�	��$�	�%�$� 	�%�!$�"	�5�#$�$�$	�.�%$�&	��'$�(	�3�)$�*	
�"�+$�,	�'�-$�.	
�'�/$�0	
�l�1$�2	�)�3$�4	�5�5$�6	�y�7$�8	
�i�9$�:	��;$�<	�(�=$�>	�)�?$�@	�$�A$�B	�:�C$�D	�<�E$�$�F	��G$�$�H�NM�L�#7�L�L�L�L��%��e�;�l�;�;�N�?��!B�4��
�
��$��
%�
/��
*�
��
�+�
�
%�
%�
(�
(���G�",�1�1�3�3�%�%���x��	%�	%�F��[�[���/�/�F��F�"�"��#���-��$�G�F�O�O�		%�
	�x���U��=�U�	�(�U�
	�A�U�	�4�
U�	�(�U�	�=�U�	�,�U�	�+�U�	�1�U�	�I�U�	�N�U�	�4�U� 	�>�!U�"	�H�#U�$	�<�%U�&	��'U�(	�g�)U�U�*	�)�+U�,	�9�-U�.	�1�/U�0	�A�1U�2	�-�3U�4	�H�5U�6	�.�7U�>	�]�?U�@	�m�AU�B	�'�CU�D	�4�EU�J	�I�KU�L	�M�MU�N	�E�OU�P	�/�QU�T	�G�UU�V	�,�WU�U�U�Z	�K�[U�\	�W�]U�^	�3�_U�`	�<�aU�b	�,�cU�d	�@�eU�f	�*�gU�h	�E�iU�j	�0�kU�l	�0�mU�n	�8�oU�r	�+�sU�t	�9�uU�v	�5�wU�x	�3�yU�z	�>�{U�|	�?�}U�U�U�~	�Z�U�@	�:�AU�B	�3�CU�D	�)�EU�F	�)�GU�H	�)�IU�J	�+�KU�L	�/�MU�N	�-�OU�P	�A�QU�R	�9�SU�T	�X�UU�V	�;�WU�X	�=�YU�Z	�E�[U�\	�X�]U�^	�X�_U�U�`�;�C�(�7�iU�U�U�F�n�����(�(��X�(��*�*��X�*�B�B�B��V�X�X�N�-����� #�#�#�*)�)�)� � � � �*,�,�,�&$�$�$�$�(�(�(�'�'�'�&�&�&�����@����6%�%�%�
�����rr)c��eZdZdZdd�ZdS)r&z7An interruptible scanner that searches module synopses.Nc���|r|���}d|_i}tjD]�}|dkr�d||<|�|d|d���t	|��jpd}|�d��d}|dz|z}|����|��dkr
|d||����tj	|���D�]�\}	}}
|jr�n�|�|d|d���!	tj
|	|��}n#t$rY�DwxYw|j}t|d	��r�	|�|��}
n#t$r|r||��Y��wxYwt!t#j|
����pd}t|d
��r|�|��}n{d}nx	t(j�|��}n#t.$r|r||��Y��wxYw|jr|j���dnd}t3|dd��}|dz|z}|����|��dkr
||||�����|r|��dSdS)NF�__main__rTrKrSrr�r$�
get_source�get_filenamer�)r1r�r	rrr@rr r�r$�	_get_specrr�r�r.r�r�r��StringIOr/r�r�r�r
r�r)r:r!r��	completerr#�seenr]r#r�r�r�r�r��sourcer
r�s                rr'zModuleScanner.run	s���!�c�i�i�k�k����	����/�
	6�
	6�G��*�$�$� !��W�
��;��H�T�7�B�/�/�/�/�%�g�.�.�6�<�"�D��:�:�d�+�+�A�.�D�"�U�?�T�1�D��z�z�|�|�(�(��-�-��2�2� ���w��5�5�5��(/�(=�g�(N�(N�(N�$	2�$	2�$�H�g�u��y�
����{����w��+�+�+�+��"�,�X�w�?�?�D�D��"�����H���������6�<�0�0�;�!�!'�!2�!2�7�!;�!;����$�!�!�!�"�-�#�G�G�,�,�,� ��!����+�2�;�v�+>�+>�?�?�E�2�D��v�~�6�6�$�%�2�2�7�;�;���#���!�!*�!5�!;�!;�D�!A�!A����&�!�!�!�"�-�#�G�G�,�,�,� ��!����>D�^�S�6�>�4�4�6�6�q�9�9�QS�D�"�6�*�T�:�:�D�����-���:�:�<�<�$�$�S�)�)�Q�.�.��H�T�7�D�1�1�1���	��I�K�K�K�K�K�	�	s6�2D�
D�D�0E�E �E �0G�G+�*G+r^)r)rrr@r'r�rrr&r&	s.������A�A�8�8�8�8�8�8rr&c���d�}d�}tj��5tjd��t���|||���ddd��dS#1swxYwYdS)zAPrint all the one-line module summaries that contain a substring.c�f�|dd�dkr
|dd�dz}t||od|z��dS�Nrrryz- )r)r
r]r�s   rr!zapropos.<locals>.callbackA	sF���2�3�3�<�;�&�&��c�r�c�l�\�1�G�
�g�t�+��t��,�,�,�,�,rc��dSr�r��r]s rr#zapropos.<locals>.onerrorE	s���r�ignorer$N)�warnings�catch_warnings�filterwarningsr&r')r�r!r#s   rr%r%?	s���-�-�-�
�
�
�	�	 �	"�	"�<�<����)�)�)������H�c�7��;�;�;�<�<�<�<�<�<�<�<�<�<�<�<����<�<�<�<�<�<s�9A � A$�'A$c������	�
�ddl�ddl�ddl�	ddl�
Gd�d�jj���G�	fd�d�jj���G�����
fd�d�
j��}||||��}|���|j	s7|j
r|js)tj
d	��|j	s|j
�"|j�)|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��eZdZd�Zd�ZdS)�!_start_server.<locals>.DocHandlerc�T�|j�d��rd}nd}|�d��|�dd|z��|���|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)	r
r��
send_response�send_header�end_headers�wfiler��
urlhandlerr�)r:�content_types  r�do_GETz(_start_server.<locals>.DocHandler.do_GET�	s����y�!�!�&�)�)�
+�)���*�����s�#�#�#����^�-@�<�-O�P�P�P��������J���T�_�_��	�<�)�)�)/�����
:�
:�
:�
:�
:rc��dSr�r�)r:rs  r�log_messagez-_start_server.<locals>.DocHandler.log_message�	s���DrN)r)rrrKrMr�rr�
DocHandlerr@�	s2������	:�	:�	:� 	�	�	�	�	rrNc�&��eZdZd�Z�fd�Zd�ZdS)� _start_server.<locals>.DocServerc��||_|j|f|_||_|j�||j|j��d|_dS�NF)�host�addressr!r<r��handlerr�)r:rS�portr!s    rr�z)_start_server.<locals>.DocServer.__init__�	sG���D�I� �I�t�,�D�L�$�D�M��I���t�T�\�4�<�@�@�@��D�I�I�Irc����|jsQ��|j���gggd��\}}}|r|���|j�Q|���dSr})r��select�socketr��handle_request�server_close)r:�rd�wr�exrXs    �r�serve_until_quitz1_start_server.<locals>.DocServer.serve_until_quit�	s{����i�
*�#�]�]�D�K�,>�,>�,@�,@�+A�2�r�1�M�M�
��B���*��'�'�)�)�)��i�
*�
�������rc�v�|j�|��|jr|�|��dSdSr�)r<�server_activater!rFs rraz0_start_server.<locals>.DocServer.server_activate�	sD���I�%�%�d�+�+�+��}�
$��
�
�d�#�#�#�#�#�
$�
$rN)r)rrr�r_ra)rXs�r�	DocServerrP�	sL�������	�	�	�	 �	 �	 �	 �	 �	$�	$�	$�	$�	$rrbc�6��eZdZ�fd�Z����fd�Zd�Zd�ZdS)�#_start_server.<locals>.ServerThreadc���||_||_t|��|_�j�|��d|_d|_d|_dSrR)	rIrSr�rV�Threadr��serving�error�	docserver)r:rIrSrV�	threadings    �rr�z,_start_server.<locals>.ServerThread.__init__�	sN���(�D�O��D�I��D�	�	�D�I���%�%�d�+�+�+� �D�L��D�J�!�D�N�N�Nrc�:��	�jj�_��_�jj�_t|j���_�|j	|j
|j��}||_|�
��dS#t$r}||_Yd}~dSd}~wwxYw)zStart the server.N)�server�
HTTPServerr<rUr�Message�MessageClass�staticmethodrIrSrV�readyrir_r�rh)r:�docsvrr�rNrb�email�https   ����rr'z'_start_server.<locals>.ServerThread.run�	s����	
�!%��!7�	��$.�	�!�*/�-�*?�
�'�(4�T�_�(E�(E�
�%�"��4�9�d�i���D�D��!'����'�'�)�)�)�)�)���
�
�
���
�
�
�
�
�
�
�����
���s�A9A>�>
B�B�Bc�p�d|_|j|_|j|_d|j|jfz|_dS)NTz
http://%s:%d/)rgrS�server_portrVr�)r:rls  rrqz)_start_server.<locals>.ServerThread.ready�	s5���D�L���D�I��*�D�I�&�$�)�T�Y�)?�?�D�H�H�Hrc�p�d|j_|���d|_d|_d|_dS)z&Stop the server and this thread nicelyTNF)rir�rXrgr�rFs r�stopz(_start_server.<locals>.ServerThread.stop�	s4��"&�D�N���I�I�K�K�K�"�D�N� �D�L��D�H�H�HrN)r)rrr�r'rqrx)rNrbrsrtrjs�����r�ServerThreadrd�	sw�������	"�	"�	"�	"�	"�	�	�	�	�	�	�	�	�	@�	@�	@�	�	�	�	�	rryg{�G�z�?)�http.server�
email.messagerXrjrl�BaseHTTPRequestHandlerrmrfr�rhrgri�time�sleep)rI�hostnamerVry�threadrNrbrsrtrXrjs     @@@@@@r�
_start_serverr�M	s^��������p���������M�M�M����������T�[�7����,$�$�$�$�$�$�$�D�K�*�$�$�$�*&�&�&�&�&�&�&�&�&�&�&�y�'�&�&�&�P�\�*�h��
5�
5�F�
�L�L�N�N�N��l��F�N��v�7G���
�3�����l��F�N��v�7G���MrrCc����	�
���
���G�fd�dt��}|����fd���fd��
�fd��
�fd���fd���fd���fd	��	�fd
�����	�
��
��fd�}|�d��r
|d
d�}|dkr�tj�tj�t����}tj�||��}t|��5}d�|�	����cddd��S#1swxYwYn|dkr||��Std|�d|�����)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.
    c���eZdZ�fd�ZdS)�_url_handler.<locals>._HTMLDocc	�@��d}d|z}d|�d|�d����d|�d�	S)rgzpydoc_data/_pydoc.cssz1<link rel="stylesheet" type="text/css" href="%s">zH<!DOCTYPE>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pydoc: z	</title>
z
</head><body>z*<div style="clear:both;padding-top:.5em;">z</div>
</body></html>r�)r:rhri�css_path�css_link�html_navbars     �rrjz#_url_handler.<locals>._HTMLDoc.page�	sE���.�H�C���
�H��U�U�H�H�H�k�k�m�m�m�m�X�X�X�?�
?rN)r)rrrj)r�s�r�_HTMLDocr��	s.�������
	?�
	?�
	?�
	?�
	?�
	?�
	?rr�c�����tj���dtj��d�dtj���d���}d|�d��tjd������d	�S)
Nz [rr�r{z=
            <div style='float:left'>
                Python �<br>T)�tersea
            </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>
            )rMr��python_version�python_build�python_compiler)r�r!s �rr�z!_url_handler.<locals>.html_navbar
s�����+�+�x�/F�/H�/H�/H�/H�/7�/D�/F�/F�q�/I�/I�/I�/7�/G�/I�/I�/I�/I�K�L�L���0�7�7�D�K�K��(9��(E�(E�(E�F�F�F�F�+H�	Hrc���d�}��d��}d�tjD��}��||��}|d��dd|��zg}i}tjD]+}|���||�����,|�d��dd	�|��fS)
zModule Index page.c��d|�d|�d�S�Nr�r�r�r��r#s r�	bltinlinkz3_url_handler.<locals>.html_index.<locals>.bltinlink!
����15���t�t�t�<�<rz/<strong class="title">Index of Modules</strong>c��g|]
}|dk�|��S)r-r�)r�r#s  rrz4_url_handler.<locals>.html_index.<locals>.<listcomp>'
s,��(�(�(�$��J�&�&��&�&�&rz<p>zBuilt-in Modulesr�zf<p align=right class="heading-text grey"><strong>pydoc</strong> by Ka-Ping Yee&lt;ping@lfw.org&gt;</p>zIndex of ModulesrK)	rnr	rr�rxr
rr�rX)r�rn�namesrir3rr!s      �r�
html_indexz _url_handler.<locals>.html_index
s����	=�	=�	=��,�,�=�
�
��(�(�#�":�(�(�(���#�#�E�9�5�5���U�T�_�_����&3�&3�3�4�����8�	3�	3�C��O�O�D�J�J�s�D�1�1�2�2�2�2����
'�	(�	(�	(�"�2�7�7�8�#4�#4�4�4rc����	�g�	�	fd�}tj��5tjd��d�}t���|||���ddd��n#1swxYwYd�}g}�
�d��}�	D]&\}}|�||��|z���'|�
�d|zd	d
�|����z}d|fS)zSearch results page.c�v��|dd�dkr
|dd�dz}��||od|zf��dSr7r�)r
r]r��
search_results   �rr!z3_url_handler.<locals>.html_search.<locals>.callback;
sP����r�s�s�|�{�*�*�!�#�2�#�,��5��� � �'�4�+?�D�4�K�!@�A�A�A�A�Arr:c��dSr�r�r9s rr#z2_url_handler.<locals>.html_search.<locals>.onerrorB
s���rr$Nc��d|�d|�d�Sr�r�r�s rr�z4_url_handler.<locals>.html_search.<locals>.bltinlinkG
r�rz-<strong class="title">Search Results</strong>zkey = %sr�r�zSearch Results)	r;r<r=r&r'rnrrxrX)r�r!r#r�r�rnr#r�rir�r!s         @�r�html_searchz!_url_handler.<locals>.html_search6
s�����
�	B�	B�	B�	B�	B�
�
$�
&�
&�	@�	@��#�H�-�-�-�
�
�
��O�O����#�w��?�?�?�		@�	@�	@�	@�	@�	@�	@�	@�	@�	@�	@����	@�	@�	@�	@�	=�	=�	=����,�,�;�
�
��(�	3�	3�J�D�$��N�N�9�9�T�?�?�T�1�2�2�2�2��T�_�_����g�v�{�{�7�';�';�=�=�=����)�)s�<A%�%A)�,A)c����d�}��d��}ttj�����}��||��}|��dd|��z}d|fS)zIndex of topic texts available.c��d|�d|�d�S�Nz<a href="topic?key=r�r�r�r�s rr�z4_url_handler.<locals>.html_topics.<locals>.bltinlinkW
����6:�d�d�D�D�D�A�Ar�$<strong class="title">INDEX</strong>�Topicsr�)rnr�r)r�r�r�rx)r�rnr�rir!s    �r�html_topicsz!_url_handler.<locals>.html_topicsT
s����	B�	B�	B��,�,�2�
�
���v�}�)�)�+�+�,�,���#�#�E�9�5�5���T�_�_��g�x�)�)�)����!�!rc������d��}ttj�����}d�}��||��}|��dd|��z}d|fS)zIndex of keywords.r�c��d|�d|�d�Sr�r�r�s rr�z6_url_handler.<locals>.html_keywords.<locals>.bltinlinkk
r�r�Keywordsr�)rnr�r)r�r�r�rx)rnr�r�rir!s    �r�
html_keywordsz#_url_handler.<locals>.html_keywordsd
s�����,�,�2�
�
���v��+�+�-�-�.�.��	B�	B�	B��#�#�E�9�5�5���T�_�_����+�+�+���8�#�#rc���tj��}t||��}|�|��\}}||jvrd}nd}��d|z��}d��|��z}��|d|��}|rQt|�	����}d�}��
||��}��dd|��}|�d|��d	�|||f��fS)
zTopic or keyword help page.�KEYWORD�TOPICr�z
<pre>%s</pre>r�c��d|�d|�d�Sr�r�r�s rr�z7_url_handler.<locals>.html_topicpage.<locals>.bltinlink�
s���:>�$�$����E�Err
rrK)
r�r1r)rr�rnr�rxr�rr�rvrX)	r�buf�htmlhelprirrhrnr�r!s	        �r�html_topicpagez$_url_handler.<locals>.html_topicpages
s!����k�m�m���#�s�#�#��"�,�,�U�3�3���%��H�%�%�%��E�E��E��,�,�/�%�7�
�
��#�T�[�[��%:�%:�:���?�?�5�7�H�=�=���	J��5�;�;�=�=�)�)�E�
F�
F�
F��$�$�U�I�6�6�E��L�L�!8�'�5�I�I�E� �5�5�%�%�(�����(�E�2�3�3�5�	5rc���t|d���}|�|dkrtd���t|��}��||��}||fS)NrT)rr+zcould not find object)rr/rr)r�r9rh�contentr!s    �r�html_getobjz!_url_handler.<locals>.html_getobj�
sY����S�A�&�&�&���;�3�&�=�=��4�5�5�5���
�
���-�-��S�)�)���g�~�rc������d��}d��fd�tt|��|��D����}|��|d|��z}d|z|fS)Nz$<strong class="title">Error</strong>r�c3�B�K�|]}��|��V��dSr�)rM)r�r�r!s  �rr[z3_url_handler.<locals>.html_error.<locals>.<genexpr>�
sG�����F�F�T�t�{�{�4�0�0�F�F�F�F�F�Frrhz
Error - %s)rnrXrrCrx)r�r�rnrir!s    �r�
html_errorz _url_handler.<locals>.html_error�
s�����,�,�2�
�
���;�;�F�F�F�F�4�T�#�Y�Y��D�D�F�F�F�F�F���T�_�_�S�'�8�D�D�D���c�!�8�+�+rc����|}|�d��r
|dd�}	|dvr�
��\}}n�|dkr���\}}n�|dkr���\}}n�d|vr�|�d��\}}}|dkr�|��\}}n�|d	kr.	�
|��\}}n�#t$r�	|��\}}YngwxYw|d
kr@|dvr�
��\}}nK	�	|��\}}n;#t$r�
|��\}}Yn!wxYwtd����	|��\}}n&#t$r}�||��\}}Yd}~nd}~wwxYw��||��S)zGenerate an HTML page for url.r-N���)rKr�r�r�r9z
search?keyz	topic?keyzget?keyz
bad pydoc url)r�rr/r�rj)r��complete_urlrhr��opr�r�r!r�r�r�r�r�r�r�s       ��������r�
get_html_pagez#_url_handler.<locals>.get_html_page�
s������<�<�� � �	��c�r�c�(�C� 	;��m�#�#�!+������w�w�����!,������w�w��
�"�"�!.������w�w����� �]�]�3�/�/�
��A�s���%�%�%0�[��%5�%5�N�E�7�7��;�&�&�:�)7���)<�)<���w�w��%�:�:�:�)4��S�)9�)9���w�w�w�:�����9�_�_��m�+�+�)3������w�w�A�-8�[��-=�-=�N�E�7�7��)�A�A�A�-;�^�C�-@�-@�N�E�7�7�7�A����%�_�5�5�5�!,��S�!1�!1���w����	;�	;�	;�'�Z��c�:�:�N�E�7�7�7�7�7�7�����	;�����y�y���(�(�(s`�A2D(�B&�%D(�&C�>D(�C�D(�C,�+D(�,D�D(�D� D(�(
E�2E�Er,rTNrBrKrCzunknown content type z	 for url )rer�rr
�dirname�realpathr�rXr��	readlinesrG)r�rJr�r��	path_herer��fpr!r�r�r�r�r�r�r�r�s       @@@@@@@@@r�_url_handlerr��	sq�����������?�?�?�?�?�?�?�7�?�?�?�$�8�:�:�D�H�H�H�H�H�65�5�5�5�5�0*�*�*�*�*�<"�"�"�"�"� 
$�
$�
$�
$�
$�5�5�5�5�5�2�����,�,�,�,�,�&)�&)�&)�&)�&)�&)�&)�&)�&)�&)�&)�&)�P�~�~�c�����!�"�"�g���z�!�!��G�O�O�B�G�$4�$4�X�$>�$>�?�?�	��7�<�<�	�3�/�/��
�(�^�^�	+�r��7�7�2�<�<�>�>�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	+�	��	$�	$��}�S�!�!�!�
�)�L�L�L�#�#�N�
O�
O�Os�2'D&�&D*�-D*T�	localhost)�open_browserrc���ddl}tt||��}|jrt	|j��dS|j�r/d}|r|�|j��	t	d|j��t	|��|jratd��}|�	��}|dkrn7|dkr|�|j��nt	|��|j�an%#ttf$rt	��YnwxYw|jr%|���t	d��dSdS#|jr$|���t	d��wwxYwdS)	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 ready atzserver> r�r�zServer stopped)
�
webbrowserr�r�rhrrgr�r�r�r1r�r�rx)rVr�rr��serverthread�server_help_msgr�s       r�browser��
s������� ��x��>�>�L����
�l� �!�!�!�����(�>���	.��O�O�L�,�-�-�-�	(��#�\�%5�6�6�6��/�"�"�"��&�
+��J�'�'���i�i�k�k���#�:�:���C�Z�Z��O�O�L�$4�5�5�5�5��/�*�*�*��&�
+���"�8�,�	�	�	��G�G�G�G�G�	�����#�
(��!�!�#�#�#��&�'�'�'�'�'�
(�
(��|�#�
(��!�!�#�#�#��&�'�'�'�'�
(����'(�(s+�BC,�+D?�,D�D?�
D�D?�?-E,c�r�t|t��o"|�tj��dkSr�)r.rDr r�sep)r�s r�ispathr��
s(���a����5�!�&�&���.�.�A�"5�5rc���d|vs#tj|vstj��|vrdStj�t
��}tj�|��}|���}||vr5tj�||��s|�|��|�	dtj����|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.
    rKNr)
r�curdir�getcwdr
r�r��copy�samefile�remove�insert)�
given_path�argv0�
stdlib_dir�
script_dir�revised_paths     r�_get_revised_pathr��
s���
�Z���2�9�
�2�2�b�i�k�k�Z�6O�6O��t������*�*�J������'�'�J��?�?�$�$�L��Z�����(8�(8��Z�(P�(P�����J�'�'�'�����2�9�;�;�'�'�'��rc��ttjtjd��}|�|tjdd�<dSdS)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�r	r
�argv)r�s r�_adjust_cli_sys_pathr�s<��
%�S�X�s�x��{�;�;�L���"��������� �rc�0�ddl}Gd�dt��}t��	|�tjdd�d��\}}d}d}d}d}d}|D]C\}	}
|	d	krd
}d
}|	dkrt|
��dS|	dkrd
}|
}|	d
krd
}|	dkrd
}|
}�D|rt
|||���dS|s|�|D�]C}t|��rEtj	�
|��s&td|z��tjd��	t|��r.tj	�
|��rt|��}|rNt|��r/tj	�|��rt!|��n,t#|��nt$�|d
�����#t&t(f$r.}t|��tjd��Yd}~��=d}~wwxYwdS#|j|f$r�tj	�tj	�tjd����d}
td�|
tj�����YdSwxYw)z@Command-line interface (looks at sys.argv to decide what to do).rNc��eZdZdS)�cli.<locals>.BadUsageN)r)rrr�rr�BadUsager�#s�������rr�rTzbk:n:p:wFr�z-bTz-kz-pz-wz-n)rr�zfile %r does not existr�a�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�)�getoptr�r�r	r�r%r�r�rr
�existsr�exitr�rrr'r"rr
r�rhr�r�r0r�)r�r��optsr�writing�start_serverr�rVr�opt�val�argr�r�s              r�clir� s����M�M�M�#�#�#�#�#�9�#�#�#�����M!��]�]�3�8�A�B�B�<��<�<�
��d������������	�	�H�C���d�{�{�#��#���d�{�{����������d�{�{�#�����d�{�{����d�{�{�#������	��4�(��F�F�F�F��F��#�8�^��	�	�C��c�{�{�
�2�7�>�>�#�#6�#6�
��.��4�5�5�5�������
��#�;�;�*�2�7�>�>�#�#6�#6�*�$�S�/�/�C��0��c�{�{�&�r�w�}�}�S�'9�'9�&�!�#����� ��
�
�
�
��I�I�c�$�I�/�/�/����!2�3�
�
�
��e�������������������
����	�	��$
�L�(�#�!�!�!��g���r�w�/�/�����<�<�=�=�a�@��
��:�F�s���F���;	!�	!�	!�	!�	!�	!�!���sK�AH�1H�8AH�B)G�?H�H�#G;�5H�;H�H�BJ�Jr-r�)r)rrN)rrNF)rKN)rC)cr@r�r�r�r�r�r-�importlib._bootstrapr��importlib._bootstrap_external�importlib.machinery�importlib.utilrr�rr�r�rMr	r7r}r��urllib.parser�r;�collectionsr�reprlibr�	tracebackrrr$r>r7rIrQrZr^rarhrlrtr��
IGNORECASErvrxr{r�r�r��all_feature_namesr�r�r�r�r�r�r�r�r�rrrr:rerargr�r�r�r�r�r�r�r�r�rrrjrr!rrr=r"r'r)rr&r%r�r�r�r�r�r�r�r)r�rr�<module>r�s��%�%�L�(��
)�
�����������������$�$�$�$�������������	�	�	�	�	�	�	�	���������	�	�	�	�
�
�
�
���������������������������������+�+�+�+�+�+�

�
�
����1�1�1�f
�
�
�!�!�!� A�A�A�
 � � ����%�%�%�G�G�G��������b�j�5�r�}�E�E��(�(�(�

�
�
�������"��J�8�9�9��(�(�(�(�0���
�
�
�������" �%�%�%�%�NK�K�K�K�K�	�K�K�K�6�6�6�$ !��,�,�,�,�`6�6�6�6�6�6�6�6�t(�(�(�(�(�t�(�(�(�TY	7�Y	7�Y	7�Y	7�Y	7�c�Y	7�Y	7�Y	7�z:�:�:�:�:�t�:�:�:�@Y�Y�Y�Y�Y�c�Y�Y�Y�v�����G�������"�"�"�H#�#�#����0
/�
/�
/�F�F�F�
*2�*2�*2�X2�2�2� � � �6����*�w�y�y���M�O�O�	��w�y�y��>�>�>�>�KL��C�C�C�C�6DE�!�����"#�#�#�#�����W�W�W�W�W�W�W�W�r�v�x�x��;�;�;�;�;�;�;�;�z
<�
<�
<�V�V�V�riP�iP�iP�iP�X (�4�+� (� (� (� (� (�J6�6�6����8#�#�#�T!�T!�T!�l�z����C�E�E�E�E�E��r

?>