AlkantarClanX12

Your IP : 18.222.164.176


Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/symtable.cpython-35.pyc



��Yf�@s�dZddlZddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZddlZdddddgZd	d�ZGd
d�d�Ze�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�Zedkr�ddlZddlZeejd��Zej�Z WdQRXee ej!j"ejd�dd�Z#x?e#j$�D]1Z%e#j&e%�Z'e(e'e'j)�e'j*��q�WdS)z2Interface to the compiler's internal symbol tables�N)
�USE�
DEF_GLOBAL�	DEF_LOCAL�	DEF_PARAM�
DEF_IMPORT�	DEF_BOUND�	SCOPE_OFF�
SCOPE_MASK�FREE�LOCAL�GLOBAL_IMPLICIT�GLOBAL_EXPLICIT�CELL�symtable�SymbolTable�Class�Function�SymbolcCs"tj|||�}t||�S)N)�	_symtabler�_newSymbolTable)�code�filenameZcompile_type�top�r�-/opt/alt/python35/lib64/python3.5/symtable.pyrsc@s4eZdZdd�Zdd�Zdd�ZdS)�SymbolTableFactorycCstj�|_dS)N)�weakref�WeakValueDictionary�_SymbolTableFactory__memo)�selfrrr�__init__szSymbolTableFactory.__init__cCsK|jtjkrt||�S|jtjkr>t||�St||�S)N)�typer�
TYPE_FUNCTIONr�
TYPE_CLASSrr)r�tablerrrr�news


zSymbolTableFactory.newcCsN||f}|jj|d�}|dkrJ|j||�}|j|<|S)N)r�getr%)rr$r�key�objrrr�__call__s
zSymbolTableFactory.__call__N)�__name__�
__module__�__qualname__r r%r)rrrrrsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS) rcCs||_||_i|_dS)N)�_table�	_filename�_symbols)rZ	raw_tablerrrrr 's		zSymbolTable.__init__cCsm|jtkrd}nd|jj}|jjdkrMdj||j�Sdj||jj|j�SdS)N�z%s �globalz<{0}SymbolTable for module {1}>z<{0}SymbolTable for {1} in {2}>)�	__class__rr*r-�name�formatr.)rZkindrrr�__repr__,s			zSymbolTable.__repr__cCs||jjtjkrdS|jjtjkr2dS|jjtjkrKdS|jjdksxtdj|jj���dS)	N�moduleZfunction�class���zunexpected type: {0})r8r9r:)r-r!rZTYPE_MODULEr"r#�AssertionErrorr4)rrrr�get_type9szSymbolTable.get_typecCs
|jjS)N)r-�id)rrrr�get_idCszSymbolTable.get_idcCs
|jjS)N)r-r3)rrrr�get_nameFszSymbolTable.get_namecCs
|jjS)N)r-�lineno)rrrr�
get_linenoIszSymbolTable.get_linenocCst|jjtjk�S)N)�boolr-r!rr")rrrr�is_optimizedLszSymbolTable.is_optimizedcCst|jj�S)N)rBr-�nested)rrrr�	is_nestedOszSymbolTable.is_nestedcCst|jj�S)N)rBr-�children)rrrr�has_childrenRszSymbolTable.has_childrencCsdS)z7Return true if the scope uses exec.  Deprecated method.Fr)rrrr�has_execUszSymbolTable.has_execcCs|jjj�S)N)r-�symbols�keys)rrrr�get_identifiersYszSymbolTable.get_identifierscCs^|jj|�}|dkrZ|jj|}|j|�}t|||�}|j|<|S)N)r/r&r-rI�_SymbolTable__check_childrenr)rr3Zsym�flags�
namespacesrrr�lookup\szSymbolTable.lookupcs�fdd��j�D�S)Ncsg|]}�j|��qSr)rO)�.0�ident)rrr�
<listcomp>es	z+SymbolTable.get_symbols.<locals>.<listcomp>)rK)rr)rr�get_symbolsdszSymbolTable.get_symbolscs ��fdd��jjD�S)Ncs1g|]'}|j�krt|�j��qSr)r3rr.)rP�st)r3rrrrRhs	z0SymbolTable.__check_children.<locals>.<listcomp>)r-rF)rr3r)r3rrZ__check_childrengszSymbolTable.__check_childrencs�fdd��jjD�S)Ncs"g|]}t|�j��qSr)rr.)rPrT)rrrrRms	z,SymbolTable.get_children.<locals>.<listcomp>)r-rF)rr)rr�get_childrenlszSymbolTable.get_childrenN)r*r+r,r r5r<r>r?rArCrErGrHrKrOrSrLrUrrrrr%s

c@sdeZdZdZdZdZdZdd�Zdd�Zdd�Z	dd	�Z
d
d�ZdS)rNcs&t��fdd��j�D��S)Ncs,g|]"}��jj|�r|�qSr)r-rI)rPrQ)r�	test_funcrrrRzs	z.Function.__idents_matching.<locals>.<listcomp>)�tuplerK)rrVr)rrVrZ__idents_matchingyszFunction.__idents_matchingcCs.|jdkr'|jdd��|_|jS)NcSs|t@S)N)r)�xrrr�<lambda>sz)Function.get_parameters.<locals>.<lambda>)�_Function__params�_Function__idents_matching)rrrr�get_parameters}szFunction.get_parameterscsF|jdkr?ttf��fdd�}|j|�|_|jS)Ncs|t?t@�kS)N)rr	)rX)�locsrrrY�sz%Function.get_locals.<locals>.<lambda>)�_Function__localsrrr[)r�testr)r]r�
get_locals�s
zFunction.get_localscsF|jdkr?ttf��fdd�}|j|�|_|jS)Ncs|t?t@�kS)N)rr	)rX)�globrrrY�sz&Function.get_globals.<locals>.<lambda>)�_Function__globalsrr
r[)rr_r)rar�get_globals�s
zFunction.get_globalscCs4|jdkr-dd�}|j|�|_|jS)NcSs|t?t@tkS)N)rr	r
)rXrrrrY�sz$Function.get_frees.<locals>.<lambda>)�_Function__freesr[)r�is_freerrr�	get_frees�szFunction.get_frees)r*r+r,rZr^rdrbr[r\r`rcrfrrrrrqsc@s"eZdZdZdd�ZdS)rNcCsO|jdkrHi}x!|jjD]}d||j<q"Wt|�|_|jS)Nr8)�_Class__methodsr-rFr3rW)r�drTrrr�get_methods�szClass.get_methods)r*r+r,rgrirrrrr�sc@s�eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)rNcCs6||_||_|t?t@|_|p,f|_dS)N)�
_Symbol__name�_Symbol__flagsrr	�_Symbol__scope�_Symbol__namespaces)rr3rMrNrrrr �s		zSymbol.__init__cCsdj|j�S)Nz<symbol {0!r}>)r4rj)rrrrr5�szSymbol.__repr__cCs|jS)N)rj)rrrrr?�szSymbol.get_namecCst|jtj@�S)N)rBrkrr)rrrr�
is_referenced�szSymbol.is_referencedcCst|jt@�S)N)rBrkr)rrrr�is_parameter�szSymbol.is_parametercCst|jttfk�S)N)rBrlrr
)rrrr�	is_global�szSymbol.is_globalcCst|jtk�S)N)rBrlr
)rrrr�is_declared_global�szSymbol.is_declared_globalcCst|jt@�S)N)rBrkr)rrrr�is_local�szSymbol.is_localcCst|jtk�S)N)rBrlr
)rrrrre�szSymbol.is_freecCst|jt@�S)N)rBrkr)rrrr�is_imported�szSymbol.is_importedcCst|jt@�S)N)rBrkr)rrrr�is_assigned�szSymbol.is_assignedcCs
t|j�S)a�Returns true if name binding introduces new namespace.

        If the name is used as the target of a function or class
        statement, this will be true.

        Note that a single name can be bound to multiple objects.  If
        is_namespace() is true, the name may also be bound to other
        objects, like an int or list, that does not introduce a new
        namespace.
        )rBrm)rrrr�is_namespace�szSymbol.is_namespacecCs|jS)z.Return a list of namespaces bound to this name)rm)rrrr�get_namespaces�szSymbol.get_namespacescCs,t|j�dkr!td��|jdS)z�Returns the single namespace bound to this name.

        Raises ValueError if the name is bound to multiple namespaces.
        r8z$name is bound to multiple namespacesr)�lenrm�
ValueError)rrrr�
get_namespace�szSymbol.get_namespace)r*r+r,r r5r?rnrorprqrrrersrtrurvryrrrrr�s
�__main__r8�exec)+�__doc__rrrrrrrrr	r
rrr
rr�__all__rrr�objectrrrrr*�os�sys�open�argv�f�read�src�path�split�modrKrQrO�info�printrrrurrrr�<module>s&X	L&
@)