ok

Mini Shell

Direktori : /opt/alt/python36/lib64/python3.6/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/__pycache__/symtable.cpython-36.opt-2.pyc

3

��2am�@sJddlZddlmZmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZddlZdddddgZdd�ZGd	d
�d
�Ze�ZGdd�de�ZGdd�de�ZGd
d�de�ZGdd�de�Zedk�rFddlZddlZeejd��Zej�Z WdQRXee ej!j"ejd�dd�Z#x0e#j$�D]$Z%e#j&e%�Z'e(e'e'j)�e'j*���qWdS)�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�SymbolcCstj|||�}t||�S)N)�	_symtabler�_newSymbolTable)�code�filenameZcompile_type�top�r�-/opt/alt/python36/lib64/python3.6/symtable.pyrsc@s$eZdZdd�Zdd�Zdd�ZdS)�SymbolTableFactorycCstj�|_dS)N)�weakref�WeakValueDictionary�_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}|jj|d�}|dkr4|j||�}|j|<|S)N)r�getr&)r r%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)r Z	raw_tablerrrrr!'szSymbolTable.__init__cCsN|jtkrd}nd|jj}|jjdkr6dj||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/)r �kindrrr�__repr__,s
zSymbolTable.__repr__cCs:|jjtjkrdS|jjtjkr$dS|jjtjkr6dSdS)N�moduleZfunction�class)r.r"rZTYPE_MODULEr#r$)r rrr�get_type9szSymbolTable.get_typecCs|jjS)N)r.�id)r rrr�get_idCszSymbolTable.get_idcCs|jjS)N)r.r4)r rrr�get_nameFszSymbolTable.get_namecCs|jjS)N)r.�lineno)r rrr�
get_linenoIszSymbolTable.get_linenocCst|jjtjk�S)N)�boolr.r"rr#)r rrr�is_optimizedLszSymbolTable.is_optimizedcCst|jj�S)N)r@r.�nested)r rrr�	is_nestedOszSymbolTable.is_nestedcCst|jj�S)N)r@r.�children)r rrr�has_childrenRszSymbolTable.has_childrencCsdS)NFr)r rrr�has_execUszSymbolTable.has_execcCs|jjj�S)N)r.�symbols�keys)r rrr�get_identifiersYszSymbolTable.get_identifierscCsD|jj|�}|dkr@|jj|}|j|�}t|||�}|j|<|S)N)r0r'r.rG�_SymbolTable__check_childrenr)r r4Zsym�flags�
namespacesrrr�lookup\s
zSymbolTable.lookupcs�fdd��j�D�S)Ncsg|]}�j|��qSr)rM)�.0�ident)r rr�
<listcomp>esz+SymbolTable.get_symbols.<locals>.<listcomp>)rI)r r)r r�get_symbolsdszSymbolTable.get_symbolscs��fdd��jjD�S)Ncs"g|]}|j�krt|�j��qSr)r4rr/)rN�st)r4r rrrPhsz0SymbolTable.__check_children.<locals>.<listcomp>)r.rD)r r4r)r4r rZ__check_childrengszSymbolTable.__check_childrencs�fdd��jjD�S)Ncsg|]}t|�j��qSr)rr/)rNrR)r rrrPmsz,SymbolTable.get_children.<locals>.<listcomp>)r.rD)r r)r r�get_childrenls
zSymbolTable.get_childrenN)r+r,r-r!r7r:r<r=r?rArCrErFrIrMrQrJrSrrrrr%s

c@sDeZdZdZdZdZdZdd�Zdd�Zdd�Z	dd	�Z
d
d�ZdS)rNcst��fdd��j�D��S)Ncs g|]}��jj|�r|�qSr)r.rG)rNrO)r �	test_funcrrrPzsz.Function.__idents_matching.<locals>.<listcomp>)�tuplerI)r rTr)r rTrZ__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)r rrr�get_parameters}s
zFunction.get_parameterscs0|jdkr*ttf��fdd�}|j|�|_|jS)Ncs|t?t@�kS)N)r	r
)rV)�locsrrrW�sz%Function.get_locals.<locals>.<lambda>)�_Function__localsrrrY)r �testr)r[r�
get_locals�s

zFunction.get_localscs0|jdkr*ttf��fdd�}|j|�|_|jS)Ncs|t?t@�kS)N)r	r
)rV)�globrrrW�sz&Function.get_globals.<locals>.<lambda>)�_Function__globalsr
rrY)r r]r)r_r�get_globals�s

zFunction.get_globalscCs$|jdkrdd�}|j|�|_|jS)NcSs|t?t@tkS)N)r	r
r)rVrrrrW�sz$Function.get_frees.<locals>.<lambda>)�_Function__freesrY)r �is_freerrr�	get_frees�s
zFunction.get_frees)r+r,r-rXr\rbr`rYrZr^rardrrrrrqsc@seZdZdZdd�ZdS)rNcCs:|jdkr4i}x|jjD]}d||j<qWt|�|_|jS)N�)�_Class__methodsr.rDr4rU)r �drRrrr�get_methods�s

zClass.get_methods)r+r,r-rfrhrrrrr�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 f|_dS)N)�
_Symbol__name�_Symbol__flagsr	r
�_Symbol__scope�_Symbol__namespaces)r r4rKrLrrrr!�szSymbol.__init__cCsdj|j�S)Nz<symbol {0!r}>)r5ri)r rrrr7�szSymbol.__repr__cCs|jS)N)ri)r rrrr=�szSymbol.get_namecCst|jtj@�S)N)r@rjrr)r rrr�
is_referenced�szSymbol.is_referencedcCst|jt@�S)N)r@rjr)r rrr�is_parameter�szSymbol.is_parametercCst|jttfk�S)N)r@rkr
r)r rrr�	is_global�szSymbol.is_globalcCst|jtk�S)N)r@rkr)r rrr�is_declared_global�szSymbol.is_declared_globalcCst|jt@�S)N)r@rjr)r rrr�is_local�szSymbol.is_localcCst|jt@�S)N)r@rjr)r rrr�is_annotated�szSymbol.is_annotatedcCst|jtk�S)N)r@rkr)r rrrrc�szSymbol.is_freecCst|jt@�S)N)r@rjr)r rrr�is_imported�szSymbol.is_importedcCst|jt@�S)N)r@rjr)r rrr�is_assigned�szSymbol.is_assignedcCs
t|j�S)N)r@rl)r rrr�is_namespace�szSymbol.is_namespacecCs|jS)N)rl)r rrr�get_namespaces�szSymbol.get_namespacescCs t|j�dkrtd��|jdS)Nrez$name is bound to multiple namespacesr)�lenrl�
ValueError)r rrr�
get_namespace�szSymbol.get_namespace)N)r+r,r-r!r7r=rmrnrorprqrrrcrsrtrurvryrrrrr�s

�__main__re�exec)+rrrrrrrrr	r
rrr
rrr�__all__rrr�objectrrrrr+�os�sys�open�argv�f�read�src�path�split�modrIrOrM�info�printrqrurrrr�<module>s$@L&
C



Zerion Mini Shell 1.0