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__/c_annotations.cpython-37.pyc

B

� f��@srdZddlmZddlmZddlmZddlmZddl	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/python37/lib64/python3.7/Doc/tools/extensions/c_annotations.py�__init__szRCEntry.__init__N)�__name__�
__module__�__qualname__rrrrrrsrc@s eZdZedd��Zdd�ZdS)�Annotationsc	Cs�|�}t|d�}z�x�|D]�}|��}|dd�dkr6q|�dd�}t|�dkrZtd|��|\}}}}	}
y||}Wn$tk
r�t|�}||<YnX|	r�|	dkr�d}	nt|	�}	|r�|j�	|||	f�q||_
|	|_qWWd|��X|S)	N�r�)r�#�:��zWrong field count in %rZnull)
�open�strip�split�len�
ValueError�KeyErrorr�intr
�appendrr�close)�cls�filename�d�fp�line�parts�function�type�arg�refcount�comment�entryrrr�fromfile%s0


zAnnotations.fromfilec	Cs�x�|�tj�D]�}|j}|ddkr&q|drH|�dtjdddgd��|ddkrVq|d�d	�r|dd	srq|dd	d}|�d
�r�|dd�}|�	|�}|s�qn|j
�d�s�q|jdkr�d
}n|jr�d}nd}|�dtj||dgd��qWdS)NZdomain�c�	stableabirz Part of the stable ABI.)�classesZobjtyper*�nameszc.�zObject*zReturn value: Always NULL.zReturn value: New reference.z!Return value: Borrowed reference.r-)
ZtraverserZdesc_content�parent�insertrZemphasisZhas_key�
startswith�getr�endswithr)r
�appZdoctreeZnodeZparr	r/Zrcrrr�add_annotationsGs4


zAnnotations.add_annotationsN)rrr�classmethodr0r<rrrrr$s"rcCs*t�t�|j|jj��}|�d|j�dS)Nzdoctree-read)	rr0r�joinZsrcdirZconfig�
refcount_file�connectr<)r;Z	refcountsrrr�init_annotationsesrAcsL|�ddd�|�dt�tjtjd�t_tj��fdd�}|t_ddd	�S)
Nr?rTzbuilder-inited)Znoindexr2csd|jk|jd<�|||�S)Nr2)Zoptionsr6)r
ZsigZsignode)�old_handle_signaturerr�new_handle_signatureusz#setup.<locals>.new_handle_signaturez1.0)�versionZparallel_read_safe)Zadd_config_valuer@rAr�flagrZoption_specZhandle_signature)r;rCr)rBr�setupksrFN)�__doc__�osrZdocutilsrZdocutils.parsers.rstrZsphinxrZsphinx.domains.crr�dictrrArFrrrr�<module>sA