AlkantarClanX12

Your IP : 18.219.207.115


Current Path : /proc/thread-self/root/opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python37/lib64/python3.7/__pycache__/symtable.cpython-37.pyc

B

� fo�	@sNdZddlZddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZddlZdddddgZd	d�ZGd
d�d�Ze�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�Zedk�rJddlZddlZeejd��Ze� �Z!WdQRXee!ej"�#ejd�dd�Z$x0e$�%�D]$Z&e$�'e&�Z(e)e(e(�*�e(�+���q"WdS)z2Interface to the compiler's internal symbol tables�N)�USE�
DEF_GLOBAL�	DEF_LOCAL�	DEF_PARAM�
DEF_IMPORT�	DEF_BOUND�	DEF_ANNOT�	SCOPE_OFF�
SCOPE_MASK�FREE�LOCAL�GLOBAL_IMPLICIT�GLOBAL_EXPLICIT�CELL�symtable�SymbolTable�Class�Function�SymbolcCst�|||�}t||�S)N)�	_symtabler�_newSymbolTable)�code�filenameZcompile_type�top�r�-/opt/alt/python37/lib64/python3.7/symtable.pyrsc@s$eZdZdd�Zdd�Zdd�ZdS)�SymbolTableFactorycCst��|_dS)N)�weakrefZWeakValueDictionary�_SymbolTableFactory__memo)�selfrrr�__init__szSymbolTableFactory.__init__cCs6|jtjkrt||�S|jtjkr,t||�St||�S)N)�typer�
TYPE_FUNCTIONr�
TYPE_CLASSrr)r�tablerrrr�news


zSymbolTableFactory.newcCs8||f}|j�|d�}|dkr4|�||�}|j|<|S)N)r�getr%)rr$r�key�objrrr�__call__s
zSymbolTableFactory.__call__N)�__name__�
__module__�__qualname__r r%r)rrrrrsrc@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 'szSymbolTable.__init__cCsN|jtkrd}nd|jj}|jjdkr6d�||j�Sd�||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__cCsX|jjtjkrdS|jjtjkr$dS|jjtjkr6dS|jjdksTtd�|jj���dS)N�moduleZfunction�class)���zunexpected type: {0})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_optimizedcCst|jj�S)N)rBr-�nested)rrrr�	is_nestedOszSymbolTable.is_nestedcCst|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|jj��S)N)r-�symbols�keys)rrrr�get_identifiersYszSymbolTable.get_identifierscCsD|j�|�}|dkr@|jj|}|�|�}t|||�}|j|<|S)N)r/r&r-rI�_SymbolTable__check_childrenr)rr3Zsym�flags�
namespacesrrr�lookup\s
zSymbolTable.lookupcs�fdd����D�S)Ncsg|]}��|��qSr)rO)�.0�ident)rrr�
<listcomp>esz+SymbolTable.get_symbols.<locals>.<listcomp>)rK)rr)rr�get_symbolsdszSymbolTable.get_symbolscs��fdd��jjD�S)Ncs"g|]}|j�krt|�j��qSr)r3rr.)rP�st)r3rrrrRhsz0SymbolTable.__check_children.<locals>.<listcomp>)r-rF)rr3r)r3rrZ__check_childrengszSymbolTable.__check_childrencs�fdd��jjD�S)Ncsg|]}t|�j��qSr)rr.)rPrT)rrrrRmsz,SymbolTable.get_children.<locals>.<listcomp>)r-rF)rr)rr�get_childrenls
zSymbolTable.get_childrenN)r*r+r,r r5r<r>r?rArCrErGrHrKrOrSrLrUrrrrr%s

c@sDeZdZdZdZdZdZdd�Zdd�Zdd�Z	dd	�Z
d
d�ZdS)rNcst��fdd����D��S)Nc3s"|]}��jj|�r|VqdS)N)r-rI)rPrQ)r�	test_funcrr�	<genexpr>zsz-Function.__idents_matching.<locals>.<genexpr>)�tuplerK)rrVr)rrVrZ__idents_matchingyszFunction.__idents_matchingcCs |jdkr|�dd��|_|jS)NcSs|t@S)N)r)�xrrr�<lambda>�z)Function.get_parameters.<locals>.<lambda>)�_Function__params�_Function__idents_matching)rrrr�get_parameters}s
zFunction.get_parameterscs0|jdkr*ttf��fdd�}|�|�|_|jS)Ncs|t?t@�kS)N)r	r
)rY)�locsrrrZ�r[z%Function.get_locals.<locals>.<lambda>)�_Function__localsrrr])r�testr)r_r�
get_locals�s

zFunction.get_localscs0|jdkr*ttf��fdd�}|�|�|_|jS)Ncs|t?t@�kS)N)r	r
)rY)�globrrrZ�r[z&Function.get_globals.<locals>.<lambda>)�_Function__globalsr
rr])rrar)rcr�get_globals�s

zFunction.get_globalscCs$|jdkrdd�}|�|�|_|jS)NcSs|t?t@tkS)N)r	r
r)rYrrrrZ�r[z$Function.get_frees.<locals>.<lambda>)�_Function__freesr])r�is_freerrr�	get_frees�s
zFunction.get_frees)r*r+r,r\r`rfrdr]r^rbrerhrrrrrqsc@seZdZdZdd�ZdS)rNcCs:|jdkr4i}x|jjD]}d||j<qWt|�|_|jS)Nr8)�_Class__methodsr-rFr3rX)r�drTrrr�get_methods�s

zClass.get_methods)r*r+r,rirkrrrrr�sc@s�eZdZd dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)!rNcCs(||_||_|t?t@|_|p d|_dS)Nr)�
_Symbol__name�_Symbol__flagsr	r
�_Symbol__scope�_Symbol__namespaces)rr3rMrNrrrr �szSymbol.__init__cCsd�|j�S)Nz<symbol {0!r}>)r4rl)rrrrr5�szSymbol.__repr__cCs|jS)N)rl)rrrrr?�szSymbol.get_namecCst|jtj@�S)N)rBrmrr)rrrr�
is_referenced�szSymbol.is_referencedcCst|jt@�S)N)rBrmr)rrrr�is_parameter�szSymbol.is_parametercCst|jttfk�S)N)rBrnr
r)rrrr�	is_global�szSymbol.is_globalcCst|jtk�S)N)rBrnr)rrrr�is_declared_global�szSymbol.is_declared_globalcCst|jttfk�S)N)rBrnrr)rrrr�is_local�szSymbol.is_localcCst|jt@�S)N)rBrmr)rrrr�is_annotated�szSymbol.is_annotatedcCst|jtk�S)N)rBrnr)rrrrrg�szSymbol.is_freecCst|jt@�S)N)rBrmr)rrrr�is_imported�szSymbol.is_importedcCst|jt@�S)N)rBrmr)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.
        )rBro)rrrr�is_namespace�szSymbol.is_namespacecCs|jS)z.Return a list of namespaces bound to this name)ro)rrrr�get_namespaces�szSymbol.get_namespacescCs t|j�dkrtd��|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)�lenro�
ValueError)rrrr�
get_namespace�szSymbol.get_namespace)N)r*r+r,r r5r?rprqrrrsrtrurgrvrwrxryr|rrrrr�s

�__main__r8�exec),�__doc__rrrrrrrrr	r
rrr
rrr�__all__rrr�objectrrrrr*�os�sys�open�argv�f�read�src�path�split�modrKrQrO�info�printrtrxrrrr�<module>s&@L&
C