Your IP : 3.135.195.180


Current Path : /usr/lib64/python3.8/__pycache__/
Upload File :
Current File : //usr/lib64/python3.8/__pycache__/symtable.cpython-38.opt-2.pyc

U

e5dU�	@sFddlZddlmZmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZddlZdddddgZdd�ZGd	d
�d
�Ze�ZGdd�d�ZGdd�de�ZGd
d�de�ZGdd�d�Zedk�rBddlZddlZeejd��Ze��Z W5QRXee ej!�"ejd�dd�Z#e#�$�D]$Z%e#�&e%�Z'e(e'e'�)�e'�*���qdS)�N)�USE�
DEF_GLOBAL�DEF_NONLOCAL�	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� /usr/lib64/python3.8/symtable.pyrsc@s$eZdZdd�Zdd�Zdd�ZdS)�SymbolTableFactorycCst��|_dSr)�weakrefZWeakValueDictionary�_SymbolTableFactory__memo��selfrrr�__init__szSymbolTableFactory.__init__cCs6|jtjkrt||�S|jtjkr,t||�St||�Sr)�typer�
TYPE_FUNCTIONr�
TYPE_CLASSrr)r"�tablerrrr�news


zSymbolTableFactory.newcCs8||f}|j�|d�}|dkr4|�||�}|j|<|Sr)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|_dSr)�_table�	_filename�_symbols)r"Z	raw_tablerrrrr#'szSymbolTable.__init__cCsN|jtkrd}nd|jj}|jjdkr6d�||j�Sd�||jj|j�SdS)N�z%s rz<{0}SymbolTable for module {1}>z<{0}SymbolTable for {1} in {2}>)�	__class__rr-r0�name�formatr1)r"Zkindrrr�__repr__,s
�zSymbolTable.__repr__cCs:|jjtjkrdS|jjtjkr$dS|jjtjkr6dSdS)N�moduleZfunction�class)r0r$rZTYPE_MODULEr%r&r!rrr�get_type9szSymbolTable.get_typecCs|jjSr)r0�idr!rrr�get_idCszSymbolTable.get_idcCs|jjSr)r0r5r!rrr�get_nameFszSymbolTable.get_namecCs|jjSr)r0�linenor!rrr�
get_linenoIszSymbolTable.get_linenocCst|jjtjk�Sr)�boolr0r$rr%r!rrr�is_optimizedLszSymbolTable.is_optimizedcCst|jj�Sr)r@r0�nestedr!rrr�	is_nestedOszSymbolTable.is_nestedcCst|jj�Sr)r@r0�childrenr!rrr�has_childrenRszSymbolTable.has_childrencCsdS)NFrr!rrr�has_execUszSymbolTable.has_execcCs|jj��Sr)r0�symbols�keysr!rrr�get_identifiersYszSymbolTable.get_identifierscCsT|j�|�}|dkrP|jj|}|�|�}|jjdk}t||||d�}|j|<|S)Nr��module_scope)r2r)r0rG�_SymbolTable__check_childrenr5r)r"r5Zsym�flags�
namespacesrKrrr�lookup\s
�zSymbolTable.lookupcs�fdd����D�S)Ncsg|]}��|��qSr)rO��.0�identr!rr�
<listcomp>gsz+SymbolTable.get_symbols.<locals>.<listcomp>)rIr!rr!r�get_symbolsfszSymbolTable.get_symbolscs��fdd��jjD�S)Ncs"g|]}|j�krt|�j��qSr)r5rr1�rQ�st�r5r"rrrSjs
�z0SymbolTable.__check_children.<locals>.<listcomp>�r0rD)r"r5rrWrZ__check_childrenis�zSymbolTable.__check_childrencs�fdd��jjD�S)Ncsg|]}t|�j��qSr)rr1rUr!rrrSos�z,SymbolTable.get_children.<locals>.<listcomp>rXr!rr!r�get_childrenns
�zSymbolTable.get_childrenN)r-r.r/r#r7r:r<r=r?rArCrErFrIrOrTrLrYrrrrr%s


