a �DOg��@s&dgZdZdZdZddlZddlZddlZddlZddl Zddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlmZd d �Zd d �Zd d�Z dd�Z!dd�Z"dd�Z#dd�Z$dd�Z%dd�Z&dd�Z'dd�Z(dd �Z)e�*d!ej+�Z,d"d#�Z-d$d%�Z.d&d'�Z/d(d)�Z0d�d*d+�Z1d,d-�Z2d.d/�Z3d0d1�Z4d2d3�Z5ifd4d5�Z6Gd6d7�d7e7�Z8d8d9�Z9difd:d;�Z:Gdd?�d?e�ZGdDdE�dEe;�Z?GdFdG�dGe?�Z@dHdI�aAdJdK�ZBdLdM�ZCdNdO�ZDdPdQ�ZEdRdS�ZFdTdU�ZGdVdW�ZHdXdY�ZId�dZd[�ZJe?�ZKe@�ZLe=�ZMd�d\d]�ZNd�d_d`�ZOd�dadb�ZPd�dcdd�ZQd�dfdg�ZRGdhdi�di�ZSeS�ZTGdjdk�dk�ZUdldm�ZVdndo�ZWd�dqdr�ZXd�dsdtdu�dvdw�ZYdxdy�ZZdzd{�Z[d|d}�Z\d~d�Z]e^d�k�r"e]�dS)��helpzKa-Ping Yee 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�|�}||vrtj�|�r|�|�|�|�q|S�N�.)�sys�path�os�abspath�normcase�isdir�append)�dirsZnormdirs�dir�normdir�r�/usr/lib64/python3.9/pydoc.py�pathdirsRs    rcCst�|�ot|tj� S�N)�inspectZisclass� isinstance�types� GenericAlias��objectrrr�_isclass^srcCsNtj�|j�}|durdS|j�d�dd�D]}t||�}q.t|�sJdS|S)Nr�����)r�modules�get� __module__� __qualname__�split�getattrr)�func�cls�namerrr� _findclassas r'c Cs�t�|�rH|jj}|j}t|�r>tt||d�d�|jur>|}n|j}�n"t�|�r||j}t |�}|dusvt||�|urzdSn�t� |�r�|j}|j}t|�r�|j d||j kr�|}n|j}n�t |t �r�|j}|j}t |�}|dus�t||�|ur�dSntt�|��st�|��rf|j}|j}t||�|u�r.dSt�|��rjt|dd�}t |t��rj||v�rj||SndS|jD]F}ztt||��}Wnt�y�Y�qpYn0|du�rp|S�qpdS)N�__func__r� __slots__)r�ismethodr(�__name__�__self__rr#� __class__� isfunctionr'� isbuiltinr!r�property�fgetZismethoddescriptor�isdatadescriptor� __objclass__�ismemberdescriptor�dict�__mro__� _getowndoc�AttributeError)�objr&�selfr%r$�slots�base�docrrr�_finddocksZ �   �        r>cCsdzJt�|d�}|durWdS|turFt|�j}t|t�rF||krFWdS|WSty^YdS0dS)N�__doc__)r�__getattribute__�typer?r�strr8)r9r=Ztypedocrrrr7�s   r7c CsNt|�}|dur6z t|�}Wnttfy4YdS0t|t�sDdSt�|�Sr)r7r>r8� TypeErrorrrBrZcleandoc)rr=rrr�_getdoc�s  rDcCs,t|�pt�|�}|r(t�dd|���p*dS)Nz^ * �)rDrZ getcomments�re�sub�rstrip)r�resultrrr�getdoc�srJcCsf|���d�}t|�dkr&|ddfSt|�dkrX|d��sX|dd�|dd��fSdd�|�fS)N� �rrE�)�stripr"�lenrH�join)r=�linesrrr�splitdoc�s   rRcCs"|j}|j|kr|jd|}|Sr)r+r )r�modnamer&rrr� classname�s rTcCs<t�|�p8t|�p8t�|�p8t�|�p8t�|�p8t�|� Sr)r�ismoduler� isroutineZisframeZ istracebackZiscoderrrr�isdata�s����rWcGs.|r*|d�|�|d��}|dd�}q|S)NrLrrM)rPr")�text�pairsrrr�replace�srZcCsXt|�|krTtd|dd�}td|d|�}|d|�d|t|�|d�S|S)Nr�rM�...)rO�max)rX�maxlen�preZpostrrr�cram�s  $r`z at 0x[0-9a-f]{6,16}(>+)$cCs t�d|�S)Nz\1)� _re_stripidrG�rXrrr�stripid�srccCs<t�|�rdSt�|�r8t|dd�}t�|�p4|du SdS)NTr,F)rr*r/r#rU)�fnr:rrr�_is_bound_method�s    recCs^i}t�|tj�D]\}}d||<q|jD]}|�t|��q*|��D]}t||�||<qF|S�NrL)r� getmembersrV� __bases__�update� allmethods�keysr#)�cl�methods�key�valuer<rrrrj�s   rjcCs8g}g}|D]"}||�r$|�|�q |�|�q ||fSr�r)�s� predicateZyes�no�xrrr� _split_lists  rucCs\|dvr dS|�d�r$|�d�r$dS|�d�r�__date__� __cached__� __credits__r � __builtins__r?r)�__file__� __loader__� __author__r+�__path__� __package__r!� __version__�__spec__r�__rL�_�_fieldsT)� startswith�endswith�hasattr)r&�allr9rrr� visiblenamesr�cCsXg}t�|�D]D\}}}}t�|�r@d}t|t�r@|jdur@d}|�||||f�q|S)N�data descriptor�readonly property)r�classify_class_attrsr2rr0�fsetr)r�resultsr&�kindr%rorrrr�)s r�csZt|dg��z�fdd�t��D��Wnty<i�Yn0�fdd�}|j|d�dS)Nr�csi|]\}}||t���qSr)rO)�.0�ir&)�fieldsrr� :�z#sort_attributes..cs��|dd�|dfS�Nr)r)�attr)� field_orderrr�=r�z!sort_attributes..�rn)r#� enumeraterC�sort)�attrsrZkeyfuncr)r�r�r�sort_attributes4s    r�cCs:tj�|�r6dD]$}tj�tj�|d|��rdSqdS)N)z.pyz.pyc�__init__TF)r r r �isfilerP)r �extrrr� ispackageBs  r�cCs�|��}|dd�dks |��s0|��}|sq0q|��}|dd�dkrT|dd�}|dd�dkr�|dd�}|dd�dkr�|dd�}|��s�|��}|s�q�q�|�d�d ��}nd}|S) NrL�#�zr"""r[�"""r�\r)�readlinerNr")�file�linerIrrr�source_synopsisJs r�c Cs2t�|�j}|�|d�\}}|dus.||k�r.|�ttjj��rJtjj }n |�ttjj ��rftjj }nd}|dur�zt � |�}Wnty�YdS0|�t|�}Wd�n1s�0Yn^|d|�}tjjd||d�}ztj�|�} WnYdS0tjd=| j�r| j��dnd}||f||<|S)N)NNZ__temp__��loaderr)r �stat�st_mtimerr��tuple� importlib� machinery�BYTECODE_SUFFIXES�SourcelessFileLoader�EXTENSION_SUFFIXES�ExtensionFileLoader�tokenize�open�OSErrorr��util�spec_from_file_location� _bootstrap�_loadrrr?� splitlines) �filename�cache�mtimeZ lastupdaterIZ loader_clsr�r��spec�modulerrr�synopsis[s6    (  � r�c@seZdZdd�Zdd�ZdS)�ErrorDuringImportcCs||_|\|_|_|_dSr)r��excro�tb)r:r��exc_inforrrr��szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)r�r+r�ro)r:r�rrr�__str__�szErrorDuringImport.__str__N)r+r r!r�r�rrrrr��sr�c Cs�tjj}t|d��"}||�t|��k}Wd�n1s:0Ytj�|�}tj� |�\}}|rttj � ||�}ntj � ||�}tjj |||d�}ztj�|�WSt|t����Yn0dS)N�rbr�)r�r�� MAGIC_NUMBERr��readrOr r �basename�splitext�_bootstrap_externalr��SourceFileLoaderr�r�r�r�rr�) r �magicr�Z is_bytecoder�r&r�r�r�rrr� importfile�s 0 r�c sz^|rT�tjvrT�tjvrT�fdd�tjD�}�g|D]}tj|||<tj|=q8t��}Wnzt��\}}}} �tjvr�ttj�j| ��n>|tur�t|j| ��n(t |t �r�|j �kr�YdSt�t����Yn0�� d�dd�D],} zt || �}Wq�t�yYdS0q�|S)Ncsg|]}|��d�r|�qS)r)r�)r��m�r rr� �r�zsafeimport..rrL)rr�builtin_module_names� __import__r�r�rz� SyntaxErrorr�� issubclass� ImportErrorr&r"r#r8) r � forceloadr�Zsubsrnr�r�ror��info�partrr�r� safeimport�s*    r�c@sfeZdZej�ddejdd��Zd dd�Z d dd�Z e Z Z Z ZZZe�d �fd d �ZdS)�Doc� PYTHONDOCSz%https://docs.python.org/%d.%d/libraryNrMcGs�||f|}zDt�|�r$|j|�WSt|�r8|j|�WSt�|�rN|j|�WSWntybYn0t�|�rx|j |�S|j |�Sr) rrU� docmoduler�docclassrV� docroutiner8r2�docdata�docother)r:rr&�argsrrr�document�s  z Doc.documentcGs*d|odt|�t|�jf}t|��dS)Nz.don't know how to document object%s of type %s� )�reprrAr+rC)r:rr&r��messagerrr�fail�s�zDoc.failZstdlibcCs�zt�|�}Wnty$d}Yn0tj�d|j�}tj�|�}t |t t��r�|j dvsx|� |�r�|� tj� |d��s�|j dvr�|� d�r�d|�d�|j ��f}q�tj� ||j ��d �}nd}|S) N� (built-in)r�) �errno� exceptions�gc�imp�marshal�posix�signalr�_thread� zipimportz site-packages)z xml.etreeztest.pydoc_mod)zhttp://zhttps://z%s/%s�/�.html)r� getabsfilerCr �environrr�r r rrAr+r�rPrH�lower)r:rZbasedirr��doclocrrr� getdocloc�s(   ���� z Doc.getdocloc)N)N)r+r r!r r�rr� version_infor�r�r�r�r�r�r�� docpropertyr�� sysconfigZget_pathr�rrrrr��s ��  r�c@sDeZdZdd�Zdd�Zdd�Zdd�Zd d �ZeZd d �Z eZ d S)�HTMLReprcCs,t�|�d|_|_d|_d|_|_dS�N�� �d�rr��maxlist�maxtuple�maxdict� maxstring�maxother�r:rrrr� s  zHTMLRepr.__init__cCst|dddddd�S)N�&z&�z>)rZ�r:rXrrr�escapeszHTMLRepr.escapecCs t�||�Sr)rr��r:rrrrr�sz HTMLRepr.reprcCsZtt|�d�r@dd�t|�j���}t||�r@t||�||�S|�ttt |��|j ��S�Nr+�repr_r�) r�rArPr+r"r#r r`rcr�r�r:rt�levelZ methodnamerrr�repr1s  zHTMLRepr.repr1cCs^t||j�}t|�}d|vrJdt|dd�vrJd|d|�|�|dSt�dd|�|��S)Nr��\\rE�rrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z\1)r`rr�rZr rFrG�r:rtr�testZtestreprrrr� repr_strings �zHTMLRepr.repr_stringcCs@z|�ttt|��|j��WS|�d|jj�YS0dS�Nz <%s instance>)r r`rcr�rr-r+�r:rtrrrr� repr_instance*szHTMLRepr.repr_instanceN) r+r r!r�r r�rr�repr_strrZ repr_unicoderrrrr�s r�c@s�eZdZe�ZejZejZdd�Zd0dd�Zd1d d �Z d d �Z d d�Z d2dd�Z dd�Z dd�Zdd�Zdd�Zdd�Zdd�Zdiiifdd�Zd3d d!�Zd4d"d#�Zddiifd$d%�Zd&d'�Zddiiidfd(d)�Zd5d*d+�ZeZd6d,d-�Zd7d.d/�ZdS)8�HTMLDoccCs d||fS)Nz� Python: %s %s r)r:�title�contentsrrr�page;s�z HTMLDoc.pagerEcCsd|||||pdfS)Na'
 
 
%s
%s
� r)r:r�fgcol�bgcol�extrasrrr�headingEs�zHTMLDoc.heading�Nr!c Cs^|durdd|d}d|||f} |r@| d||||f} n| d|||f} | d|S)Nzr!zz�

zR z( z'
 
%s
%s %s
%s
%s%s%s
r) r:rr"r#r�widthZpreludeZ marginaliaZgaprIrrr�sectionPs� ��zHTMLDoc.sectioncGsd|}|j|g|�R�S)Nz%s)r()r:rr�rrr� bigsectionfszHTMLDoc.bigsectionc Cs&|�|���}t|dddddddd� S)N� z r�r!rK�
)r � expandtabsrZr rrr� preformatks �zHTMLDoc.preformatr�cCs�d}t|�|d|}t|�D]X}|dd|}t|||||�D]$}|t|�krJ||||�d}qJ|d}q d|S)NrErLzrr+zz7%s
)rO�range)r:�list�formatZcolsrI�rows�colr�rrr� multicolumnqs   zHTMLDoc.multicolumncCsd|S)Nz%srr rrr�grey}r�z HTMLDoc.greycGs*|D] }||vrd|||fSq|S)N�%sr)r:r&Zdictsr5rrr�namelinkszHTMLDoc.namelinkcCsN|jtj�|j�}}t||�rDt||�|urDd|j|t||�fSt||�S)Nz%s)r+rrrr r�r#rT)r:rrSr&r�rrr� classlink�s �zHTMLDoc.classlinkcCsd|j|jfS�Nz%s)r+rrrr� modulelink�szHTMLDoc.modulelinkcCsR|\}}}}|r|�|�S|r,d||f}nd|}|rBd|}n|}d||fS)Nz %s.%s.htmlz%s.htmlz"%s (package)r5)r4)r:Z modpkginfor&r r��shadowed�urlrXrrr� modpkglink�s   zHTMLDoc.modpkglinkcCs d||fS)Nz%sr)r:r;r rrr�filelink�szHTMLDoc.filelinkcCs�|p|j}g}d}t�d�}|�||�} | s0�qh| ��\} } |�|||| ���| ��\} } }}}}| r�|| ��dd�}|�d||f�n�|r�dt|�}|�d||| �f�n�|r�dt|�}|�d||| �f�n�|�r"|| | d�d k�r|�d |� ||��n|�d |�n@|| | d�d k�rP|�|� ||||��n|�|� ||��| }q|�|||d���d � |�S) NrzJ\b((http|https|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?(\w+))�"z"r5z'http://www.rfc-editor.org/rfc/rfc%d.txtz)https://www.python.org/dev/peps/pep-%04d/rL�(zself.zself.%srE) r rF�compile�search�spanr�groupsrZ�intr6rP)r:rXr �funcs�classesrmr��here�pattern�match�start�endr��schemeZrfcZpepZselfdotr&r;rrr�markup�s8      zHTMLDoc.markupc Cs�d}|D]�}t|�td�ur�|\}}|d}||�||�}|r�||fkr�g}|D]} |�|�| |��qR|dd�|�d}|d}qt|�tg�ur|d|�|||�}qd |S) NrErz"

r?�, �)z
z
%s
z
%s
)rAr7rrP� formattree) r:�treerS�parentrI�entry�c�bases�parentsr<rrrrP�s" � zHTMLDoc.formattreec# s�|j}z |j}Wnty&d}Yn0|�d�}g}tt|�d�D],}|�dd�|d|d��||f�qFd�||dd��} d| } z&t� |�} t j � | �} �� | | �} Wnty�d} Yn0g}t|d��r2t|j�}|dd�d k�r|dd�d k�r|dd���}|�d ��|��t|d ��rT|���t|j���|�rl| d d�|�} ��|�}|du�r�dt�}nd}��| ddd| |�}t�|tj�}gi}}t�|t�D]Z\}}|du�s�t�|��p�||u�r�t|||��r�|�||f�d|||<||<�q�|D]�\}}|jD]n}|j|j}}tj �!|�}||k�r:|�r:t||��r:t"||�|u�r:||v�r:|d|||<||<�q:�q,gi}}t�|tj#�D]p\}}|du�s�t�$|��s�t�|�|u�r�t|||��r�|�||f�d|||<t�%|��r�||||<�q�g}t�|t&�D]&\}}t|||��rH|�||f��qH��'t(|��j)||�}|�o�d|}|d|}t|d��rg}t*�+|j,�D]\}}} |�||| df��q�|�-���.|�j/�}!|��0ddd|!�}n.|�r6��.|�fdd��}!|��0ddd|!�}|�r�d d!�|D�}"��1t�2|"d�|�g}!|D]"\}}|!���3|||||���qd|��0d"dd#d$�|!��}|�r�g}!|D]"\}}|!���3|||||���q�|��0d%dd&d$�|!��}|�r4g}!|D]\}}|!���3||���q�|��0d'dd(d)�|!��}t|d*��rh��'t|j4��j)�}!|��0d+dd|!�}t|d,��r���'t|j5��j)�}!|��0d-dd|!�}|S).NrrLz5%sr�)%sr�r� � $Revision: �$z version %srvz (%s)rNz-
Module ReferencerE�#ffffff�#7799eezindex
r�z.html#z#-z %sz

%s

r}rzPackage Contentsz#aa55cccs��|d�Srf)r9��trrrr�9r�z#HTMLDoc.docmodule..ZModulescSsg|] \}}|�qSrr�r�rnrorrrr�>r�z%HTMLDoc.docmodule..ZClasses�#ee77aar�Z Functionsz#eeaa77ZDataz#55aa55r+r|ZAuthorrxZCredits)6r+�__all__r8r"r.rOrrPrr��urllib�parse�quoter=rCr�rBrrNr rvr��localsr%rgrUr� getmoduler�rhr rrrr#rVr/r.rWrMrJr-�pkgutil� iter_modulesr}r�r3r<r)rP� getclasstreer�r|rx)#r:rr&�mod�ignoredr��partsZlinksr�Z linkedname�headr r;r=r��versionr�rIrrFZcdictrnror<rSr�rEZfdict�datar=�modpkgs�importer�ispkgr� classlistrrrr��s�    ��      $     �  �       � �   � ��� � � � � �zHTMLDoc.docmodulec s��j}|p |}�j}g} | j�G�fdd�d�} | ��tt����} t| �dkr�����d�| D]} �d��| �j ��qd�d���������fdd�} ����fd d �}��������fd d �}�fd d�t ��D�}i�|D]j\}}}}d|d|�|<}zt �|�}Wnt �y2Yn0z |�|<Wq�t �yTYq�0q�|�rf| �rn| ���n |dd�t|�fdd��\}}�tju�r��tju�r�|}�qXn"��u�r�d}nd����j �}|d7}t|��| d||dd��}| d||dd��}| d||dd��}|d||dd��}|d||d d��}|d!||d"d��}|}�qXd#�| �} ||k�r�d$||f}nd%|||f}|�r�g}|D]} |���| �j ���q�|d&d'�|�}d#}zt���}Wntt f�yd}Yn0|�r2t|�}|�r2|d(k�r2|��|�d)}t��}|�rN||�pJd#}��|�j����}|�ond*|}��|d+d,| d-|�S).Ncs eZdZdd�Z�fdd�ZdS)z(HTMLDoc.docclass..HorizontalRulecSs d|_dSr��Zneedonerrrrr�hsz1HTMLDoc.docclass..HorizontalRule.__init__cs|jr�d�d|_dS)Nz
rLrtr��pushrr�maybejsz.HTMLDoc.docclass..HorizontalRule.maybeN�r+r r!r�rwrrurr�HorizontalRulegsryrMz&
Method resolution order:
z
%s
�
c s�t||�\}}|r�����|�|D]b\}}}}zt�|�}Wn$tyd���||���Yn0���||��������d�q&|S)NrK�rurwr#� Exceptionr�r���msgr�rr�okr&r��homeclsro�rFrE�hr�mdictrjrrvr:rr�spillzs  � zHTMLDoc.docclass..spillcsJt||�\}}|rF����|�|D]\}}}}���||���q&|Sr�rurwr�r}�r�rjrvr:rr�spilldescriptors�sz*HTMLDoc.docclass..spilldescriptorsc s�t||�\}}|r�����|�|D]r\}}}}��t�|�|��}t|�} | s`�d|�n0��t|��j����} d| } �d|| f��d�q&|S)Nz
%s
z
%sz
%s%s
rK)rurwr�r#rJrMr-) r~r�rrrr&r�r�ror<r=r�rr� spilldata�s � z#HTMLDoc.docclass..spilldatacs,g|]$\}}}}t|�d�r||||f�qS�)r9�r��r�r&r�r%rorrrr��s  �z$HTMLDoc.docclass..r��-rcs |d�uS�NrMrr]�� thisclassrrr��r�z"HTMLDoc.docclass..� defined here�inherited from %sz:
z Methods %scSs |ddkS�NrL�methodrr]rrrr��r�zClass methods %scSs |ddkS�NrLz class methodrr]rrrr��r�zStatic methods %scSs |ddkS�NrLz static methodrr]rrrr��r�zReadonly properties %scSs |ddkS�NrLr�rr]rrrr��r�zData descriptors %scSs |ddkS�NrLr�rr]rrrr��r�zData and other attributes %scSs |ddkS�NrLrorr]rrrr��r�rEz*class %sz/%s = class %s�(%s)rN�()r*z%s
 
z#000000z#ffc8d8r[)r+rhrrr�getmrorOrwr7r r�r#r|rC�popleftru�builtinsrr�rP� signature� ValueErrorrBr rJrMr-r()r:rr&rjrErFrk�realnamerUrry�mror<r�r�r�r�rnr�r�ro�anchor� inherited�tagrrV�declr��argspecr=r) rFrEr�r�rjrrvr:r�rr�\s�  �   �    �  � � � � � �  �� zHTMLDoc.docclasscCs|�d|�|��S�N�=)r4r�rrrr� formatvalue�szHTMLDoc.formatvaluec Cs�|j}|p |}|r|jpdd|} d} d} t|�r�|jj} |rZ| |ur�d|�| |�} n0|jdurzd|�|jj|�} nd|�| |�} t�|�s�t�|�r�d} nd} ||kr�d| |f}nD|r�t�||g�|ur�d |jd||f}d } n|}d | ||f}d}t� |��rjzt� |�}Wnt t f�y<d}Yn0|�rjt |�}|d k�rjd |}|d d�}|�std}| ||�|�| �o�|�d| �}| �r�d|S|�t|�|j|||�}|�o�d|}d||fSdS)NrEr�r� from � method of %s instance� unbound %s method�async z$%sz%srLz)%s = %s�z$%s lambda r�(...)z'%sz
%s
z
%s
z
%s
%s
)r+rer,r-r7r�iscoroutinefunction�isasyncgenfunction�getattr_staticrVr�r�rCrBr r4rMrJr-)r:rr&rjrErFrmrlr�r��note�skipdocs�imclass�asyncqualifierrZreallinkr�r�r�r=rrrr�sl � ���     ��zHTMLDoc.docroutinecCsNg}|j}|r|d|�|�t|�|j�}|r<|d|�|d�d�|�S)Nz!
%s
z
%s
rzrE)rrMrJr-rP�r:rr&rjrlr�rvr=rrrr�Cs  zHTMLDoc.docdatacGs|r d|pd}||�|�S)Nz%s = rE�r�)r:rr&rjrkZlhsrrrr�SszHTMLDoc.docothercCs�g}|duri}t�|g�D]<\}}}tdd�|D��r:q|�|d|||vf�d||<q|��|�||j�}|�|dd|�S)Ncss*|]"}dt|�kodknVqdS)i�i��N)�ord�r�Zchrrr� ]r�z HTMLDoc.index..rErLr[r`)rgrh�anyrr�r3r<r))r:rr:rprqr&rrrrrr�indexXs  z HTMLDoc.index)rE)r&rENr!)r�)N)NN)NNN)NN)N)r+r r!r��_repr_instancer�r r r%r(r)r-r3r4r6r7r9r<r=rMrPr�r�r�r�r�r�r�r�rrrrr2s< �  +  y#� A  rc@s0eZdZdd�Zdd�Zdd�ZeZdd�Zd S) �TextReprcCs,t�|�d|_|_d|_d|_|_dSr�rrrrrr�ks  zTextRepr.__init__cCsTtt|�d�r@dd�t|�j���}t||�r@t||�||�Sttt|��|j �Sr) r�rArPr+r"r#r`rcr�rrrrrrqs  zTextRepr.repr1cCsHt||j�}t|�}d|vrDdt|dd�vrDd|d||dS|S)Nr�rrErr)r`rr�rZrrrrrxs  zTextRepr.repr_stringcCs4zttt|��|j�WSd|jjYS0dSr)r`rcr�rr-r+rrrrr�szTextRepr.repr_instanceN)r+r r!r�rrrrrrrrr�is  r�c@szeZdZe�ZejZdd�Zddd�Zdd�Zdd d �Z dd d �Z ddd�Z dd�Z ddd�Z ddd�ZeZddd�ZdS)�TextDoccCsd�dd�|D��S)NrEcss|]}|d|VqdS)�Nrr�rrrr��r�zTextDoc.bold..)rPr rrr�bold�sz TextDoc.bold� cs>|sdS�fdd�|�d�D�}|r4|d��|d<d�|�S)NrEcsg|] }�|�qSrr�r�r���prefixrrr��r�z"TextDoc.indent..rKr)r"rHrP)r:rXr�rQrr�r�indent�szTextDoc.indentcCs$|�|���}|�|�d|dS)NrKr*)r�rHr�)r:rrZclean_contentsrrrr(�szTextDoc.sectionNrEc s�d}|D]�}t|�td�urr|\}}||t|��}|rh||fkrh�fdd�|D�} |dd�| �}|d}qt|�tg�ur||�|�||d�}q|S) NrErc3s|]}t|��VqdSr�rT)r�rT�rSrrr��r�z%TextDoc.formattree..r�rNrKr�)rArTrPrP) r:rQrSrRr�rIrSrTrUrVrr�rrP�s  �zTextDoc.formattreec Cs|j}tt|��\}}|�d||o(d|�}t|dd�}|�|�}|dur`||�d|d�}|rt||�d|�}g} t�|t�D]<\} } |dus�t� | �p�||ur�t | ||�r�| � | | f�q�g} t�|tj �D]B\} } |dus�t� | �s�t� | �|ur�t | ||�r�| � | | f�q�g} t�|t�D]&\} } t | ||��r(| � | | f��q(g}t�}t|d��r�t�|j�D]6\}}}|�|�|�r�|� |d�n |� |��qr|��||�d d �|��}g}t�|tj�D]0\} } | j�|d ��r�| |v�r�|� | ��q�|�r0|��||�d d �|��}| �r�d d�| D�}|�t�|d�|�g}| D]\} } |� |�| | |���q^||�dd �|��}| �r�g}| D]\} } |� |�| | |���q�||�dd �|��}| �r g}| D]"\} } |� |j| | |dd���q�||�dd �|��}t|d��rzt|j�}|dd�dk�rj|dd�dk�rj|dd���}||�d|�}t|d��r�||�dt|j ��}t|d��r�||�dt|j!��}t|d��r�||�d t|j"��}zt�#|�}Wnt$�yd!}Yn0||�d"|�}|S)#N�NAME� - razMODULE 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. Z DESCRIPTIONr}� (package)zPACKAGE CONTENTSrKrZ SUBMODULEScSsg|] \}}|�qSrrr_rrrr��r�z%TextDoc.docmodule..rL�CLASSES� FUNCTIONS�F)r^ZDATArrXrYrrZ�VERSIONrvZDATEr|ZAUTHORrxZCREDITSr��FILE)%r+rRrJr(r#r�rrgrrfr�rrVr/rW�setr�rgrhr}�addr�rPrUr�rPrir�r�rBrrNrvr|rxr�rC)r:rr&rjZsynop�descrIr�r�rFrnrorErorpZ modpkgs_namesrqrSrrZ submodulesrsrrnr�rrrr��s�   � � �    � � �     $    zTextDoc.docmodulec sJ�j}|p |}�j}�jfdd�}||kr:d��|�}n��|�d|}|rlt||�} |dd�| �}g} | j�zt���} Wnt t fy�d} Yn0| r�t | �} | r�| dkrȈ|| d�t ��} | r��| d�t t����}t|�d k�r(�d �|D]}�d ||���q�d �td d�t���D�t jd�}t|�}d}|�r��d�|d|�D]}�d |��ql||k�r��dt ||�d��d �G�fdd�d�}|�������fdd�}����fdd�}�����fdd�}�fdd�t��D�}|�r|�r(|���n |dd �t|�fdd ��\}}�tju�rl�tju�rl|}�qn ��u�r|d!}nd"t��j�}t|��|d#||d$d ��}|d%||d&d ��}|d'||d(d ��}|d)||d*d ��}|d+||d,d ��}|d-||d.d ��}|}�qd�| �} | �s.|dS|d��| ��d/�dS)0NcSs t||�Srr�)rTr�rrr�makenamesz"TextDoc.docclass..makename�class z = class r�rNr�rKrMzMethod resolution order:r�rEcss.|]&}|j�d�s|jdkrt|j�VqdS)r�r�N)r+r�r rB)r�r%rrrr�Cs�z#TextDoc.docclass..r�r�zBuilt-in subclasses:z ... and z other subclassescs eZdZdd�Z�fdd�ZdS)z(TextDoc.docclass..HorizontalRulecSs d|_dSr�rtrrrrr�Usz1TextDoc.docclass..HorizontalRule.__init__cs|jr�d�d|_dS)NzF----------------------------------------------------------------------rLrtrrurrrwWsz.TextDoc.docclass..HorizontalRule.maybeNrxrrurrryTsryc s�t||�\}}|r|����|�|D]T\}}}}zt�|�}Wn$tyd���||���Yq&0���||����q&|Srr{r}�r�rjrrvr:rrr�]s �zTextDoc.docclass..spillcsJt||�\}}|rF����|�|D]\}}}}���||���q&|Srr�r}r�rrr�nsz*TextDoc.docclass..spilldescriptorsc s�t||�\}}|r�����|�|D]\\}}}}t|�}zt�|�} Wntyd|j|} Yn0��j| |�d|d�d�q&|S)Nr�)r^r=rK)rurwrJr#r8�__dict__r�) r~r�rrrr&r�r�ror=r9r�rrr�ws �z#TextDoc.docclass..spilldatacs,g|]$\}}}}t|�d�r||||f�qSr�r�r�rrrr��s  �z$TextDoc.docclass..rcs |d�uSr�rr]r�rrr��r�z"TextDoc.docclass..r�r�z Methods %s: cSs |ddkSr�rr]rrrr��r�zClass methods %s: cSs |ddkSr�rr]rrrr��r�zStatic methods %s: cSs |ddkSr�rr]rrrr��r�zReadonly properties %s: cSs |ddkSr�rr]rrrr��r�zData descriptors %s: cSs |ddkSr�rr]rrrr��r�zData and other attributes %s: cSs |ddkSr�rr]rrrr��r�z | )r+rhr r��maprPrrr�r�rCrBrJrr�rO�sortedrA�__subclasses__r�r�r�rur�rrTr�r�rH)r:rr&rjrkr�rUr�rrVrr�r�r=r�r<Z subclassesZno_of_subclassesZMAX_SUBCLASSES_TO_DISPLAYZ subclassnameryr�r�r�r�r�r�r)r�rjrrvr:r�rr�s�    �  ��  �   �  � � � � � � zTextDoc.docclasscCsd|�|�Sr�r�rrrrr��szTextDoc.formatvaluec Cs�|j}|p |}d}d}t|�rn|jj}|rB||urndt||�}n,|jdur`dt|jj|�}ndt||�}t�|�s�t�|�r�d} nd} ||kr�|�|�} n,|r�t� ||g�|ur�d}|�|�d|} d} t� |��r:zt� |�} Wnt t f�yd} Yn0| �r:t| �} |d k�r:|�|�d } | dd �} | �sDd } | | | |} |�rb| d St|��pnd}| d |�o�|�|���d SdS)NrErr�r�r�r�rL� = r�z lambda rr�rK)r+rer,r-rTrr�r�r�r�rVr�r�rCrBrJr�rH)r:rr&rjrlr�r�r�r�r�rr�r�r�r=rrrr��sT � �     zTextDoc.docroutinecCsTg}|j}|r$||�|��|d�t|�p.d}|rJ||�|��|d�d�|�S)NrKrE)rr�rJr�rPr�rrrr��s zTextDoc.docdatac Cs�|�|�}|rF|r|dpd|}|t|�} | dkrF|d| �d}|rX|�|�dpZd|}|slt|�}|r�|d|�t|��d7}|S)Nr�rErr\rK)r�rOr�rJr�rB) r:rr&rjrRr^r=r�r�Zchoprrrr��s  zTextDoc.docother)r�)NrE)NN)NN)NNN)NNN)NNNNN)r+r r!r�r�r�r�r�r(rPr�r�r�r�r�r�r�rrrrr��s   e  7 r�c@seZdZdd�ZdS)� _PlainTextDoccCs|Srrr rrrr� sz_PlainTextDoc.boldN)r+r r!r�rrrrr� sr�cCst�at|�dSr)�getpager�pagerrbrrrr�sr�c sZttjd�stSttjd�s tStj��r4tj��s8tStj�d�pNtj�d���r�tj dkrj�fdd�Stj�d�dvr��fd d�S�fd d�Stj�d�dvr�tStj dkr�d d�Sttd �r�t� d �dkr�dd�Sddl }|� �\}}t� |�zRttd ��r,t� d|�dk�r,dd�Wt�|�StWt�|�SWt�|�n t�|�0dS)N�isattyZMANPAGERZPAGER�win32cstt|���Sr�� tempfilepager�plainrb�Z use_pagerrrr�#r�zgetpager..ZTERM)ZdumbZemacscstt|���Sr)� pipepagerr�rbr�rrr�%r�cs t|��Sr�r�rbr�rrr�'r�cSstt|�d�S)Nzmore /dev/nullrcSs t|d�S)NZlessr�rbrrrr�-r�z more "%s"cSs t|d�S)NZmorer�rbrrrr�4r�)r�r�stdin� plainpager�stdoutr�r r�r�platformr��tempfile�mkstemp�close�unlink�ttypager)r��fdr�rr�rr�s>           � �r�cCst�dd|�S)Nz.rE)rFrGrbrrrr�:sr�c Cs�ddl}|j|d|jd�}zVtj|jdd��2}z|�|�WntyNYn0Wd�n1sd0YWnty�Yn0z|� �Wq�Wq�ty�Yq�0q�dS)NrT)�shellr��backslashreplace)�errors) � subprocess�Popen�PIPE�io� TextIOWrapperr��write�KeyboardInterruptr��wait)rX�cmdr��proc�piperrrr�>s (  r�c Cs�ddl}|����}tj�|d�}t|ddtjdkr) r��TemporaryDirectoryr r rPr�rr��device_encodingr�r�)rXr�r��tempdirr�r�rrrr�Us � �(r�cCs$ttjdd�pd}|�|d��|�S)Nr�utf-8r�)r#rr��encode�decode)rXrrrr�_escape_stdoutasr c Cs�tt|���d�}z2ddl}tj��}|�|�}|�|�dd�}Wn&t t t j fyjd}dd�}Yn0�zDzt tj�dd��}Wnty�d}Yn0|dkr�d}|d}}tj�d�|d|��d�||d��r�tj�d �tj��|�} | d v�rtj�d ��q�n,| d v�rFtj�d ||d�|d}q�| d v�rj|||}|dk�rjd}tj�dd�||||��d�||}q�W|�r�|�||j|�n|�r�|�||j|�0dS)NrKrcSs tj�d�Srf)rr�r�rrrrr�nr�zttypager..cSstj��dd�dd�S)NrrL)rr�r�rrrrr�qr��LINESrL�z -- more --)�q�Qz )� rK)�b�B�)r�r r"�ttyrr��filenoZ tcgetattrZ setcbreakr�r8r��UnsupportedOperationrDr r�rr�r�r�rP�flushZ tcsetattrZ TCSAFLUSH) rXrQrr��oldZgetchar�hrZincrTrrrr�fsN              & �r�cCstj�tt|���dSr)rr�r�r�r rbrrrr��sr�cCs�t�|�r>|jtjvr d|jSt|d�r4d|jSd|jSt�|�rRd|jSt�|�rtd|jj |jj|jfSt� |�r�d|jj |jj|jfSt |�r�d|jSt� |�r�d |jSt� |�r�d |jSt|�jS) Nzbuilt-in module r}zpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%sr�z function zmethod )rrUr+rr�r�r/Zisgetsetdescriptorr3r r4rr.r*rA)�thingrrr�describe�s2          �  �     rc Cs�dd�|�d�D�}d\}}|t|�kr\td�|d|d��|�}|r\||d}}qq\q|rf|}nt}||d�D]*}zt||�}Wqvty�YdS0qv|S)NcSsg|] }|r|�qSrr)r�r�rrrr��r�zlocate..rr�rL)r"rOr�rPr�r#r8)r r�rlr��nZ nextmodulerr�rrr�locate�s   rcCsVt|t�r0t||�}|dur(td|��||fSt|dd�}|t|t�rL|ndfSdS)Nz~No Python documentation found for %r. Use help() to get the interactive help utility. Use help(str) for help on the str class.r+)rrBrr�r#)rr�rr&rrr�resolve�s  � r� Python Library Documentation: %scCs�|dur t}t||�\}}t|�}t�|�}|rTd|vrT|d|d|�d��7}n|rn||urn|d|j7}t�|�s�t|�s�t� |�s�t� |�s�t |�s�t |d�r�|j }nt|�}|d7}||d|�||�S)Nrz in z in module � __origin__z objectr*)rXrrrrf�rfindr+rUrrVr2rDr�rrAr�)rrr�Zrendererrr&r�r�rrr� render_doc�s.    ���� r c Cshz2|durtt|||��n|�t|||t��Wn0ttfyb}zt|�WYd}~n d}~00dSr)r�r r�� plaintextr�r��print)rrr��outputrorrrr=�s r=c Cs�ztt||�\}}t�t|�t�||��}t|dddd��}|�|�Wd�n1sZ0Ytd|d�Wn0tt fy�}zt|�WYd}~n d}~00dS)Nr�rr)rZwrote) r�htmlr rr�r�r�r"r�r�)rr�rr&r r�rorrr�writedoc�s(r%rEcCs2|dur i}t�|g|�D]\}}}t|�qdSr)rg� walk_packagesr%)r�pkgpath�donerqrSrrrrr� writedocs s  r)cJ@s.eZdZdddddddddddd d d d d ddddddddddddddddddddd�$Zd d!�d"D�Zd#d$d%d&ge�Rd'd(d)d*d+d,d-�Zd.d/d0d1d2d3d4d5d6d7d8d9d9d:d:d;�Ze��D]:\ZZ e D],Z e� e e�Z ee vr�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)��HelperrE�BOOLEAN�with)�assertrE)�asyncrE)�awaitrE)�break� while for)�classzCLASSES SPECIALMETHODS)�continuer1)�functionrE)�del� BASICMETHODS�if)�elser1�try)�forzbreak continue while�import)�globalznonlocal NAMESPACES)r7� TRUTHVALUE)r;�MODULES)�in�SEQUENCEMETHODS� COMPARISON)�lambdar�)�nonlocalzglobal NAMESPACES)�passrE)�raise� EXCEPTIONS)�returnr�)r9rF)�whilezbreak continue if TRUTHVALUE)r,z CONTEXTMANAGERS EXCEPTIONS yield)�yieldrE)$�False�None�True�__peg_parser__�and�asr-r.r/r0r2r3�defr5�elifr8�except�finallyr:�fromr<r7r;r?�isrBrC�not�orrDrErGr9rHr,rIcCsg|]}dD] }||�q qS)��'r>r)r��pr rrrr�Er�zHelper.)r�fr�urYz'''r>r�)�+r��*�**r�z//�%�<<�>>r �|�^�~r r �<=�>=�==�!=�<>)r r rfrgrhrirj)r�re) z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//=)rarbr rcrdre)�j�J)�STRINGS� OPERATORSrA�UNARY�AUGMENTEDASSIGNMENT�BITWISE�COMPLEXzOPERATORS FORMATTING�POWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTS�ELLIPSISzSLICINGS DICTIONARYLITERALSz def classrm� PRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)r`r_�,rr\�:�@r�r�r��`r?rO�[�]r�)rzRSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect)�stringsz4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES)zstring-methodszSTRINGS FORMATTING)Z formatstringsrn)r|z:encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPES)ZnumberszINTEGER FLOAT COMPLEX TYPES)Zintegersz int range)Zfloatingz float math)Z imaginaryz complex cmath)Ztypesseqz$STRINGMETHODS FORMATTING range LISTS� DICTIONARIES)Ztypesfunctionsz def TYPES)Z typesmethodszclass def CLASSES TYPES)zbltin-code-objectszcompile FUNCTIONS TYPES)zbltin-type-objectsz types TYPES�TYPES)zbltin-null-objectrE)zbltin-ellipsis-object�SLICINGS)Z specialattrsrE)rz!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)r�zMAPPINGS SPECIALMETHODS)z numeric-typesz*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS)Z execmodelz%NAMESPACES DYNAMICFEATURES EXCEPTIONS)Znamingz3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES)zdynamic-featuresrE� NAMESPACES)r�ztry except finally raise)Z conversionsrE)Z identifierszkeywords SPECIALIDENTIFIERS)z id-classesrE)zatom-identifiersrE)z atom-literalsz=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS� SEQUENCES)Z exprlistszTUPLES LITERALS)ztypesseq-mutable� LISTLITERALS)ZlistszLISTS LITERALS)Z typesmapping�DICTIONARYLITERALS)r5zDICTIONARIES LITERALS)zattribute-referencesz(getattr hasattr setattr ATTRIBUTEMETHODS)Z subscriptionsr@)Zslicingsr@)Zcallsr�)Zpowerr�)Zunaryr�)�binaryr�)Zshiftingr�)Zbitwiser�)Z comparisonszEXPRESSIONS BASICMETHODS)ZbooleanszEXPRESSIONS TRUTHVALUEr-)Z assignmentrp)Z augassign� NUMBERMETHODSr5rG)Zcompoundzfor while break continue)�truthz if while and or not BASICMETHODS)ZdebuggerZpdb)zcontext-managersr,)Ir~rmZ STRINGMETHODSZ FORMATTING�UNICODEZNUMBERSZINTEGER�FLOATrrr�ZMAPPINGSr�ZMETHODSZ CODEOBJECTSZ TYPEOBJECTSZ FRAMEOBJECTSZ TRACEBACKS�NONErtZSPECIALATTRIBUTESr�r>ZPACKAGESr�rnZ PRECEDENCEZOBJECTSZSPECIALMETHODSr6ZATTRIBUTEMETHODSZCALLABLEMETHODSr@ZMAPPINGMETHODSr�Z EXECUTIONr�ZDYNAMICFEATURESZSCOPINGZFRAMESrFZ CONVERSIONSZ IDENTIFIERSZSPECIALIDENTIFIERSruZLITERALSZTUPLESZ TUPLELITERALSZLISTSr�r}r�Z ATTRIBUTESZ SUBSCRIPTSrZCALLSrsroZBINARYZSHIFTINGrqrAr+Z ASSERTIONZ ASSIGNMENTrpZDELETIONZ RETURNINGZ IMPORTINGZ CONDITIONALZLOOPINGr=Z DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dSr)�_input�_output)r:�inputr#rrrr��szHelper.__init__cCs |jp tjSr)r�rr�rrrrr��sz Helper.inputcCs |jp tjSr)r�rr�rrrrr#�sz Helper.outputcCs2t��dddkr|�dSd|jj|jjfS)NrLr[�?rEz<%s.%s instance>)r�stackr-r r!rrrr�__repr__�s �zHelper.__repr__cCs6||jur|�|�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�interactr#r��r:Zrequestrrr�__call__�s   zHelper.__call__c Cs�|j�d�z|�d�}|s Wq�Wnttfy<Yq�Yn0|��}t|�dkr�|d|dkrndvr�nn |d|dd�vr�|dd�}|��dvr�q�|d kr�|��q |� |�q dS) NrKzhelp> rMrrrXrL)r �quitr) r#r��getliner��EOFErrorrNrOr�r�rr�rrrr��s    ,�  zHelper.interactcCs8|jtjurt|�S|j�|�|j��|j��SdSr)r�rr�r#r�rr�)r:�promptrrrr��s    zHelper.getlinecCs<t|�td�u�r|��}|dkr,|��n�|dkr>|��n�|dkrP|��n�|dkrb|��n�|dd�dkr�|�|��d�n�||jvr�|�|�nj|d vr�t t |�d �nR||j vr�|� |�n<||j vr�|� |�n&|r�t |d |jd �nt td |jd �n$t|t��r|�nt |d |jd �|j�d �dS) NrE�keywords�symbols�topicsr�zmodules rL)rLrJrKz Help on %s:)r#rK)rArN� listkeywords� listsymbols� listtopics� listmodulesr"r�� showsymbolr=�evalr�� showtopicr�r�rBrr*r#r�r�rrrr�s$z Helper.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.%drM)r#r�r0rr�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)NrLr�rK)r/r�rOr.r#r�) r:�items�columnsr'Zcolwr1�rowr2r�rrrr/%s      &z Helper.listcCs |j�d�|�|j���dS)NzN Here is a list of the Python keywords. Enter any keyword to get more help. )r#r�r/r�rkrrrrr�2s 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. )r#r�r/r�rkrrrrr�9s zHelper.listsymbolscCs |j�d�|�|j���dS)NzN Here is a list of available topics. Enter any topic name to get more help. )r#r�r/r�rkrrrrr�As zHelper.listtopicsc Cs,z ddl}Wn ty,|j�d�YdS0|j�||j�|��}|s`|j�dt|��dSt|�td�ur||� ||�S|\}}z|jj|}Wn(t y�|j�dt|��YdS0|� �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 rErKr��Related help topics: rN�Hz %s )�pydoc_data.topicsr�r#r�r�rr�r�rAr��KeyErrorrN�textwraprPr"�wrapr�) r:�topic� more_xrefs� pydoc_data�target�label�xrefsr=r�rXZ wrapped_textrrrr�Hs4       zHelper.showtopiccCs�z ddl}Wnty YdS0|j�||j�|��}|sDtd��t|t�rZ|�||�S|\}}|jj|}|r�|pxdd|}||fS)Nr)r�rEzcould not find topicrEr�) r�r�r�rr�r�rrB� _gettopic)r:r�r�r�r�r�r�r=rrrr�hs      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�rrrL)�find)r rSr�rrrr�callback�sz$Helper.listmodules..callbackcs�d|d�dSrrr��r�rr�onerror�sz#Helper.listmodules..onerror�r�z� Enter any module name to get more help. Or, type "modules spam" to search for modules whose name or summary contain the string "spam". )r#r�r0�apropos� ModuleScanner�runr/rk)r:rnrr�rr�rr��s �    zHelper.listmodules)NN)r�r�)rE)rE)rE)!r+r r!r�Z _strprefixesZ_symbols_inverser�r�r�Zsymbols_r�rr�r�r0r�r#r�rr�r�r�r�rr�r/r�r�r�r�r�r�r�rrrrr*sD�(� �   �W       r*c@seZdZddd�ZdS)r�Nc Cs|r |��}d|_i}tjD]p}|dkrd||<|durF|d|d�qt|�jpRd}|�d�d}|d|}|���|�dkr|d||�qtj |d�D�]V\} }} |jr��q�|dur�|d|d�q�zt� | |�} Wnt y�Yq�Yn0| j } t | d ��rjz| �|�} Wn&t�y6|�r.||�Yq�Yn0tt�| ���pJd}t | d ��rd| �|�}nd}n^ztj�| �}Wn&t�y�|�r�||�Yq�Yn0|j�r�|j��dnd}t|d d�}|d|}|���|�dkr�||||�q�|�r|�dS) NF�__main__rLrErKrr�r�� get_source� get_filenamerz)r�r�rr�r�r?r"r�rgr&� _get_specr�r�r�r�r|r�r��StringIOr�r�r�r�r�r�r#)r:r�rnZ completerr��seenrSr&r�rqrrr�r��sourcer r�rrrr��s^            zModuleScanner.run)NNN)r+r r!r�rrrrr��sr�cCsXdd�}dd�}t���,t�d�t�j|||d�Wd�n1sJ0YdS)NcSs6|dd�dkr |dd�d}t||o.d|�dS�Nr�r�r�z- )r"�r rSr�rrrr��szapropos..callbackcSsdSrrr�rrrr��szapropos..onerror�ignorer�)�warnings�catch_warnings�filterwarningsr�r�)rnr�r�rrrr��s   r�cs�ddl�ddl�ddl�ddl�Gdd�d�jj��G�fdd�d�jj��G�����fdd�d�j�}||||�}|��|j s�|j s�t � d�q~|S) Nrc@seZdZdd�Zdd�ZdS)z!_start_server..DocHandlercSsX|j�d�rd}nd}|�d�|�dd|�|��|j�|�|j|��d��dS)Nz.css�text/css� text/html��z Content-Typez%s; charset=UTF-8r) r r�Z send_responseZ send_headerZ end_headersZwfiler�� urlhandlerr)r:� content_typerrr�do_GET0 s   ��z(_start_server..DocHandler.do_GETcWsdSrr)r:r�rrr� log_message@ sz-_start_server..DocHandler.log_messageN)r+r r!r�r�rrrr� DocHandler. sr�cs(eZdZdd�Z�fdd�Zdd�ZdS)z _start_server..DocServercSs6||_|j|f|_||_|j�||j|j�d|_dS�NF)�host�addressr�r<r��handlerr�)r:r��portr�rrrr�F s  z)_start_server..DocServer.__init__cs>|js2��|j��gggd�\}}}|r|��q|��dSrf)r��select�socketrZhandle_requestZ server_close)r:Zrd�wr�ex�r�rr�serve_until_quitM s  z1_start_server..DocServer.serve_until_quitcSs |j�|�|jr|�|�dSr)r<�server_activater�rrrrr�T s z0_start_server..DocServer.server_activateN)r+r r!r�r�r�rr�rr� DocServerD s r�cs:eZdZ�fdd�Z����fdd�Zdd�Zdd�Zd S) z#_start_server..ServerThreadcs2||_||_t|�|_�j�|�d|_d|_dSr�)r�r�rDr��Threadr��serving�error)r:r�r�r�)� threadingrrr�[ s   z,_start_server..ServerThread.__init__c szzJ�jj�_��_�jj�_t|j��_�|j |j |j �}||_ |� �Wn*tyt}z||_WYd}~n d}~00dSr)�server� HTTPServerr<r�r�ZMessageZ MessageClass� staticmethodr�r�r��ready� docserverr�r|r�)r:Zdocsvr�e)r�r��email�httprrr�c s    z'_start_server..ServerThread.runcSs,d|_|j|_|j|_d|j|jf|_dS)NTz http://%s:%d/)r�r�Z server_portr�r;)r:r�rrrr�p sz)_start_server..ServerThread.readycSs&d|j_|��d|_d|_d|_dS)NTF)r�r�rPr�r;rrrr�stopv s z(_start_server..ServerThread.stopN)r+r r!r�r�r�r�r)r�r�r�r�r�rr� ServerThreadY s  r�g{�G�z�?) Z http.serverZ email.messager�r�r�ZBaseHTTPRequestHandlerr�r�rJr�r��time�sleep)r��hostnamer�r��threadr)r�r�r�r�r�r�r� _start_server�s8'   r�r�cs6G�fdd�dt�}|���fdd���fdd���fdd���fd d ���fd d ���fd d���fdd���fdd����������fdd�}|�d�r�|dd�}|dk�rtj�tj�t��}tj�||�}t|��}d�|� ��Wd�S1�s0Yn|dk�r"||�St d||f��dS)NcseZdZ�fdd�ZdS)z_url_handler.._HTMLDoccsd}d|}d||��|fS)Nzpydoc_data/_pydoc.cssz1a  Pydoc: %s %s%s
%s
r)r:rr�css_pathZcss_link�� html_navbarrrr � s�� �z#_url_handler.._HTMLDoc.pageN)r+r r!r rr�rr�_HTMLDoc� sr�cs>��dt��t��dt��f�}d|��tjdd��fS)Nz %s [%s, %s]raZ
Python %s
%s
T)Zterse)r r�Zpython_versionZ python_buildZpython_compiler)rn�r$rrr�� s  ��z!_url_handler..html_navbarcs�dd�}��ddd�}dd�tjD�}��||�}|d��d dd |�g}i}tjD]}|���||��qT|�d �d d �|�fS)NcSs d||fSr8r�r&rrr� bltinlink� sz3_url_handler..html_index..bltinlinkz7Index of Modulesr[r\cSsg|]}|dkr|�qS)r�r)r�r&rrrr�� s�z4_url_handler..html_index..z

