AlkantarClanX12

Your IP : 18.217.4.250


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/symtable.cpython-310.opt-2.pyc

o

6��f�'�@sV	ddlZddlmZmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZddlZgd�Zdd�ZGdd�d�Ze�ZGdd	�d	�ZGd
d�de�ZGdd
�d
e�ZGdd�d�Zedkr�ddlZddlZeejd��Ze��Z Wd�n1s}wYee ej!�"ejd�dd�Z#e#�$�D]Z%e#�&e%�Z'e(e'e'�)�e'�*��q�dSdS)�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�SymbolcCs	t�|||�}t||�S�N)�	_symtabler�_newSymbolTable)�code�filenameZcompile_type�top�r�//opt/alt/python310/lib64/python3.10/symtable.pyrs
rc@s$eZdZdd�Zdd�Zdd�ZdS)�SymbolTableFactorycCst��|_dSr)�weakrefZWeakValueDictionary�_SymbolTableFactory__memo��selfrrr�__init__szSymbolTableFactory.__init__cCs6|jtjkrt||�S|jtjkrt||�St||�Sr)�typer�
TYPE_FUNCTIONr�
TYPE_CLASSrr)r"�tablerrrr�news



zSymbolTableFactory.newcCs8||f}|j�|d�}|dur|�||�}|j|<|Sr)r �getr()r"r'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�ZdS)rcCs||_||_i|_dSr)�_table�	_filename�_symbols)r"Z	raw_tablerrrrr#,s
zSymbolTable.__init__cCsJ|jtkrd}nd|jj}|jjdkrd�||j�Sd�||jj|j�S)N�z%s rz<{0}SymbolTable for module {1}>z<{0}SymbolTable for {1} in {2}>)�	__class__rr-r0�name�formatr1)r"�kindrrr�__repr__1s
�zSymbolTable.__repr__cCs<	|jjtjkr
dS|jjtjkrdS|jjtjkrdSdS)N�moduleZfunction�class)r0r$rZTYPE_MODULEr%r&r!rrr�get_type>s�zSymbolTable.get_typecC�
	|jjSr)r0�idr!rrr�get_idMszSymbolTable.get_idcCr<r)r0r5r!rrr�get_nameRszSymbolTable.get_namecCr<r)r0�linenor!rrr�
get_lineno[szSymbolTable.get_linenocCs	t|jjtjk�Sr)�boolr0r$rr%r!rrr�is_optimizedaszSymbolTable.is_optimizedcC�	t|jj�Sr)rBr0�nestedr!rrr�	is_nestedg�zSymbolTable.is_nestedcCrDr)rBr0�childrenr!rrr�has_childrenlrGzSymbolTable.has_childrencCs	|jj��Sr)r0�symbols�keysr!rrr�get_identifiersqrGzSymbolTable.get_identifierscCsV	|j�|�}|dur)|jj|}|�|�}|jjdk}t||||d�}|j|<|S)Nr��module_scope)r2r)r0rJ�_SymbolTable__check_childrenr5r)r"r5Zsym�flags�
namespacesrNrrr�lookupvs
�zSymbolTable.lookupcs	�fdd����D�S)Ncsg|]}��|��qSr)rR��.0�identr!rr�
<listcomp>�sz+SymbolTable.get_symbols.<locals>.<listcomp>)rLr!rr!r�get_symbols�szSymbolTable.get_symbolscs��fdd��jjD�S)Ncs"g|]
}|j�krt|�j��qSr)r5rr1�rT�st�r5r"rrrV�s


�z0SymbolTable.__check_children.<locals>.<listcomp>�r0rH)r"r5rrZrZ__check_children�s�zSymbolTable.__check_childrencs	�fdd��jjD�S)Ncsg|]}t|�j��qSr)rr1rXr!rrrV�s�z,SymbolTable.get_children.<locals>.<listcomp>r[r!rr!r�get_children�s
�zSymbolTable.get_childrenN)r-r.r/r#r8r;r>r?rArCrFrIrLrRrWrOr\rrrrr*s
	rc@sPeZdZdZdZdZdZdZdd�Zdd�Z	dd�Z
