ok

Mini Shell

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

3

)j�a�4�@s�dZddlZddlZddlZddlZddlmZmZm	Z	ddddgZ
iZGdd�d�ZGd	d�d�Z
dd
d�Zddd�Zddd
�Zdd�Zdd�Zdd�Zedkr�e�dS)a�Parse a Python module and describe its classes and methods.

Parse enough of a Python file to recognize imports and class and
method definitions, and to find out the superclasses of a class.

The interface consists of a single function:
        readmodule_ex(module [, path])
where module is the name of a Python module, and path is an optional
list of directories where the module is to be searched.  If present,
path is prepended to the system search path sys.path.  The return
value is a dictionary.  The keys of the dictionary are the names of
the classes defined in the module (including classes that are defined
via the from XXX import YYY construct).  The values are class
instances of the class Class defined here.  One special key/value pair
is present for packages: the key '__path__' has a list as its value
which contains the package search path.

A class is described by the class Class in this module.  Instances
of this class have the following instance variables:
        module -- the module name
        name -- the name of the class
        super -- a list of super classes (Class instances)
        methods -- a dictionary of methods
        file -- the file in which the class was defined
        lineno -- the line in the file on which the class statement occurred
The dictionary of methods uses the method names as keys and the line
numbers on which the method was defined as values.
If the name of a super class is not recognized, the corresponding
entry in the list of super classes is not a class instance but a
string giving the name of the super class.  Since import statements
are recognized and imported modules are scanned as well, this
shouldn't happen often.

A function is described by the class Function in this module.
Instances of this class have the following instance variables:
        module -- the module name
        name -- the name of the class
        file -- the file in which the class was defined
        lineno -- the line in the file on which the class statement occurred
�N)�NAME�DEDENT�OP�
readmodule�
readmodule_ex�Class�Functioncs(eZdZdZ�fdd�Zdd�Z�ZS)rz"Class to represent a Python class.cs4||_||_|dkrg}||_i|_||_||_dS)N)�module�name�super�methods�file�lineno)�selfr	r
rr
r)�	__class__��+/opt/alt/python36/lib64/python3.6/pyclbr.py�__init__7szClass.__init__cCs||j|<dS)N)r)rr
rrrr�
_addmethodAszClass._addmethod)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__rr)rrr5s
c@seZdZdZdd�ZdS)rz.Class to represent a top-level Python functioncCs||_||_||_||_dS)N)r	r
r
r)rr	r
r
rrrrrFszFunction.__init__N)rrrrrrrrrrDscCs:i}x0t||pg�j�D]\}}t|t�r|||<qW|S)z}Backwards compatible interface.

    Call readmodule_ex() and then only keep Class objects from the
    resulting dictionary.)�_readmodule�items�
isinstancer)r	�path�res�key�valuerrrrLs

cCst||p
g�S)z�Read a module file and return a dictionary of classes.

    Search for MODULE in PATH and sys.path, read and parse the
    module and return a dictionary with one entry for each class
    found in the module.
    )r)r	rrrrrXsc&!Cs�|dk	rd||f}n|}|tkr*t|Si}|tjkrL|dkrL|t|<|S|jd�}|dkr�|d|�}||dd�}t|||�}|dk	r�d||f}d|kr�tdj|���t||d|�Sd}	|dk	r�|}
n
|tj}
tj	j
||
�}|t|<|jdk	�r|j|d<y|jj
|�}|dk�r$|SWnttfk
�r@|SX|jj|�}
tj|�}	g}tj|	j�}�y<�x4|D�]*\}}}}}|tk�r�|\}}x$|�r�|dd|k�r�|d=�q�W�qt|dk�rl|\}}x$|�r�|dd|k�r�|d=�q�Wt|�dd	�\}}}|tk�r�qt|�rH|dd}t|t��rZ|j||�nt|||
|�||<|jd|f��qt|d
k�rD|\}}x$|�r�|dd|k�r�|d=�q�Wt|�dd	�\}}}|tk�rȐqtt|�dd	�\}}}d}|dk�rg}d}g}�xt|�dd	�\}}}|dk�r�|dk�r�dj|�}||k�rD||}nL|jd�}t|�dk�r�|d} |d}| tk�r�t| }!||!k�r�|!|}|j|�g}|dk�r�|d7}nX|dk�r�|d8}|dk�r
Pn8|d
k�r�|dk�r�n"|tt fk�r�|dk�r�|j|��q�W|}t||||
|�}|�s2|||<|j||f��qt|dk�r�|ddk�r�t!|�}"xl|"D]d\}#}$yL|dk�r�t|#|�n2yt|#||�Wn tk
�r�t|#g�YnXWnYnX�qjWn�|dk�rt|ddk�rtt"|�\}#}|#�st|dk�r�qtt!|�}yt|#||�}!Wn�wtYnXxd|D]\\}}%||!k�rd|!|||%�p`|<n4|dk�r>x(|!D] }|ddk�rt|!|||<�qtW�q>W�qtWWnt#k
�r�YnX|	j$�|S)a.Do the hard work for readmodule[_ex].

    If INPACKAGE is given, it must be the dotted name of the package in
    which we are searching for a submodule, and then PATH must be the
    package search path; otherwise, we are searching for a top-level
    module, and PATH is combined with sys.path.
    Nz%s.%s�.r��__path__zNo package named {}�def��class�(�)�,���import�from�*�_���r0r0r0r0r0r0)r(r)���r0)%�_modules�sys�builtin_module_names�rfindr�ImportError�formatr�	importlib�util�_find_spec_from_path�submodule_search_locations�loader�
get_source�AttributeError�get_filename�io�StringIO�tokenize�generate_tokens�readliner�nextrrrrr�append�join�split�lenr�_getnamelist�_getname�
StopIteration�close)&r	rZ	inpackageZ
fullmodule�dict�i�packageZ	submodule�parent�fZsearch_path�spec�sourceZfname�stack�g�	tokentype�token�startZ_end�_linerZ
thisindentZ	meth_nameZ	cur_class�
class_nameZinherit�names�levelr�n�c�m�d�modules�modZ_mod2Zn2rrrras	


























"rcCstg}xjt|�\}}|sP|dkr.t|�\}}nd}|j||f�x |dkr`d|kr`t|�d}qBW|dkrPqW|S)N�asr)�
r")rKrFrE)rVr\r
rXZname2rrrrJsrJcCs�g}t|�dd�\}}|tkr0|dkr0d|fS|j|�xJt|�dd�\}}|dkrZPt|�dd�\}}|tkrxP|j|�q<Wdj|�|fS)Nrr+r.r!)rErrFrG)rV�partsrWrXrrrrK3s
rKc
Csddl}ddlm}tjd}|jj|�r`|jj|�g}|jj|�}|j	�j
d�rd|dd
�}ng}t||�}t|j
��}|jdd�d�x�|D]z}t|t�r�td	|j|j|j�t|jj�|d�d�}x@|D]\}}	|d
kr�td||	�q�Wq�t|t�r�td|j|j�q�WdS)Nr)�
itemgetterr"z.pyr%cSst|dd�S)Nrr)�getattr)�arrr�<lambda>Tsz_main.<locals>.<lambda>)rr&r#z  defr$���)�os�operatorrgr3�argvr�exists�dirname�basename�lower�endswithr�list�values�sortrr�printr
rr�sortedrrr)
rlrgrcrrNZobjs�objrr
rrrr�_mainFs*




rz�__main__)N)N)N)rr@r3�importlib.utilr8rBrXrrr�__all__r2rrrrrrJrKrzrrrrr�<module>(s$

	
?

Zerion Mini Shell 1.0