Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/Doc/tools/extensions/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/Doc/tools/extensions/__pycache__/pyspecific.cpython-34.pyc

�
e f�4�M@sdZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZdd	lmZmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZm Z ddl!Z!dZ"dZ#ddl$m%Z%dd�e%j&j'd<e%j&j'd<e%j&j'd<e%j&j'd<ej(Z)ej*Z+dd�Z,dd�Z-e,e_(e-e_*igdd�Z.igd d!�Z/Gd"d#�d#e�Z0Gd$d%�d%e1�Z2Gd&d'�d'e2e�Z3Gd(d)�d)e2e �Z4Gd*d+�d+e1�Z5Gd,d-�d-e5e�Z6Gd.d/�d/e5e �Z7Gd0d1�d1e�Z8ej9d2�Z:ej9d3�Z;Gd4d5�d5e�Z<d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd�d�d�gMZ=Gd�d��d�e�Z>ej9d��Z?d�d��Z@ej9d��ZAd�d��ZBd�d��ZCdS)�z�
    pyspecific.py
    ~~~~~~~~~~~~~

    Sphinx extension with Python doc-specific markup.

    :copyright: 2008-2014 by Georg Brandl.
    :license: Python license.
�N)�path)�asctime)�pformat)�StringOutput)�	Directive)�new_document)�nodes�utils)�addnodes)�Builder)�split_explicit_title)�HTMLTranslator)�
TextWriter)�LaTeXTranslator)�
PyModulelevel�
PyClassmemberzhttps://bugs.python.org/issue%sz-https://github.com/python/cpython/tree/3.4/%s)�BodycCsdS)N�)�xrr�D/opt/alt/python34/lib64/python3.4/Doc/tools/extensions/pyspecific.py�<lambda>,srZ
loweralphaZ
upperalphaZ
lowerromanZ
upperromancCse|jjj|jj}|jj}d|kr@d|j_nzt||�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_block4sr"cCsf|jjj|jd}|jj}d|krAd|j_nzt||�Wd||j_XdS)N�rF���)rrrZcurfilestackrr�orig_depart_literal_block)rrr r!rrr�new_depart_literal_block?sr&c	CsBtj|�}d|}tj||dt|�}|ggfS)Nzissue �refuri)r	�unescaper�	reference�	ISSUE_URI)	�typ�rawtext�text�lineno�inliner�options�content�issue�refnoderrr�
issue_rolePs
r4cCs\t|�\}}}	tj|�}tj|	�}	tj||dt|	�}
|
ggfS)Nr')rr	r(rr)�
SOURCE_URI)r+r,r-r.r/r0r1Zhas_t�title�targetr3rrr�source_roleYs
r8c@s4eZdZdZdZdZdZdd�ZdS)�ImplementationDetailTrr#cCstjddg�}|j}tjdd�}|jr�|jj|jd|j�\}}|jtj	dd||��n|jj
||j|�|jr�t
|dtj	�r�|djd|�|djdtjd��n|jdtj	dd|��|gS)N�classeszimpl-detailzCPython implementation detail:r�r#� )r�compoundr1�strong�	arguments�state�inline_textr.�append�	paragraph�nested_parse�content_offset�children�
isinstance�insertZText)rZpnoder1Zadd_text�n�mrrr�runjs				%# zImplementationDetail.runN)�__name__�
__module__�__qualname__�has_content�required_arguments�optional_arguments�final_argument_whitespacerKrrrrr9cs
r9cs.eZdZ�fdd�Zdd�Z�S)�PyDecoratorMixincs;tt|�j||�}|jdtjdd��|S)Nr�@)�superrS�handle_signaturerHr
�desc_addname)r�sig�signode�ret)�	__class__rrrV~sz!PyDecoratorMixin.handle_signaturecCsdS)NFr)rrrr�
needs_arglist�szPyDecoratorMixin.needs_arglist)rLrMrNrVr\rr)r[rrS}srSc@seZdZdd�ZdS)�PyDecoratorFunctioncCsd|_tj|�S)Nzpy:function)�namerrK)rrrrrK�s	zPyDecoratorFunction.runN)rLrMrNrKrrrrr]�sr]c@seZdZdd�ZdS)�PyDecoratorMethodcCsd|_tj|�S)Nz	py:method)r^rrK)rrrrrK�s	zPyDecoratorMethod.runN)rLrMrNrKrrrrr_�sr_cs"eZdZ�fdd�Z�S)�PyCoroutineMixincs;tt|�j||�}|jdtjdd��|S)Nrz
coroutine )rUr`rVrHr
Zdesc_annotation)rrXrYrZ)r[rrrV�sz!PyCoroutineMixin.handle_signature)rLrMrNrVrr)r[rr`�sr`c@seZdZdd�ZdS)�PyCoroutineFunctioncCsd|_tj|�S)Nzpy:function)r^rrK)rrrrrK�s	zPyCoroutineFunction.runN)rLrMrNrKrrrrra�srac@seZdZdd�ZdS)�PyCoroutineMethodcCsd|_tj|�S)Nz	py:method)r^rrK)rrrrrK�s	zPyCoroutineMethod.runN)rLrMrNrKrrrrrb�srbc@s@eZdZdZdZdZdZiZdZdd�Z	dS)�DeprecatedRemovedT�r#z:Deprecated since version %s, will be removed in version %sc	Cs2tj�}|jj|_d|d<|jd|jdf}||d<|j|}t|j�dkr�|jj|jd|jd�\}}t	j
|jdd|�}|j|�ng}|jr�|jj
|j|j|�nt|�r�t|dt	j
�r�|djr�t	j|djd	d
�}|dj|_|dj|_||dj7}|djt	j
dd|��n|djdt	jdd|dd
g��n;t	j
ddt	jdd|dd
g��}|j|�|jjjj}|jd|d||j�|g|S)Nzdeprecated-removed�typerr#�version�rdr;ZtranslatableTz%s: r:�versionmodifiedz%s.Z
deprecated)r
rhr@�documentr?�_label�lenrAr.rrCrBr1rDrErGZ	rawsourceZinline�source�linerFZreplace_selfrH�settingsrZnote_versionchange)	rrrfr-ZinodesZmessagesZparar1rrrrrK�s<


	## 
zDeprecatedRemoved.runN)
rLrMrNrOrPrQrR�option_specrjrKrrrrrc�srcz([Ii])ssue #([0-9]+)z(?im)^what's new in (.*?)\??$c@s:eZdZdZdZdZdZiZdd�ZdS)�MiscNewsFr#rc
Cs<|jd}|jjj|j|jjd�}tjtj|��}tj	||�}|j
jjj
j|�y7tj|dd�}z|j�}Wd|j�XWn1tk
r�d}tj||�}|gSYnXtjd|�}tjd|�}dd	g|j�d
d�}	|jj|	|�gS)Nrr#�encodingzutf-8zThe NEWS file is not available.z+`\1ssue #\2 <https://bugs.python.org/\2>`__z\1z.. default-role:: objr;rg)r?Z
state_machineZinput_linesrlr.Zinput_offsetr�dirname�abspath�joinr@rirnZrecord_dependencies�add�codecs�open�read�close�	Exceptionrr>�issue_re�sub�whatsnew_re�
splitlinesZinsert_input)
rZfnamerlZ
source_dirZfpath�fpr1r-r�linesrrrrK�s*

		 zMiscNews.runN)	rLrMrNrOrPrQrRrorKrrrrrp�srp�assertZ
