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__/c_annotations.cpython-34.pyo

�
e f��@s�dZddlmZddlmZddlmZddlmZddl	m
Z
Gdd�d�ZGd	d
�d
e�Z
dd�Zd
d�ZdS)a�
    c_annotations.py
    ~~~~~~~~~~~~~~~~

    Supports annotations for C API elements:

    * reference count annotations for C API functions.  Based on
      refcount.py and anno-api.py in the old Python documentation tools.

    * stable API annotations

    Usage: Set the `refcount_file` config value to the path to the reference
    count data file.

    :copyright: Copyright 2007-2014 by Georg Brandl.
    :license: Python license.
�)�path)�nodes)�
directives)�addnodes)�CObjectc@seZdZdd�ZdS)�RCEntrycCs(||_g|_d|_d|_dS)N�)�name�args�result_type�result_refs)�selfr	�r�G/opt/alt/python34/lib64/python3.4/Doc/tools/extensions/c_annotations.py�__init__s			zRCEntry.__init__N)�__name__�
__module__�__qualname__rrrrrrsrc@s.eZdZedd��Zdd�ZdS)�AnnotationscCsF|�}t|d�}zx|D]
}|j�}|dd�d
krPq"n|jdd�}t|�dkr�td|��n|\}}}}	}
y||}Wn&tk
r�t|�}||<YnX|	s�|	d	kr�d}	nt|	�}	|r|jj	|||	f�q"||_
|	|_q"WWd|j�X|S)N�r�r�#�:��zWrong field count in %rZnull)rr)
�open�strip�split�len�
ValueError�KeyErrorr�intr
�appendrr�close)�cls�filename�d�fp�line�parts�function�type�arg�refcountZcomment�entryrrr�fromfile%s0	

		zAnnotations.fromfilecCsjxc|jtj�D]O}|j}|ddkr8qn|drj|jdtjddddg��n|ddkr�qn|djd	�s|dd	r�qn|dd	d}|jd
�r�|dd�}n|j	|�}|s�qn|j
dkr
qn|jdkr%d}n|jr7d}nd}|jdtj||ddg��qWdS)NZdomain�c�	stableabirz Part of the stable ABI.ZclassesZobjtyper*�nameszc.��	PyObject*�PyVarObject*zReturn value: Always NULL.zReturn value: New reference.z!Return value: Borrowed reference.r-)r4r5)ZtraverserZdesc_content�parent�insertrZemphasisZhas_key�
startswith�getrr)r
�appZdoctreeZnodeZparr	r.�rcrrr�add_annotationsGs4	
#			zAnnotations.add_annotationsN)rrr�classmethodr/r<rrrrr$s"rcCs;tjtj|j|jj��}|jd|j�dS)Nzdoctree-read)	rr/r�join�srcdir�config�
refcount_file�connectr<)r:Z	refcountsrrr�init_annotationsesrCcsv|jddd�|jdt�itjd6tjd6t_tj��fdd�}|t_id	d
6dd6S)NrArTzbuilder-initedZnoindexr1cs&d|jk|jd<�|||�S)Nr1)Zoptionsr6)r
ZsigZsignode)�old_handle_signaturerr�new_handle_signatureusz#setup.<locals>.new_handle_signaturez1.0�versionZparallel_read_safe)Zadd_config_valuerBrCrZflagrZoption_specZhandle_signature)r:rEr)rDr�setupks
		rGN)�__doc__�osrZdocutilsrZdocutils.parsers.rstrZsphinxrZsphinx.domains.crr�dictrrCrGrrrr�<module>sA