c@sPeZdZdZdZdZdZdZdd�Zdd�Z	dd�Z
dd	�Zd
d�Zdd
�Z
dS)rNcst��fdd����D��S)Nc3s"|]}��jj|�r|VqdSr)r0rGrP�r"Z	test_funcrr�	<genexpr>}s�z-Function.__idents_matching.<locals>.<genexpr>)�tuplerIrZrrZrZ__idents_matching|szFunction.__idents_matchingcCs |jdkr|�dd��|_|jS)NcSs|t@Sr)r��xrrr�<lambda>��z)Function.get_parameters.<locals>.<lambda>)�_Function__params�_Function__idents_matchingr!rrr�get_parameters�s
zFunction.get_parameterscs0|jdkr*ttf��fdd�}|�|�|_|jS)Ncs|t?t@�kSr�r
rr]�Zlocsrrr_�r`z%Function.get_locals.<locals>.<lambda>)�_Function__localsr
rrb�r"Ztestrrer�
get_locals�s

zFunction.get_localscs0|jdkr*ttf��fdd�}|�|�|_|jS)Ncs|t?t@�kSrrdr]�Zglobrrr_�r`z&Function.get_globals.<locals>.<lambda>)�_Function__globalsrrrbrgrrir�get_globals�s

zFunction.get_globalscCs |jdkr|�dd��|_|jS)NcSs|t@Sr)rr]rrrr_�r`z(Function.get_nonlocals.<locals>.<lambda>)�_Function__nonlocalsrbr!rrr�
get_nonlocals�s
zFunction.get_nonlocalscCs$|jdkrdd�}|�|�|_|jS)NcSs|t?t@tkSr)r
rrr]rrrr_�r`z$Function.get_frees.<locals>.<lambda>)�_Function__freesrb)r"�is_freerrr�	get_frees�s
zFunction.get_frees)r-r.r/rarfrnrjrlrbrcrhrkrmrprrrrrssc@seZdZdZdd�ZdS)rNcCs6|jdkr0i}|jjD]}d||j<qt|�|_|jS)N�)�_Class__methodsr0rDr5r\)r"�drVrrr�get_methods�s

zClass.get_methods)r-r.r/rrrtrrrrr�sc@s�eZdZd$dd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd"d#�ZdS)%rNFrJcCs.||_||_|t?t@|_|p d|_||_dS)Nr)�
_Symbol__name�_Symbol__flagsr
r�_Symbol__scope�_Symbol__namespaces�_Symbol__module_scope)r"r5rMrNrKrrrr#�s

zSymbol.__init__cCsd�|j�S)Nz<symbol {0!r}>)r6rur!rrrr7�szSymbol.__repr__cCs|jSr)rur!rrrr=�szSymbol.get_namecCst|jtj@�Sr)r@rvrrr!rrr�
is_referenced�szSymbol.is_referencedcCst|jt@�Sr)r@rvrr!rrr�is_parameter�szSymbol.is_parametercCs"t|jttfkp|jo|jt@�Sr)r@rwrrryrvrr!rrr�	is_global�s�zSymbol.is_globalcCst|jt@�Sr)r@rvrr!rrr�is_nonlocal�szSymbol.is_nonlocalcCst|jtk�Sr)r@rwrr!rrr�is_declared_global�szSymbol.is_declared_globalcCs"t|jttfkp|jo|jt@�Sr)r@rwr
rryrvrr!rrr�is_local�s�zSymbol.is_localcCst|jt@�Sr)r@rvr	r!rrr�is_annotated�szSymbol.is_annotatedcCst|jtk�Sr)r@rwrr!rrrro�szSymbol.is_freecCst|jt@�Sr)r@rvrr!rrr�is_imported�szSymbol.is_importedcCst|jt@�Sr)r@rvrr!rrr�is_assigned�szSymbol.is_assignedcCs
t|j�Sr)r@rxr!rrr�is_namespace�szSymbol.is_namespacecCs|jSr)rxr!rrr�get_namespaces�szSymbol.get_namespacescCs t|j�dkrtd��|jdS)Nrqz$name is bound to multiple namespacesr)�lenrx�
ValueErrorr!rrr�
get_namespace�szSymbol.get_namespace)N)r-r.r/r#r7r=rzr{r|r}r~rr�ror�r�r�r�r�rrrrr�s 
�__main__rq�exec)+rrrrrrrrr	r
rrr
rrrr�__all__rrrrrrrr-�os�sys�open�argv�f�read�src�path�split�modrIrRrO�info�printrr�rrrr�<module>s$DN,
M



?>