zBuilt-in Modulesr`z|

pydoc by Ka-Ping Yee<[email protected]>zIndex of ModulesrE) r%rr�r3r)r rr�rP)r�r%�namesrr�rr�rr� html_index� s"� � �z _url_handler..html_indexc s�g��fdd�}t���4t�d�dd�}t�j|||d�Wd�n1sR0Ydd�}g}��d d d �}�D]\}}|�||�|�qz|��d |d d d�|��}d|fS)Ncs:|dd�dkr |dd�d}��||o0d|f�dSr�rpr��Z search_resultrrr�� sz3_url_handler..html_search..callbackr�cSsdSrrr�rrrr�� sz2_url_handler..html_search..onerrorr�cSs d||fSr8rr�rrrr�� sz4_url_handler..html_search..bltinlinkz5Search Resultsr[r\zkey = %sr`�
zSearch Results) r�r�r�r�r�r%rr)rP) rnr�r�r�r�r%r&r�rr�rr� html_search� s$   0� �z!_url_handler..html_searchcsLdd�}��ddd�}ttj���}��||�}|��ddd|�}d|fS)NcSs d||fS�Nz%srr�rrrr�� sz4_url_handler..html_topics..bltinlink�,INDEXr[r\ZTopicsr`)r%r�r*r�rkr3r))r�r%rrr�rr� html_topics� s� �z!_url_handler..html_topicscsL��ddd�}ttj���}dd�}��||�}|��ddd|�}d|fS)Nrr[r\cSs d||fSrrr�rrrr� sz6_url_handler..html_keywords..bltinlinkZKeywordsr`)r%r�r*r�rkr3r))r%rr�rr�rr� html_keywords s� �z#_url_handler..html_keywordscs�t��}t||�}|�|�\}}||jvr0d}nd}��d|dd�}d��|�}��|dd|�}|r�t|� ��}dd �}�� ||�}�� d dd|�}d ||fd � |||f�fS) NZKEYWORDZTOPICrWr[r\z

