AlkantarClanX12

Your IP : 18.226.226.151


Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/pyclbr.cpython-35.opt-1.pyc



��Yf�4�@sdZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
ddlmZddddgZ
iZGd	d�d�ZGd
d�d�Zddd�Zddd�Zdd
d�Zdd�Zdd�Zdd�Zedkre�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)�
itemgetter�
readmodule�
readmodule_ex�Class�Functioncs4eZdZdZ�fdd�Zdd�Z�S)rz"Class to represent a Python class.csL||_||_|dkr$g}||_i|_||_||_dS)N)�module�name�super�methods�file�lineno)�selfr
rrrr)�	__class__��+/opt/alt/python35/lib64/python3.5/pyclbr.py�__init__9s					zClass.__init__cCs||j|<dS)N)r
)rrrrrr�
_addmethodCszClass._addmethod)�__name__�
__module__�__qualname__�__doc__rrrr)rrr7s
c@s"eZdZdZdd�ZdS)r	z.Class to represent a top-level Python functioncCs(||_||_||_||_dS)N)r
rrr)rr
rrrrrrrHs			zFunction.__init__N)rrrrrrrrrr	FscCsOi}xBt||pg�j�D]%\}}t|t�r"|||<q"W|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�valuerrrrNs
(cCst||pg�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
rrrrrZsc&!Cs(|dk	rd||f}n|}|tkr9t|Si}|tjkrh|dkrh|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	rm|j|d<y&|jj
|�}|dkr�|SWnttfk
r�|SYnX|jj|�}
tj|�}	g}tj|	j�}yx|D]\}}}}}|tkrM|\}}x�|rI|dd|krI|d=q%Wq�|dkr |\}}x%|r�|dd|kr�|d=qhWt|�dd	�\}}}|tkr�q�|r�|dd}t|t�r
|j||�nt|||
|�||<|jd|f�q�|d
krt|\}}x%|r_|dd|kr_|d=q;Wt|�dd	�\}}}|tkr�q�t|�dd	�\}}}d}|dkr6g}d}g}x\t|�dd	�\}}}|dkr�|dkr�dj|�}||kr3||}na|jd�}t|�dkr�|d} |d}| tkr�t| }!||!kr�|!|}|j|�g}|dkr�|d7}q�|dkr�|d8}|dkr,Pq�|d
kr|dkrq�|tt fkr�|dkr�|j|�q�W|}t||||
|�}|s^|||<|j||f�q�|dkr|ddkrt!|�}"xa|"D]m\}#}$yV|dkr�t|#|�n6yt|#||�Wntk
rt|#g�YnXWq�Yq�Xq�Wq�|dkr�|ddkr�t"|�\}#}|#s�|dkr[q�t!|�}yt|#||�}!Wnw�YnXxr|D]j\}}%||!kr�|!|||%p�|<q�|dkr�x,|!D]$}|ddkr�|!|||<q�Wq�Wq�WWnt#k
rYnX|	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_classZ
class_nameZinherit�names�levelr�n�c�m�d�modules�modZ_mod2Zn2rrrrcs	
	


		












rcCs�g}x�t|�\}}|s"P|dkrCt|�\}}nd}|j||f�x,|dkr�d|kr�t|�d}q_W|dkr	Pq	W|S)N�asr)�
r")rKrFrE)rVr[rrXZname2rrrrJ!srJcCs�g}t|�dd�\}}|tkrD|dkrDd|fS|j|�xct|�dd�\}}|dkr}Pt|�dd�\}}|tkr�P|j|�qTWdj|�|fS)Nrr+r.r!)rErrFrG)rV�partsrWrXrrrrK5s

rKc	Cssddl}tjd}|jj|�rz|jj|�g}|jj|�}|j�jd�r�|dd�}ng}t	||�}t
|j��}|jddd��x�|D]�}t
|t�rFtd|j|j|j�t|jj�dtd��}xX|D](\}}|d	krtd
||�qWq�t
|t�r�td|j|j�q�WdS)
Nrr"z.pyr%rcSst|dd�S)Nrr)�getattr)�arrr�<lambda>Usz_main.<locals>.<lambda>r&r#z  defr$���)�osr3�argvr�exists�dirname�basename�lower�endswithr�list�values�sortrr�printrrr�sortedr
rrr	)	rjrbrrNZobjs�objr
rrrrr�_mainHs(

!rw�__main__)rr@rjr3�importlib.utilr8rBrXrrr�operatorr�__all__r2rr	rrrrJrKrwrrrrr�<module>(s&	