CasperSecurity

Current Path : /usr/lib/python3.10/__pycache__/
Upload File :
Current File : //usr/lib/python3.10/__pycache__/symtable.cpython-310.pyc

o

`�wi�'�@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�filename�compile_type�top�r�/usr/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$�	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/r2�name�formatr3)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)r2r&r�TYPE_MODULEr'r(r9r#rrr�get_type>s�zSymbolTable.get_typecC�|jjS)z,Return an identifier for the table.
        )r2�idr#rrr�get_idMszSymbolTable.get_idcCrD)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.
        )r2r8r#rrr�get_nameRszSymbolTable.get_namecCrD)zPReturn the number of the first line in the
        block for the table.
        )r2�linenor#rrr�
get_lineno[szSymbolTable.get_linenocCst|jjtjk�S)zJReturn *True* if the locals in the table
        are optimizable.
        )�boolr2r&rr'r#rrr�is_optimizedaszSymbolTable.is_optimizedcC�t|jj�S)zAReturn *True* if the block is a nested class
        or function.)rJr2�nestedr#rrr�	is_nestedg�zSymbolTable.is_nestedcCrL)z:Return *True* if the block has nested namespaces.
        )rJr2�childrenr#rrr�has_childrenlrOzSymbolTable.has_childrencCs|jj��S)zKReturn a view object containing the names of symbols in the table.
        )r2�symbols�keysr#rrr�get_identifiersqrOzSymbolTable.get_identifierscCsT|j�|�}|dur(|jj|}|�|�}|jjdk}t||||d�}|j|<|S)zLLookup a *name* in the table.

        Returns a *Symbol* instance.
        Nr��module_scope)r4r+r2rR�_SymbolTable__check_childrenr8r)r$r8�sym�flags�
namespacesrVrrr�lookupvs
�zSymbolTable.lookupcs�fdd����D�S)zLReturn a list of *Symbol* instances for
        names in the table.
        csg|]}��|��qSr)r[��.0�identr#rr�
<listcomp>�sz+SymbolTable.get_symbols.<locals>.<listcomp>)rTr#rr#r�get_symbols�szSymbolTable.get_symbolscs��fdd��jjD�S)Ncs"g|]
}|j�krt|�j��qSr)r8rr3�r]�st�r8r$rrr_�s


�z0SymbolTable.__check_children.<locals>.<listcomp>�r2rP)r$r8rrcr�__check_children�s�zSymbolTable.__check_childrencs�fdd��jjD�S)z3Return a list of the nested symbol tables.
        csg|]}t|�j��qSr)rr3rar#rrr_�s�z,SymbolTable.get_children.<locals>.<listcomp>rdr#rr#r�get_children�s
�zSymbolTable.get_childrenN)r/r0r1r%r;rCrFrGrIrKrNrQrTr[r`rWrfrrrrr*s
	rc@sPeZdZdZdZdZdZdZdd�Zdd�Z	dd�Z
dd	�Zd
d�Zdd
�Z
dS)rNcst��fdd����D��S)Nc3s$�|]
}��jj|�r|VqdSr)r2rRr\�r$�	test_funcrr�	<genexpr>�s��z-Function.__idents_matching.<locals>.<genexpr>)�tuplerTrgrrgr�__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
rrn��locsrrrp��z%Function.get_locals.<locals>.<lambda>)�_Function__localsr
rrs�r$�testrryr�
get_locals��

zFunction.get_localscrv)z3Return a tuple of globals in the function.
        Ncrwrrxrn��globrrrp�r{z&Function.get_globals.<locals>.<lambda>)�_Function__globalsrrrsr}rr�r�get_globals�r�zFunction.get_globalscCrl)z5Return a tuple of nonlocals in the function.
        NcSrmr)rrnrrrrp�rqz(Function.get_nonlocals.<locals>.<lambda>)�_Function__nonlocalsrsr#rrr�
get_nonlocals�ruzFunction.get_nonlocalscCs$|jdurdd�}|�|�|_|jS)z:Return a tuple of free variables in the function.
        NcSs|t?t@tkSr)r
rrrnrrrrp�r{z$Function.get_frees.<locals>.<lambda>)�_Function__freesrs)r$�is_freerrr�	get_frees�s
zFunction.get_frees)r/r0r1rrr|r�r�r�rsrtrr�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__methodsr2rPr8rj)r$�drbrrr�get_methods�s

zClass.get_methods)r/r0r1r�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)%rNFrUcCs.||_||_|t?t@|_|pd|_||_dS)Nr)�
_Symbol__name�_Symbol__flagsr
r�_Symbol__scope�_Symbol__namespaces�_Symbol__module_scope)r$r8rYrZrVrrrr%�s


zSymbol.__init__cCsd�|j�S)Nz<symbol {0!r}>)r9r�r#rrrr;�szSymbol.__repr__cC�|jS)z#Return a name of a symbol.
        )r�r#rrrrG�szSymbol.get_namecCst|jtj@�S)zBReturn *True* if the symbol is used in
        its block.
        )rJr�rrr#rrr�
is_referenced�szSymbol.is_referencedcC�t|jt@�S)z4Return *True* if the symbol is a parameter.
        )rJr�rr#rrr�is_parameter��zSymbol.is_parametercC�"t|jttfvp|jo|jt@�S)z0Return *True* if the sysmbol is global.
        )rJr�rrr�r�rr#rrr�	is_global���zSymbol.is_globalcCr�)z(Return *True* if the symbol is nonlocal.)rJr�rr#rrr�is_nonlocal��zSymbol.is_nonlocalcC�t|jtk�S)zOReturn *True* if the symbol is declared global
        with a global statement.)rJr�rr#rrr�is_declared_globalr�zSymbol.is_declared_globalcCr�)z.Return *True* if the symbol is local.
        )rJr�r
rr�r�rr#rrr�is_localr�zSymbol.is_localcCr�)z2Return *True* if the symbol is annotated.
        )rJr�r	r#rrr�is_annotatedr�zSymbol.is_annotatedcCr�)zIReturn *True* if a referenced symbol is
        not assigned to.
        )rJr�rr#rrrr��zSymbol.is_freecCr�)zQReturn *True* if the symbol is created from
        an import statement.
        )rJr�rr#rrr�is_importedr�zSymbol.is_importedcCr�)z)Return *True* if a symbol is assigned to.)rJr�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.
        )rJr�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/r0r1r%r;rGr�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�modrTr^r[�info�printr�r�rrrr�<module>s.D	l6`
�
�
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY