AlkantarClanX12

Your IP : 3.15.211.71


Current Path : /proc/self/root/opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python311/lib64/python3.11/__pycache__/pyclbr.cpython-311.opt-1.pyc

�

c��f�,���dZddlZddlZddlZgd�ZiZGd�d��ZGd�de��ZGd�d	e��Z	dd�Z
dd�Zdd
�Zdd�Z
dd�ZGd�dej��Zd�Zd�Zedkre��dSdS)aParse a Python module and describe its classes and functions.

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

The interface consists of a single function:
    readmodule_ex(module, path=None)
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 and functions defined in the module (including classes that are
defined via the from XXX import YYY construct).  The values are
instances of classes Class and Function.  One special key/value pair is
present for packages: the key '__path__' has a list as its value which
contains the package search path.

Classes and Functions have a common superclass: _Object.  Every instance
has the following attributes:
    module  -- name of the module;
    name    -- name of the object;
    file    -- file in which the object is defined;
    lineno  -- line in the file where the object's definition starts;
    end_lineno -- line in the file where the object's definition ends;
    parent  -- parent of this object, if any;
    children -- nested objects contained in this object.
The 'children' attribute is a dictionary mapping names to objects.

Instances of Function describe functions with the attributes from _Object,
plus the following:
    is_async -- if a function is defined with an 'async' prefix

Instances of Class describe classes with the attributes from _Object,
plus the following:
    super   -- list of super classes (Class instances if possible);
    methods -- mapping of method names to beginning line numbers.
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.
�N)�
readmodule�
readmodule_ex�Class�Functionc��eZdZdZd�ZdS)�_Objectz+Information about Python class or function.c��||_||_||_||_||_||_i|_|�||j|<dSdS�N)�module�name�file�lineno�
end_lineno�parent�children)�selfrrr
rrrs       �-/opt/alt/python311/lib64/python3.11/pyclbr.py�__init__z_Object.__init__7sS�������	���	����$��������
���$(�F�O�D�!�!�!���N)�__name__�
__module__�__qualname__�__doc__r�rrrr5s)������1�1�	)�	)�	)�	)�	)rrc�,��eZdZdZ	ddd��fd�Z�xZS)rz7Information about a Python function, including methods.NF�rc���t���||||||��||_t|t��r||j|<dSdSr
)�superr�is_async�
isinstancer�methods)	rrrr
rrrr�	__class__s	        �rrzFunction.__init__FsZ���
�������t�V�Z��H�H�H� ��
��f�e�$�$�	*�#)�F�N�4� � � �	*�	*r)NF�rrrrr�
__classcell__�r"s@rrrDsS�������=�=�',�*�<@�*�*�*�*�*�*�*�*�*�*�*rrc�,��eZdZdZ	ddd��fd�Z�xZS)rz!Information about a Python class.Nrc�t��t���||||||��|pg|_i|_dSr
)rrr!)	rrr�super_r
rrrr"s	        �rrzClass.__init__Ps;���
�������t�V�Z��H�H�H��\�r��
�����rr
r#r%s@rrrNsS�������'�'���,0�����������rrFc	�B�t|j||j||||���S)z*Return a Function after nesting within ob.)rrr)rrr
)�ob�	func_namerrrs     r�_nest_functionr,Ys0���B�I�y�"�'�6���Z�I�I�I�Irc	�B�t|j|||j|||���S)z'Return a Class after nesting within ob.�rr)rrr
)r*�
class_namerrrs     r�_nest_classr0^s,�����J��r�w���z�3�3�3�3rc��i}t||pg�����D]\}}t|t��r|||<� |S)z�Return Class objects for the top-level classes in module.

    This is the original interface, before Functions were added.
    )�_readmodule�itemsr r)r�path�res�key�values     rrrdsW��
�C�!�&�$�*�"�5�5�;�;�=�=���
��U��e�U�#�#�	��C��H���Jrc�&�t||pg��S)z�Return a dictionary with all functions and classes in module.

    Search for module in PATH + sys.path.
    If possible, include imported superclasses.
    Do this by reading source, without importing (and executing) it.
    )r2)rr4s  rrrps���v�t�z�r�*�*�*rc�0�|�|�d|��}n|}|tvr