dd	�Zd
d�Zdd
�Z
dS)rNcst��fdd����D��S)Nc3s$�|]
}��jj|�r|VqdSr)r0rJrS�r"Z	test_funcrr�	<genexpr>�s��z-Function.__idents_matching.<locals>.<genexpr>)�tuplerLr]rr]rZ__idents_matching�szFunction.__idents_matchingcC�"	|jdur|�dd��|_|jS)NcS�|t@Sr)r��xrrr�<lambda>��z)Function.get_parameters.<locals>.<lambda>)�_Function__params�_Function__idents_matchingr!rrr�get_parameters��
zFunction.get_parametersc�2	|jdurttf��fdd�}|�|�|_|jS)Nc�|t?t@�vSr�r
rrb�Zlocsrrrd��z%Function.get_locals.<locals>.<lambda>)�_Function__localsr
rrg�r"�testrrmr�
get_locals��
zFunction.get_localscrj)Ncrkrrlrb�Zglobrrrd�rnz&Function.get_globals.<locals>.<lambda>)�_Function__globalsrrrgrprrtr�get_globals�rszFunction.get_globalscCr`)NcSrar)rrbrrrrd�rez(Function.get_nonlocals.<locals>.<lambda>)�_Function__nonlocalsrgr!rrr�
get_nonlocals�rizFunction.get_nonlocalscCs&	|jdurdd�}|�|�|_|jS)NcSs|t?t@tkSr)r
rrrbrrrrd�rnz$Function.get_frees.<locals>.<lambda>)�_Function__freesrg)r"�is_freerrr�	get_frees�s

zFunction.get_frees)r-r.r/rfroryrurwrgrhrrrvrxr{rrrrr�s		rc@seZdZdZdd�ZdS)rNcCs8	|jduri}|jjD]}d||j<qt|�|_|jS)N�)�_Class__methodsr0rHr5r_)r"�drYrrr�get_methods�s

zClass.get_methods)r-r.r/r}rrrrrr�src@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)%rNFrMcCs.||_||_|t?t@|_|pd|_||_dS)Nr)�
_Symbol__name�_Symbol__flagsr
r�_Symbol__scope�_Symbol__namespaces�_Symbol__module_scope)r"r5rPrQrNrrrr#�s


zSymbol.__init__cCsd�|j�S)Nz<symbol {0!r}>)r6r�r!rrrr8�szSymbol.__repr__cC�	|jSr)r�r!rrrr?�szSymbol.get_namecCs	t|jtj@�Sr)rBr�rrr!rrr�
is_referenced�szSymbol.is_referencedcC�	t|jt@�Sr)rBr�rr!rrr�is_parameter��zSymbol.is_parametercC�$	t|jttfvp|jo|jt@�Sr)rBr�rrr�r�rr!rrr�	is_global���zSymbol.is_globalcCr�r)rBr�rr!rrr�is_nonlocal��zSymbol.is_nonlocalcC�	t|jtk�Sr)rBr�rr!rrr�is_declared_globalr�zSymbol.is_declared_globalcCr�r)rBr�r
rr�r�rr!rrr�is_localr�zSymbol.is_localcCr�r)rBr�r	r!rrr�is_annotatedr�zSymbol.is_annotatedcCr�r)rBr�rr!rrrrz�zSymbol.is_freecCr�r)rBr�rr!rrr�is_importedr�zSymbol.is_importedcCr�r)rBr�rr!rrr�is_assignedr�zSymbol.is_assignedcCs	t|j�Sr)rBr�r!rrr�is_namespace!s

zSymbol.is_namespacecCr�r)r�r!rrr�get_namespaces.szSymbol.get_namespacescCs"	t|j�dkrtd��|jdS)Nr|z$name is bound to multiple namespacesr)�lenr��
ValueErrorr!rrr�
get_namespace2s
zSymbol.get_namespacer)r-r.r/r#r8r?r�r�r�r�r�r�r�rzr�r�r�r�r�rrrrr�s"
r�__main__r|�exec)+rrrrrrrrr	r
rrr
rrrr�__all__rrrrrrrr-�os�sys�open�argv�f�read�src�path�split�modrLrUrR�info�printr�r�rrrr�<module>s.D	l6`
�
