Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib64/python3.7/Doc/tools/extensions/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/Doc/tools/extensions/__pycache__/pyspecific.cpython-37.opt-1.pyc

B

� f�E�O@s~dZddlZddlZddlmZmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZdd	lmZmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlm Z m!Z!ddl"m#Z#ddl$m%Z%m&Z&ddl'Z'dZ(dZ)dZ*ddl+m,Z,dd�e,j-j.d<e,j-j.d<e,j-j.d<e,j-j.d<ej/Z0e#j1Z2dd�Z3dd �Z4e3e_/e4e#_1igfd!d"�Z5igfd#d$�Z6igfd%d&�Z7Gd'd(�d(e
�Z8Gd)d*�d*e
�Z9Gd+d,�d,e:�Z;Gd-d.�d.e;e%�Z<Gd/d0�d0e;e&�Z=Gd1d2�d2e:�Z>Gd3d4�d4e:�Z?Gd5d6�d6e>e%�Z@Gd7d8�d8e>e&�ZAGd9d:�d:e?e&�ZBGd;d<�d<e?e&�ZCGd=d>�d>e&�ZDGd?d@�d@e
�ZEe�FdAejG�ZHe�FdBejG�ZIe�FdC�ZJGdDdE�dEe
�ZKdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�gOZLGd�d��d�e�ZMe�Fd��ZNd�d��ZOe�Fd��ZPd�d��ZQd�d��ZRdS)�z�
    pyspecific.py
    ~~~~~~~~~~~~~

    Sphinx extension with Python doc-specific markup.

    :copyright: 2008-2014 by Georg Brandl.
    :license: Python license.
�N)�getenv�path)�asctime)�pformat)�StringOutput)�	Directive)�new_document)�nodes�utils)�addnodes)�Builder)�translators)�status_iterator)�split_explicit_title)�HTMLTranslator)�
TextWriter�TextTranslator)�LaTeXTranslator)�
PyModulelevel�
PyClassmemberz5https://bugs.python.org/issue?@action=redirect&bpo=%sz+https://github.com/python/cpython/issues/%sz-https://github.com/python/cpython/tree/3.7/%s)�BodycCsdS)N�)�xrr�D/opt/alt/python37/lib64/python3.7/Doc/tools/extensions/pyspecific.py�<lambda>/�rZ
loweralphaZ
upperalphaZ
lowerromanZ
upperromancCsH|jjj|jj}|jj}d|kr*d|j_zt||�Wd||j_XdS)N�keepdoctestF)�builder�env�metadataZcurrent_docname�highlighter�trim_doctest_flags�orig_visit_literal_block)�self�node�meta�old_trim_doctest_flagsrrr�new_visit_literal_block7sr'cCsJ|jjj|jd}|jj}d|kr,d|j_zt||�Wd||j_XdS)N���rF)rrrZcurfilestackr r!�orig_depart_literal_block)r#r$r%r&rrr�new_depart_literal_blockBsr*cCs~t�|�}dt|�kr"dkrXnn2|jjd|�d�|d�}|�|||�}	|	g|gfSd|}tj||t|d�}
|
ggfS)Ni��i�zThe BPO ID z/ seems too high -- use :gh:`...` for GitHub IDs)�linezbpo-)�refuri)	r
�unescape�int�reporter�error�problematicr	�	reference�	ISSUE_URI)�typ�rawtext�text�lineno�inliner�options�content�issue�msg�prb�refnoderrr�
issue_roleSs
r?cCsnt�|�}t|�dkrH|jjd|�d�|d�}|�|||�}	|	g|gfSd|}tj||t|d�}
|
ggfS)Ni�~zThe GitHub ID z. seems too low -- use :issue:`...` for BPO IDs)r+zgh-)r,)	r
r-r.r/r0r1r	r2�GH_ISSUE_URI)r4r5r6r7r8r9r:r;r<r=r>rrr�
gh_issue_rolebs
rAcCs@t|�\}}}	t�|�}t�|	�}	tj||t|	d�}
|
ggfS)N)r,)rr
r-r	r2�
SOURCE_URI)r4r5r6r7r8r9r:Zhas_t�title�targetr>rrr�source_rolers