t|Si}|tjvr|�|t|<|S|�d��}|dkrn|d|�}||dzd�}t	|||��}|�|�d|��}d|vr"td�|�����t	||d|��Sd}	|�|}
n|tjz}
tj	�
||
��}|�td|��|����|t|<|j�
|j|d<	|j
�|��}|�|Sn#tt
f$r|cYSwxYw|j
�|��}
t#|||
|||��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.
    N�.r��__path__zNo package named {}zno module named )r)�_modules�sys�builtin_module_names�rfindr2�ImportError�formatr4�	importlib�util�_find_spec_from_path�ModuleNotFoundError�submodule_search_locations�loader�
get_source�AttributeError�get_filename�_create_tree)rr4�	inpackage�
fullmodule�tree�i�package�	submoduler�f�search_path�spec�source�fnames              rr2r2zs���� )�	�	�6�6�2�
�
��
��X����
�#�#��D���)�)�)�i�.?�������	���S���A��A�v�v���!��*���1�Q�3�4�4�L�	��W�d�I�6�6��� �!*���G�G�4�G��V�#�#��3�:�:�7�C�C�D�D�D��9�f�Z�&8�'�B�B�B�	
�A�������S�X�o���>�.�.�z�;�G�G�D��|�!�"C�Z�"C�"C�*�U�U�U�U��H�Z���&�2��:��Z�����'�'�
�3�3��
�>��K���	
�K�(������������
�K�$�$�Z�0�0�E��
�D�%���y�I�I�Is�2E�E'�&E'c�8�eZdZd�Zd�Zdd�d�Zd�Zd�Zd�Zd	S)
�_ModuleBrowserc�Z�||_||_||_||_||_g|_dSr
)r4rOr
rrM�stack)rrr4r
rOrMs      rrz_ModuleBrowser.__init__�s0����	���	���	����"�����
�
�
rc	���g}|jD]�}tj|��}||jvr!|�|j|���@t|�d��x}��dkrD|�^}}}|tvr4|�t|�||������|�|����|j	r
|j	dnd}	t|j|j||j
|j|	|j���}|	�||j|j<|j	�|��|�|��|j	���dS)Nr:r;���r.)�bases�ast�unparserO�append�len�splitr=�getr[rrrr
rr�
generic_visit�pop)
r�noder^�baser�names�_r�class_rs
          r�visit_ClassDefz_ModuleBrowser.visit_ClassDef�sb�����J�	#�	#�D��;�t�$�$�D��t�y� � ����T�Y�t�_�-�-�-�-��d�j�j��o�o�-�U�.�.��2�2�&+�"��F�F��X�%�%��L�L��&�!1�!5�!5�f�d�!C�!C�D�D�D�����T�"�"�"�"�#'�:�7���B���4���t�{�D�I�u�d�i���$���B�B�B���>�#)�D�I�d�i� ��
���&�!�!�!����4� � � ��
�������rF�rc	�B�|jr
|jdnd}t|j|j|j|j|||j���}|�||j|j<|j�|��|�	|��|j�
��dS)Nr]r)r[rrrr
rrrOrarerf)rrgrr�functions     r�visit_FunctionDefz _ModuleBrowser.visit_FunctionDef�s���#'�:�7���B���4���D�K���D�I�t�{�"�H���J�J�J���>�#+�D�I�d�i� ��
���(�#�#�#����4� � � ��
�������rc�4�|�|d���dS)NTrm)rp)rrgs  r�visit_AsyncFunctionDefz%_ModuleBrowser.visit_AsyncFunctionDef�s!�����t�d��3�3�3�3�3rc���|jdkrdS|jD]a}		t|j|j|j��n%#t$rt|jg��YnwxYw�K#ttf$rY�^wxYwdS)Nr)�
col_offsetrir2rr4rMrA�SyntaxError)rrgrs   r�visit_Importz_ModuleBrowser.visit_Import�s����?�a����F��j�		�		�F�
�1����T�Y���G�G�G�G��"�1�1�1����R�0�0�0�0�0�1��������-�
�
�
���
����
		�		s,� :�A �A�A �A�A � A4�3A4c��|jdkrdS	d|jz}|jr
