ok

Mini Shell

Direktori : /proc/self/root/proc/thread-self/root/proc/self/root/usr/lib64/python2.7/Demo/parser/
Upload File :
Current File : //proc/self/root/proc/thread-self/root/proc/self/root/usr/lib64/python2.7/Demo/parser/example.pyo

�
V
�Qc@s�dZddlZddlZddlZddlZddlZddlmZmZd�Zddd��YZ	ddd��YZ
d	e	e
fd
��YZde	fd��YZd
e	e
fd��YZ
dd�ZejejdgffZejejejejejejejejejejejejejejej ej!ej"ej#ej$dgfffffffffffffffffej%dfffZ&dS(s�Simple code to extract class & function docstrings from a module.

This code is used as an example in the library reference manual in the
section on using the parser module.  Refer to the manual for a thorough
discussion of the operation of this code.
i����N(tListTypet	TupleTypecCsVt|�j�}tjjtjj|�d�}tj|�}t|j	�|�S(s�Retrieve information from the parse tree of a source file.

    fileName
        Name of the file to read Python source code from.
    i(
topentreadtostpathtbasenametsplitexttparsertsuitet
ModuleInfottotuple(tfileNametsourceRtast((s+/usr/lib64/python2.7/Demo/parser/example.pytget_docss"t
SuiteInfoBasecBsVeZdZdZdd�Zd�Zd�Zd�Zd�Z	d�Z
d�ZRS(	tcCs,i|_i|_|r(|j|�ndS(N(t_class_infot_function_infot
_extract_info(tselfttree((s+/usr/lib64/python2.7/Demo/parser/example.pyt__init__!s		cCst|�dkr2ttd|d�\}}ntt|d�\}}|rgt|d�|_nx�|dD]�}tt|�\}}|rr|d}|dtjkr�|dd}t|�|j	|<q|dtj
kr|dd}t|�|j|<qqrqrWdS(Niiit	docstringtcompoundi(
tlentmatchtDOCSTRING_STMT_PATTERNtevalt
_docstringtCOMPOUND_STMT_PATTERNtsymboltfuncdeftFunctionInfoRtclassdeft	ClassInfoR(RRtfoundtvarstnodetcstmttname((s+/usr/lib64/python2.7/Demo/parser/example.pyR's 
cCs|jS(N(R(R((s+/usr/lib64/python2.7/Demo/parser/example.pyt
get_docstring;scCs|jS(N(t_name(R((s+/usr/lib64/python2.7/Demo/parser/example.pytget_name>scCs
|jj�S(N(Rtkeys(R((s+/usr/lib64/python2.7/Demo/parser/example.pytget_class_namesAscCs|j|S(N(R(RR)((s+/usr/lib64/python2.7/Demo/parser/example.pytget_class_infoDscCs/y|j|SWntk
r*|j|SXdS(N(RtKeyErrorR(RR)((s+/usr/lib64/python2.7/Demo/parser/example.pyt__getitem__Gs
N(t__name__t
__module__RR+tNoneRRR*R,R.R/R1(((s+/usr/lib64/python2.7/Demo/parser/example.pyRs					t
SuiteFuncInfocBseZd�Zd�ZRS(cCs
|jj�S(N(RR-(R((s+/usr/lib64/python2.7/Demo/parser/example.pytget_function_namesQscCs|j|S(N(R(RR)((s+/usr/lib64/python2.7/Demo/parser/example.pytget_function_infoTs(R2R3R6R7(((s+/usr/lib64/python2.7/Demo/parser/example.pyR5Ns	R"cBseZdd�ZRS(cCs5|dd|_tj||r*|dp-d�dS(Niii����(R+RRR4(RR((s+/usr/lib64/python2.7/Demo/parser/example.pyRYsN(R2R3R4R(((s+/usr/lib64/python2.7/Demo/parser/example.pyR"XsR$cBs&eZdd�Zd�Zd�ZRS(cCs5|dd|_tj||r*|dp-d�dS(Niii����(R+RRR4(RR((s+/usr/lib64/python2.7/Demo/parser/example.pyR_scCs
|jj�S(N(RR-(R((s+/usr/lib64/python2.7/Demo/parser/example.pytget_method_namescscCs|j|S(N(R(RR)((s+/usr/lib64/python2.7/Demo/parser/example.pytget_method_infofsN(R2R3R4RR8R9(((s+/usr/lib64/python2.7/Demo/parser/example.pyR$^s	R
cBseZddd�ZRS(s<string>cCsU||_tj||�|rQtt|d�\}}|rQ|d|_qQndS(NiR(R+RRRRR(RRR)R%R&((s+/usr/lib64/python2.7/Demo/parser/example.pyRks	N(R2R3R4R(((s+/usr/lib64/python2.7/Demo/parser/example.pyR
jscCs�|dkri}nt|�tkr?|||d<d|fSt|�tk	ra||k|fSt|�t|�kr�d|fSxBtd||�D].\}}t|||�\}}|s�Pq�q�W||fS(saMatch `data' to `pattern', with variable extraction.

    pattern
        Pattern to match against, possibly containing variables.

    data
        Data to be checked and against which variables are extracted.

    vars
        Dictionary of variables which have already been found.  If not
        provided, an empty dictionary is created.

    The `pattern' value may contain variables of the form ['varname'] which
    are allowed to match anything.  The value that is matched is returned as
    part of a dictionary which maps 'varname' to the matched value.  'varname'
    is not required to be a string object, but using strings makes patterns
    and the code which uses them more readable.

    This function returns two values: a boolean indicating whether a match
    was found and a dictionary mapping variable names to their associated
    values.
    iiN(R4ttypeRRRtmapR(tpatterntdataR&tsame((s+/usr/lib64/python2.7/Demo/parser/example.pyRts	

RRR((('t__doc__RRR ttokenttypesRRRRR5R"R$R
R4Rtstmtt
compound_stmtRtsimple_stmtt
small_stmtt	expr_stmtttestlistttesttand_testtnot_testt
comparisontexprtxor_exprtand_exprt
shift_exprt
arith_exprttermtfactortpowertatomtSTRINGtNEWLINER(((s+/usr/lib64/python2.7/Demo/parser/example.pyt<module>sF	1

+	?

Zerion Mini Shell 1.0