%s
r`cSs d||fSrrr�rrrr�& sz7_url_handler..html_topicpage..bltinlinkr�z%s %srE) r�r�r*r�r�r%rMr)r�r"r3r(rP)r��bufZhtmlhelprr�rr%r�r�rr�html_topicpage s,  �  � �z$_url_handler..html_topicpagecs@t|dd�}|dur$|dkr$td��t|�}��||�}||fS)NrL)r�rKzcould not find object)rr�rr�)r;r9r�contentr�rr� html_getobj/ s   z!_url_handler..html_getobjcsP��ddd�}d��fdd�tt|�|�D��}|��|dd|�}d||fS) Nz,Errorr[r\rc3s|]}��|�VqdSr)r r�r�rrr�; r�z3_url_handler..html_error..z#bb0000z Error - %s)r%rPrrAr))r;r�r%rr�rr� html_error7 s� � �z _url_handler..html_errorc sp|}|�d�r|dd�}�z|dvr2��\}}n�|dkrF��\}}n�|dkrZ��\}}n�d|v�r |�d�\}}}|dkr��|�\}}n�|dkr�z�|�\}}Wnty��|�\}}Yn0nZ|d k�r|dvr��\}}n2z�|�\}}Wn t�y�|�\}}Yn0ntd ��n �|�\}}Wn4t�yb}z�||�\}}WYd}~n d}~00��||�S) Nr������)rEr�r�r�r�z search?keyz topic?keyzget?keyz bad pydoc url)r�r�r�r|r )r;Z complete_urlrr �opr�r�)r$r r rrrr rrr� get_html_pageA s>          $z#_url_handler..get_html_pager�rLr�rEr�z"unknown content type %r for url %s) rr�r r �dirname�realpathrzrPr�� readlinesrC)r;r�r�rZ path_herer��fpr) r$r r rrr�rr rr� _url_handler� s*         (    0 rT� localhost)� open_browserr�c Cs�ddl}tt||�}|jr(t|j�dS|jr�d}|rB|�|j�z�zZtd|j�t|�|jr�td�}|� �}|dkr|q�qZ|dkr�|�|j�qZt|�qZWnt t fy�t�Yn0W|jr�|� �td�n|jr�|� �td�0dS)Nrz"Server commands: [b]rowser, [q]uitzServer ready atzserver> r rzServer stopped) � webbrowserr�rr�r"r�r�r;r�r�r�r�r�)r�rr�rZ serverthreadZserver_help_msgr�rrr�browsev s8     �rcCst|t�o|�tj�dkSr�)rrBr�r �sep)rtrrr�ispath� srcCsvd|vstj|vst��|vr"dStj�t�}tj�|�}|��}||vrbtj�||�sb|�|�|� dt���|S)NrEr) r �curdir�getcwdr rrz�copy�samefile�remove�insert)Z given_pathZargv0Z stdlib_dirZ script_dir� revised_pathrrr�_get_revised_path� s    r#cCs,ttjtjd�}|dur(|tjdd�<dSr�)r#rr �argv)r"rrr�_adjust_cli_sys_path� sr%c Cs�ddl}Gdd�dt�}t��zx|�tjdd�d�\}}d}d}d}d}d}|D]\\} } | dkrld }d }| d kr�t| �WdS| d kr�d }| }| d kr�d }| d krTd }| }qT|r�t|||d�WdS|s�|�|D]�} t| ��rtj � | ��st d| ��q�z`t| ��r&tj � | ��r&t | �} |�rXt| ��rNtj �| ��rNt| �nt| �n t�| �Wq�t�y�} zt | �WYd} ~ q�d} ~ 00q�WnL|j|f�y�tj �tj �tjd��d} t dj| tjd��Yn0dS)Nrc@s eZdZdS)zcli..BadUsageN)r+r r!rrrr�BadUsage� r�r&rLzbk:n:p:wFrz-bTz-kz-pz-wz-n)r�rzfile %r does not exista�pydoc - the Python documentation tool {cmd} ... Show text documentation on something. 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 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 Search for a keyword in the synopsis lines of all available modules. {cmd} -n Start an HTTP server with the given hostname (default: localhost). {cmd} -p 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 ... Write out the HTML documentation for a module to a file in the current directory. If 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%rr$r�rrr r �existsr"r�r�r r)r%rr�r�r�r�r0r)r'r&Zoptsr��writingZ start_serverrr�r��opt�val�argror�rrr�cli� s`    $�r-r�)NN)r)r)rrN)rrN)r)rEN)r�)r)_rar|rvrxr�Zimportlib._bootstrapr�Zimportlib._bootstrap_external�importlib.machinery�importlib.utilrr�r rgr�rFrr�r�r�r� urllib.parserbr�� collectionsr�reprlibr� tracebackrrrr'r>r7rDrJrRrTrWrZr`r@� IGNORECASErarcrerjrur�r�r�r�r�r�r|r�r�r�r�r�rr�r�r�r�r�r�r�r�r r�r�rrrXr!r$rr r=r%r)r*rr�r�r�rrrr#r%r-r+rrrr�(s�      3      ' 0:*; " ,  � � = n% U