||jz
}t||j|j��}n#ttf$rYdSwxYw|jD]r}|j	|vr"||j	|j
|jp|j	<�-|j	dkr:|���D]%\}}|�
d��r�||j
|<�&�sdS)Nrr:�*rj)rt�levelrr2r4rMrArurirrO�asnamer3�
startswith)rrgrr�import_name�import_values      r�visit_ImportFromz_ModuleBrowser.visit_ImportFrom�s���?�a����F�	��4�:�%�F��{�
&��$�+�%�� ����D�N�C�C�F�F���[�)�	�	�	��F�F�	�����J�	:�	:�D��y�F�"�"�6<�T�Y�6G��	�$�+�2���3�3���c�!�!�17�����:�:�-�K��"�-�-�c�2�2�!� �-9�D�I�k�*�*��	:�	:s�6A�A�AN)	rrrrrlrprrrvr~rrrrYrY�s}������������238������4�4�4�
�
�
�:�:�:�:�:rrYc��t|||||��}|�tj|����|jSr
)rY�visitr_�parserO)rNr4rWrVrOrM�mbrowsers       rrLrL
s;���j�$��t�Y�G�G�H��N�N�3�9�V�$�$�%�%�%��=�rc�d�ddl}	tjd}n#t}YnxYw|j�|��rg|j�|��g}|j�|��}|����	d��r
|dd�}ng}t||��}d�}t|���|d���}d	}|�rJ|�
��}t|t��r�-t!|d
��sd|_t|t$��rRt|j���|d���}|D]}	|j|z|	_�|�|��t|t*��r=t-d�d|jz|j|j|j����nKt|t6��r6t-d
�d|jz|j|j����|��HdSdS)z?Print module output (default this file) for quick visual check.rNr;z.py���c�$�t|dd��S)Nrr)�getattr)�as r�<lambda>z_main.<locals>.<lambda>"s��7�1�h��2�2�rT)r6�reverse��indentz{}class {} {} {}� z{}def {} {})�osr>�argv�__file__r4�exists�dirname�basename�lower�endswithr�sorted�valuesrfr �list�hasattrr�rr�extendr�printrBrrrr)
r��modr4rO�
lineno_key�objs�indent_level�obj�new_objsr*s
          r�_mainr�s;��
�I�I�I���h�q�k������������	�w�~�~�c���������$�$�%���g���s�#�#���9�9�;�;����&�&�	��c�r�c�(�C������d�#�#�D�2�2�J��$�+�+�-�-�Z��>�>�>�D��L�
�P��h�h�j�j���c�4� � �	���s�H�%�%�	��C�J��c�7�#�#�	"��c�l�1�1�3�3�",�d�<�<�<�H��
6�
6���J��5��	�	��K�K��!�!�!��c�5�!�!�	P��$��6�#��
�*�C�H�c�i���L�L�
N�
N�
N�
N�
��X�
&�
&�	P��-�&�&�s�S�Z�'7���3�:�N�N�O�O�O�%�P�P�P�P�Ps��	$�__main__)Fr
)rr_r>�importlib.utilrC�__all__r=rrrr,r0rrr2�NodeVisitorrYrLr�rrrr�<module>r�s���)�)�V�
�
�
�
�
�
�
�����
>�
>�
>��
��)�)�)�)�)�)�)�)�*�*�*�*�*�w�*�*�*������G����I�I�I�I�
3�3�3�3�
�
�
�
�+�+�+�+�=J�=J�=J�=J�@P:�P:�P:�P:�P:�S�_�P:�P:�P:�f���$P�$P�$P�L�z���	�E�G�G�G�G�G��r