rEc@s(eZdZdZdZdZdZdZdd�ZdS)�ImplementationDetailTr�zCPython implementation detail:cCs.tjdgd�}td�|j�}|j}t�||�}|jrh|j�	|jd|j
�\}}|�tjd||���|j�
||j|�|j�rt|dtj��rtj|djdd�}|dj|_|dj|_||dj7}|d�tjdd|dd��|d�d|�|d�d	t�d
��n|�dt�dd|��|gS)Nzimpl-detail)�classes�sphinxr�T)�translatableFrG� )rJrJ)r	�compoundr
�gettext�
label_textr:�strong�	arguments�state�inline_textr7�append�	paragraph�nested_parse�content_offset�children�
isinstance�inline�	rawsource�sourcer+�replace_self�insertZText)r#�pnode�labelr:Zadd_text�n�mrrr�run�s&
zImplementationDetail.runN)	�__name__�
__module__�__qualname__�has_content�required_arguments�optional_arguments�final_argument_whitespacerOrcrrrrrF|srFc@s$eZdZdZdZdZdZdd�ZdS)�AvailabilityFrGrTcCsnd}tj||jddgd�}|j�||j�\}}|�||�|j�|jd|j�\}}|�||�|gS)Nz$:ref:`Availability <availability>`: r�availability)rH)r	rUrQrRrSr7�extend)r#Zavailability_refr_rarbrrrrc�s
zAvailability.runN)rdrerfrgrhrirjrcrrrrrk�s
rkcs$eZdZ�fdd�Zdd�Z�ZS)�PyDecoratorMixincs*tt|��||�}|�dt�dd��|S)Nr�@)�superrn�handle_signaturer^r�desc_addname)r#�sig�signode�ret)�	__class__rrrq�sz!PyDecoratorMixin.handle_signaturecCsdS)NFr)r#rrr�
needs_arglist�szPyDecoratorMixin.needs_arglist)rdrerfrqrw�
__classcell__rr)rvrrn�srnc@seZdZdd�ZdS)�PyDecoratorFunctioncCsd|_t�|�S)Nzpy:function)�namerrc)r#rrrrc�szPyDecoratorFunction.runN)rdrerfrcrrrrry�sryc@seZdZdd�ZdS)�PyDecoratorMethodcCsd|_t�|�S)Nz	py:method)rzrrc)r#rrrrc�szPyDecoratorMethod.runN)rdrerfrcrrrrr{�sr{cseZdZ�fdd�Z�ZS)�PyCoroutineMixincs*tt|��||�}|�dt�dd��|S)Nrz
coroutine )rpr|rqr^r�desc_annotation)r#rsrtru)rvrrrq�sz!PyCoroutineMixin.handle_signature)rdrerfrqrxrr)rvrr|�sr|cseZdZ�fdd�Z�ZS)�PyAwaitableMixincs*tt|��||�}|�dt�dd��|S)Nrz
awaitable )rpr~rqr^rr})r#rsrtru)rvrrrq�sz!PyAwaitableMixin.handle_signature)rdrerfrqrxrr)rvrr~�sr~c@seZdZdd�ZdS)�PyCoroutineFunctioncCsd|_t�|�S)Nzpy:function)rzrrc)r#rrrrc�szPyCoroutineFunction.runN)rdrerfrcrrrrr�src@seZdZdd�ZdS)�PyCoroutineMethodcCsd|_t�|�S)Nz	py:method)rzrrc)r#rrrrc�szPyCoroutineMethod.runN)rdrerfrcrrrrr��sr�c@seZdZdd�ZdS)�PyAwaitableFunctioncCsd|_t�|�S)Nzpy:function)rzrrc)r#rrrrc�szPyAwaitableFunction.runN)rdrerfrcrrrrr��sr�c@seZdZdd�ZdS)�PyAwaitableMethodcCsd|_t�|�S)Nz	py:method)rzrrc)r#rrrrc�szPyAwaitableMethod.runN)rdrerfrcrrrrr��sr�cs$eZdZ�fdd�Zdd�Z�ZS)�PyAbstractMethodcs*tt|��||�}|�dt�dd��|S)Nrzabstractmethod )rpr�rqr^rr})r#rsrtru)rvrrrq�sz!PyAbstractMethod.handle_signaturecCsd|_t�|�S)Nz	py:method)rzrrc)r#rrrrc�szPyAbstractMethod.run)rdrerfrqrcrxrr)rvrr��sr�c@s0eZdZdZdZdZdZiZdZdZ	dd�Z
dS)	�DeprecatedRemovedT�rGzKDeprecated since version {deprecated}, will be removed in version {removed}zCDeprecated since version {deprecated}, removed in version {removed}cCs.t��}|jj|_d|d<|jd|jdf}||d<|jjjj}tdd�|jj	�
d�D��}td	d�|jd�
d�D��}||kr�|j}n|j}t
d
�|�}|j|jd|jdd�}t|j�dk�r|j�|jd
|jd�\}}	tj|jd
df|�ddi�}
|�|
�ng}	|j�r2|j�|j|j|�t|��r�t|dtj��r�|dj�r�tj|djdd�}|dj|_|dj|_||dj7}|d�tjdd|dd��|d� dtjdd|dgd��n.tjddtjdd|dgd�dd�}
|�|
�|jjjj}|�!d|d||j�|g|	S)Nzdeprecated-removed�typerrG�versioncss|]}t|�VqdS)N)r.)�.0�errr�	<genexpr>sz(DeprecatedRemoved.run.<locals>.<genexpr>�.css|]}t|�VqdS)N)r.)r�r�rrrr�srI)�
deprecatedZremoved�r�rJrKFT)rKz%s: �versionmodified)rHz%s.r�)"rr�rR�documentrQ�settingsr�tupleZconfigr��split�_deprecated_label�_removed_labelr
rN�format�lenrSr7r	rUrTr:rVrWrYr[rZr\r+rXr]r^Znote_versionchange)r#r$r�rZcurrent_versionZremoved_versionr`r6ZinodesZmessagesZparar:rrrrc	sL


zDeprecatedRemoved.runN)rdrerfrgrhrirj�option_specr�r�rcrrrrr��sr�z(?:[Ii]ssue #|bpo-)([0-9]+)z(?:gh-issue-|gh-)([0-9]+)z(?im)^what's new in (.*?)\??$c@s(eZdZdZdZdZdZiZdd�ZdS)�MiscNewsFrGrc
	Cs�|jd}|jj�|j|jjd�}td�}|sBt�t�	|��}t�
||�}|jjj
j�|�y&tj|dd��}|��}WdQRXWn&tk
r�d}t�||�}|gSXt�d|�}t�d|�}t�d	|�}d
dg|��dd�}	|j�|	|�gS)
NrrGZPY_MISC_NEWS_DIRzutf-8)�encodingzThe NEWS file is not available.z:issue:`\1`z:gh:`\1`z\1z.. default-role:: objrJr�)rQZ
state_machineZinput_linesr\r7Zinput_offsetrr�dirname�abspath�joinrRr�r�Zrecord_dependencies�add�io�open�read�	Exceptionr	rP�issue_re�sub�gh_issue_re�whatsnew_re�
splitlinesZinsert_input)
r#Zfnamer\Z
source_dirZfpath�fpr:r6r$�linesrrrrcDs*
zMiscNews.runN)	rdrerfrgrhrirjr�rcrrrrr�=sr��assertZ
assignment�asynczatom-identifiersz
atom-literalszattribute-accesszattribute-referencesZ	augassign�awaitZbinaryZbitwisezbltin-code-objectszbltin-ellipsis-objectzbltin-null-objectzbltin-type-objectsZbooleans�breakzcallable-typesZcalls�classZcomparisonsrMzcontext-managers�continueZconversionsZ
customizationZdebugger�del�dictzdynamic-features�else�
exceptionsZ	execmodelZ	exprlistsZfloating�forZ
formatstringsZfunction�globalz
id-classesZidentifiers�ifZ	imaginary�import�inZintegers�lambdaZlistsZnaming�nonlocalZnumbersz
numeric-typesZobjectszoperator-summary�passZpower�raise�returnzsequence-typesZshiftingZslicingsZspecialattrsZspecialnameszstring-methodsZstringsZ
subscriptions�truth�try�typesZtypesfunctionsZtypesmappingZtypesmethodsZtypesmodulesZtypesseqztypesseq-mutableZunary�while�with�yieldc@s>eZdZdZeZdd�Zdd�Zd
dd�Zd	d
�Z	dd�Z
dS)�PydocTopicsBuilderzpydoc-topicscCsi|_i|_dS)N)�topicsZ
secnumbers)r#rrr�initxszPydocTopicsBuilder.initcCsdS)Nzall pydoc topicsr)r#rrr�get_outdated_docs|sz$PydocTopicsBuilder.get_outdated_docsNcCsdS)NrJr)r#�docnamer4rrr�get_target_urisz!PydocTopicsBuilder.get_target_uric
Gs�t|�}x�ttdtt�d�D]�}||jjddkrD|�d|�q|jjdd|\}}}|j�||�}td�}|�	|j
|�tdd�}	|�||	�|j
|j|<qWdS)	Nzbuilding topics... )�lengthZstd�labelszlabel %r not in documentationz<section node>zutf-8)r�)rr�pydoc_topic_labelsr�rZ
domaindata�warnZget_and_resolve_doctreerrTZidsr�write�outputr�)
r#Zignored�writerr`r�ZlabelidZsectnameZdoctreer�Zdestinationrrrr��s
zPydocTopicsBuilder.writecCsltt�|jd�d�}zH|�d�d��|�dt��d��|�dt|j�d�d��Wd|�	�XdS)Nz	topics.py�wbz# -*- coding: utf-8 -*-
zutf-8z # Autogenerated by Sphinx on %s
z	topics = �
)
r�rr�Zoutdirr��encoderrr��close)r#�frrr�finish�s"zPydocTopicsBuilder.finish)N)rdrerfrzrZdefault_translator_classr�r�r�r�r�rrrrr�ss
r�z(\w+(?:\+\d)?)(?:\s*\((.*)\))?cCsbt�|�}|dkrt�|��\}}|t�||�7}|dk	rZt��}||7}|t�||�7}|��S)z-Transform an opcode signature into RST nodes.N)	�
opcode_sig_re�match�
ValueError�groupsr�	desc_nameZdesc_parameterlistZdesc_parameter�strip)rrsrtrb�opnameZarglistZ	paramlistrrr�parse_opcode_signature�s
r�z([a-z()!]+)\s*(.*)cCsft�|�}|dkrt�|��\}}|�dd��dd�}|t�||�7}|rb|t�d|d|�7}|S)z1Transform a pdb command signature into RST nodes.N�(rJ�)rL)�
pdbcmd_sig_rer�r�r��replacerr�rr)rrsrtrbrz�args�fullnamerrr�parse_pdb_command�s
r�cCs|�dt�|�dt�|�dt�|�dt�|�dt�|�dt�|�t	�|�t
j�|�dddt
�|�d	d
dt�|�ddd
�|�ddt�|�ddt�|�ddt�|�ddt�|�ddt�|�ddt�|�ddt�|�dt�ddd�S)Nr;Zghr\zimpl-detailrlzdeprecated-removedZopcodez%s (opcode)Z
pdbcommandZpdbcmdz%s (pdb command)Z	2to3fixerz%s (2to3 fixer)�pyZ	decoratorZdecoratormethodZcoroutinefunctionZcoroutinemethodZawaitablefunctionZawaitablemethod�abstractmethodZmiscnewsz1.0T)r�Zparallel_read_safe)Zadd_roler?rArEZ
add_directiverFrkr�Zadd_builderr��
suspiciousZCheckSuspiciousMarkupBuilderZadd_object_typer�r�Zadd_directive_to_domainryr{rr�r�r�r�r�)Zapprrr�setup�s(
r�)S�__doc__�rer��osrrZtimerZpprintrZdocutils.iorZdocutils.parsers.rstrZdocutils.utilsrZdocutilsr	r
rIrZsphinx.buildersrZ
sphinx.localer
Zsphinx.utilrZsphinx.util.nodesrZsphinx.writers.htmlrZsphinx.writers.textrrZsphinx.writers.latexrZsphinx.domains.pythonrrr�r3r@rBZdocutils.parsers.rst.statesr�enumZ
convertersZvisit_literal_blockr"Zdepart_literal_blockr)r'r*r?rArErFrk�objectrnryr{r|r~rr�r�r�r�r��compile�Ir�r�r�r�r�r�r�r�r�r�r�rrrr�<module>
s�4
#
9
$


+