Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 18.119.255.135
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : symtable.cpython-310.pyc
o

^b�'�@sXdZddlZddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZddlZgd�Zdd�ZGdd�d�Ze�ZGd	d
�d
�ZGdd�de�ZGd
d�de�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)z2Interface to the compiler's internal symbol tables�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)z� Return the toplevel *SymbolTable* for the source code.

    *filename* is the name of the file with the code
    and *compile_type* is the *compile()* mode argument.
    )�	_symtabler�_newSymbolTable)�code�filenameZcompile_type�top�r�1/usr/local/python-3.10/lib/python3.10/symtable.pyrs
rc@s$eZdZdd�Zdd�Zdd�ZdS)�SymbolTableFactorycCst��|_dS�N)�weakref�WeakValueDictionary�_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.r1�name�formatr2)r#�kindrrr�__repr__1s
�zSymbolTable.__repr__cCsX|jjtjkr	dS|jjtjkrdS|jjtjkrdS|jjdvs*Jd�|jj���dS)zwReturn the type of the symbol table.

        The values retuned are 'class', 'module' and
        'function'.
        �module�function�class)���zunexpected type: {0}N)r1r%rZTYPE_MODULEr&r'r7r"rrr�get_type>s�zSymbolTable.get_typecC�|jjS)z,Return an identifier for the table.
        )r1�idr"rrr�get_idMszSymbolTable.get_idcCrA)z�Return the table's name.

        This corresponds to the name of the class, function
        or 'top' if the table is for a class, function or
        global respectively.
        )r1r6r"rrr�get_nameRszSymbolTable.get_namecCrA)zPReturn the number of the first line in the
        block for the table.
        )r1�linenor"rrr�
get_lineno[szSymbolTable.get_linenocCst|jjtjk�S)zJReturn *True* if the locals in the table
        are optimizable.
        )�boolr1r%rr&r"rrr�is_optimizedaszSymbolTable.is_optimizedcC�t|jj�S)zAReturn *True* if the block is a nested class
        or function.)rGr1�nestedr"rrr�	is_nestedg�zSymbolTable.is_nestedcCrI)z:Return *True* if the block has nested namespaces.
        )rGr1�childrenr"rrr�has_childrenlrLzSymbolTable.has_childrencCs|jj��S)z8Return a list of names of symbols in the table.
        )r1�symbols�keysr"rrr�get_identifiersqrLzSymbolTable.get_identifierscCsT|j�|�}|dur(|jj|}|�|�}|jjdk}t||||d�}|j|<|S)zLLookup a *name* in the table.

        Returns a *Symbol* instance.
        Nr��module_scope)r3r*r1rO�_SymbolTable__check_childrenr6r)r#r6Zsym�flags�
namespacesrSrrr�lookupvs
�zSymbolTable.lookupcs�fdd����D�S)zLReturn a list of *Symbol* instances for
        names in the table.
        csg|]}��|��qSr)rW��.0�identr"rr�
<listcomp>�sz+SymbolTable.get_symbols.<locals>.<listcomp>)rQr"rr"r�get_symbols�szSymbolTable.get_symbolscs��fdd��jjD�S)Ncs"g|]
}|j�krt|�j��qSr)r6rr2�rY�st�r6r#rrr[�s�z0SymbolTable.__check_children.<locals>.<listcomp>�r1rM)r#r6rr_rZ__check_children�s�zSymbolTable.__check_childrencs�fdd��jjD�S)z3Return a list of the nested symbol tables.
        csg|]}t|�j��qSr)rr2r]r"rrr[�s�z,SymbolTable.get_children.<locals>.<listcomp>r`r"rr"r�get_children�s
�zSymbolTable.get_childrenN)r.r/r0r$r9r@rCrDrFrHrKrNrQrWr\rTrarrrrr*s
	rc@sPeZdZdZdZdZdZdZdd�Zdd�Z	dd�Z
dd	�Zd
d�Zdd
�Z
dS)rNcst��fdd����D��S)Nc3s$�|]
}��jj|�r|VqdSr)r1rOrX�r#Z	test_funcrr�	<genexpr>�s��z-Function.__idents_matching.<locals>.<genexpr>)�tuplerQrbrrbrZ__idents_matching�szFunction.__idents_matchingcC� |jdur
|�dd��|_|jS)z6Return a tuple of parameters to the function.
        NcS�|t@Sr)r��xrrr�<lambda>��z)Function.get_parameters.<locals>.<lambda>)�_Function__params�_Function__idents_matchingr"rrr�get_parameters��
zFunction.get_parametersc�0|jdurttf��fdd�}|�|�|_|jS)z2Return a tuple of locals in the function.
        Nc�|t?t@�vSr�r
rrg�Zlocsrrri��z%Function.get_locals.<locals>.<lambda>)�_Function__localsr
rrl�r#�testrrrr�
get_locals��

zFunction.get_localscro)z3Return a tuple of globals in the function.
        Ncrprrqrg��globrrri�rsz&Function.get_globals.<locals>.<lambda>)�_Function__globalsrrrlrurryr�get_globals�rxzFunction.get_globalscCre)z5Return a tuple of nonlocals in the function.
        NcSrfr)rrgrrrri�rjz(Function.get_nonlocals.<locals>.<lambda>)�_Function__nonlocalsrlr"rrr�
get_nonlocals�rnzFunction.get_nonlocalscCs$|jdurdd�}|�|�|_|jS)z:Return a tuple of free variables in the function.
        NcSs|t?t@tkSr)r
rrrgrrrri�rsz$Function.get_frees.<locals>.<lambda>)�_Function__freesrl)r#�is_freerrr�	get_frees�s
zFunction.get_frees)r.r/r0rkrtrr{r}rlrmrwr|r~r�rrrrr�s		rc@seZdZdZdd�ZdS)rNcCs6|jduri}|jjD]}d||j<qt|�|_|jS)z9Return a tuple of methods declared in the class.
        Nr=)�_Class__methodsr1rMr6rd)r#�dr^rrr�get_methods�s

zClass.get_methods)r.r/r0r�r�rrrrr�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)%rNFrRcCs.||_||_|t?t@|_|pd|_||_dS)Nr)�
_Symbol__name�_Symbol__flagsr
r�_Symbol__scope�_Symbol__namespaces�_Symbol__module_scope)r#r6rUrVrSrrrr$�s


zSymbol.__init__cCsd�|j�S)Nz<symbol {0!r}>)r7r�r"rrrr9�szSymbol.__repr__cC�|jS)z#Return a name of a symbol.
        )r�r"rrrrD�szSymbol.get_namecCst|jtj@�S)zBReturn *True* if the symbol is used in
        its block.
        )rGr�rrr"rrr�
is_referenced�szSymbol.is_referencedcC�t|jt@�S)z4Return *True* if the symbol is a parameter.
        )rGr�rr"rrr�is_parameter��zSymbol.is_parametercC�"t|jttfvp|jo|jt@�S)z0Return *True* if the sysmbol is global.
        )rGr�rrr�r�rr"rrr�	is_global���zSymbol.is_globalcCr�)z(Return *True* if the symbol is nonlocal.)rGr�rr"rrr�is_nonlocal��zSymbol.is_nonlocalcC�t|jtk�S)zOReturn *True* if the symbol is declared global
        with a global statement.)rGr�rr"rrr�is_declared_globalr�zSymbol.is_declared_globalcCr�)z.Return *True* if the symbol is local.
        )rGr�r
rr�r�rr"rrr�is_localr�zSymbol.is_localcCr�)z2Return *True* if the symbol is annotated.
        )rGr�r	r"rrr�is_annotatedr�zSymbol.is_annotatedcCr�)zIReturn *True* if a referenced symbol is
        not assigned to.
        )rGr�rr"rrrr��zSymbol.is_freecCr�)zQReturn *True* if the symbol is created from
        an import statement.
        )rGr�rr"rrr�is_importedr�zSymbol.is_importedcCr�)z)Return *True* if a symbol is assigned to.)rGr�rr"rrr�is_assignedr�zSymbol.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.
        )rGr�r"rrr�is_namespace!s
zSymbol.is_namespacecCr�)z.Return a list of namespaces bound to this name)r�r"rrr�get_namespaces.szSymbol.get_namespacescCs t|j�dkrtd��|jdS)z�Return the single namespace bound to this name.

        Raises ValueError if the name is bound to multiple namespaces.
        r=z$name is bound to multiple namespacesr)�lenr��
ValueErrorr"rrr�
get_namespace2s
zSymbol.get_namespacer)r.r/r0r$r9rDr�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�s"
r�__main__r=�exec),�__doc__rrrrrrrrr	r
rrr
rrrr�__all__rrrrrrrr.�os�sys�open�argv�f�read�src�path�split�modrQrZrW�info�printr�r�rrrr�<module>s.D	l6`
�
�
© 2025 GrazzMean