assignmentzatom-identifiersz
atom-literalszattribute-accesszattribute-referencesZ	augassignZbinaryZbitwisezbltin-code-objectszbltin-ellipsis-objectzbltin-null-objectzbltin-type-objectsZbooleans�breakzcallable-typesZcalls�classZcomparisonsr=zcontext-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@sUeZdZdZdd�Zdd�Zddd�Zd	d
�Zdd�ZdS)
�PydocTopicsBuilderzpydoc-topicscCs
i|_dS)N)�topics)rrrr�initszPydocTopicsBuilder.initcCsdS)Nzall pydoc topicsr)rrrr�get_outdated_docssz$PydocTopicsBuilder.get_outdated_docsNcCsdS)Nr;r)r�docnamer+rrr�get_target_urisz!PydocTopicsBuilder.get_target_uric
Gs�t|�}x�|jtddtt��D]�}||jjddkrb|jd|�q+n|jjdd|\}}}|jj||�}td�}|j	|j
|�tdd�}	|j||	�|j
|j|<q+WdS)	Nzbuilding topics... ZlengthZstdZlabelszlabel %r not in documentationz<section node>rqzutf-8)rZstatus_iterator�pydoc_topic_labelsrkrZ
domaindata�warnZget_and_resolve_doctreerrBZidsr�write�outputr�)
rZignored�writerZlabelr�ZlabelidZsectnameZdoctreeriZdestinationrrrr�s!zPydocTopicsBuilder.writec
Cs�ttj|jd�d�}z^|jdjd��|jdt�jd��|jdt|j�djd��Wd|j	�XdS)Nz	topics.py�wbz# -*- coding: utf-8 -*-
zutf-8z # Autogenerated by Sphinx on %s
z	topics = �
)
rwrrtZoutdirr��encoderrr�ry)r�frrr�finish-s+zPydocTopicsBuilder.finish)	rLrMrNr^r�r�r�r�r�rrrrr�sr�z(\w+(?:\+\d)?)(?:\s*\((.*)\))?cCs�tj|�}|dkr$t�n|j�\}}|tj||�7}|dk	r�tj�}||7}|tj||�7}n|j�S)z-Transform an opcode signature into RST nodes.N)	�
opcode_sig_re�match�
ValueError�groupsr
�	desc_nameZdesc_parameterlistZdesc_parameter�strip)rrXrYrJ�opnameZarglistZ	paramlistrrr�parse_opcode_signature<s	
r�z([a-z()!]+)\s*(.*)cCs�tj|�}|dkr$t�n|j�\}}|jdd�jdd�}|tj||�7}|r�|tjd|d|�7}n|S)z1Transform a pdb command signature into RST nodes.N�(r;�)r<)�
pdbcmd_sig_rer�r�r��replacer
r�rW)rrXrYrJr^�args�fullnamerrr�parse_pdb_commandVs	!r�cCs
|jdt�|jdt�|jdt�|jdt�|jt�|jtj	�|j
dddt�|j
ddd	t�|j
d
d
d�|j
dd
t�|j
ddt�|j
ddt�|j
ddt�|jdt�idd6dd6S)Nr2rlzimpl-detailzdeprecated-removedZopcodez%s (opcode)Z
pdbcommandZpdbcmdz%s (pdb command)Z	2to3fixerz%s (2to3 fixer)�pyZ	decoratorZdecoratormethodZcoroutinefunctionZcoroutinemethodZmiscnewsz1.0rfTZparallel_read_safe)Zadd_roler4r8Z
add_directiver9rcZadd_builderr��
suspiciousZCheckSuspiciousMarkupBuilderZadd_description_unitr�r�Zadd_directive_to_domainr]r_rarbrp)Zapprrr�setupcs"
r�)D�__doc__�rerv�osrZtimer�pprintrZdocutils.iorZdocutils.parsers.rstrZdocutils.utilsrZdocutilsrr	Zsphinxr
Zsphinx.buildersrZsphinx.util.nodesrZsphinx.writers.htmlr
Zsphinx.writers.textrZsphinx.writers.latexrZsphinx.domains.pythonrrr�r*r5Zdocutils.parsers.rst.statesrZenumZ
convertersZvisit_literal_blockrZdepart_literal_blockr%r"r&r4r8r9�objectrSr]r_r`rarbrc�compiler{r}rpr�r�r�r�r�r�r�rrrr�<module>
sz@					

.$		(