AlkantarClanX12

Your IP : 3.22.42.189


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/pyclbr.cpython-312.pyc

�

�Q�f�,����dZddlZddlZddlZgd�ZiZGd�d�ZGd�de�ZGd�d	e�Z	dd
�Z
dd�Zdd�Zdd
�Z
dd�ZGd�dej�Zd�Zd�Zedk(re�yy)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�Zy)�_Objectz+Information about Python class or function.c��||_||_||_||_||_||_i|_|�||j|<yy�N)�module�name�file�lineno�
end_lineno�parent�children)�selfrrr
rrrs       �-/opt/alt/python312/lib64/python3.12/pyclbr.py�__init__z_Object.__init__7sL�������	���	����$��������
���$(�F�O�O�D�!��N)�__name__�
__module__�__qualname__�__doc__r�rrrr5s
��1�	)rrc�,��eZdZdZ	ddd��fd�Z�xZS)rz7Information about a Python function, including methods.N�rc�|��t�|�||||||�||_t|t�r||j
|<yyr
)�superr�is_async�
isinstancer�methods)	rrrr
rrrr�	__class__s	        �rrzFunction.__init__Fs>���
�����t�V�Z��H� ��
��f�e�$�#)�F�N�N�4� �%r)NF�rrrrr�
__classcell__�r"s@rrrDs���=�',�*�<@�*�*rrc�,��eZdZdZ	ddd��fd�Z�xZS)rz!Information about a Python class.Nrc�R��t�|�||||||�|xsg|_i|_yr
)rrr!)	rrr�super_r
rrrr"s	        �rrzClass.__init__Ps,���
�����t�V�Z��H��\�r��
���rr
r#r%s@rrrNs���'���,0��rrc	�N�t|j||j||||��S)z*Return a Function after nesting within ob.)rrr)rrr
)�ob�	func_namerrrs     r�_nest_functionr,Ys(���B�I�I�y�"�'�'�6���Z�I�Irc	�N�t|j|||j|||��S)z'Return a Class after nesting within ob.�rr)rrr
)r*�
class_namerrrs     r�_nest_classr0^s&������J��r�w�w���z�3�3rc��i}t||xsg�j�D]\}}t|t�s�|||<�|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     rrrdsE��
�C�!�&�$�*�"�5�;�;�=�
��U��e�U�#��C��H�>��Jrc�"�t||xsg�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���|�|�d|��}n|}|tvr	t|Si}|tjvr
|�|t|<|S|jd�}|dk\rQ|d|}||dzd}t	|||�}|�|�d|��}d|vrtdj
|���t	||d|�Sd}	|�|}
n|tjz}
tjj||
�}|�td|��|���|t|<|j�|j|d<	|jj|�}|�|S|jj!|�}
t#|||
|||�S#tt
f$r|cYSwxYw)	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�2�
��
��X���
�#�#��D���)�)�)�i�.?�������	���S��A��A�v���!�*���1�Q�3�4�L�	��W�d�I�6��� �!*�G�4�G��V�#��3�:�:�7�C�D�D��9�f�Z�&8�'�B�B�	
�A������S�X�X�o���>�>�.�.�z�;�G�D��|�!�$4�Z�N�"C�*�U�U��H�Z���&�&�2��:�:��Z������'�'�
�3��
�>��K��K�K�$�$�Z�0�E��
�D�%���y�I�I��
�K�(�����s�E!�!E5�4E5c�6�eZdZd�Zd�Zdd�d�Zd�Zd�Zd�Zy	)
�_ModuleBrowserc�X�||_||_||_||_||_g|_yr
)r4rOr
rrM�stack)rrr4r
rOrMs      rrz_ModuleBrowser.__init__�s,����	���	���	����"�����
rc	��g}|jD]�}tj|�}||jvr|j	|j|��Et|j
d�x}�dkDr8|�^}}}|tvs�s|j	t|j||����|j	|���|jr|jdnd}	t|j|j||j|j|	|j��}|	�||j|j<|jj	|�|j!|�|jj#�y)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�s'�����J�J�D��;�;�t�$�D��t�y�y� ����T�Y�Y�t�_�-��d�j�j��o�-�U�.��2�&+�"��F�F��X�%��L�L��&�!1�!5�!5�f�d�!C�D����T�"��$(�:�:����B��4���t�{�{�D�I�I�u�d�i�i����$����B���>�#)�D�I�I�d�i�i� ��
�
���&�!����4� ��
�
���rF�rc	��|jr|jdnd}t|j|j|j|j
|||j��}|�||j|j<|jj|�|j|�|jj�y)Nr]r)r[rrrr
rrrOrarerf)rrgrr�functions     r�visit_FunctionDefz _ModuleBrowser.visit_FunctionDef�s���#'�:�:����B��4���D�K�K����D�I�I�t�{�{�"�H����J���>�#+�D�I�I�d�i�i� ��
�
���(�#����4� ��
�
���rc�*�|j|d��y)NTrm)rp)rrgs  r�visit_AsyncFunctionDefz%_ModuleBrowser.visit_AsyncFunctionDef�s�����t�d��3rc��|jdk7ry|jD]/}		t|j|j|j
��1y#t$rt|jg�Y�$wxYw#ttf$rY�iwxYw)Nr)�
col_offsetrir2rr4rMrA�SyntaxError)rrgrs   r�visit_Importz_ModuleBrowser.visit_Import�sy���?�?�a����j�j�F�
�1�����T�Y�Y����G��!��#�1�����R�0�1����-�
��
�s)�+A�A2�/A5�1A2�2A5�5B�Bc� �|jdk7ry	d|jz}|jr||jz
}t||j|j
�}|jD]�}|j|vr5||j|j|jxs|j<�F|jdk(s�V|j�D]&\}}|jd�r�||j|<�(��y#ttf$rYywxYw)Nrr:�*rj)rt�levelrr2r4rMrArurirrO�asnamer3�
startswith)rrgrr�import_name�import_values      r�visit_ImportFromz_ModuleBrowser.visit_ImportFrom�s����?�?�a���	��4�:�:�%�F��{�{��$�+�+�%�� �����D�N�N�C�F��J�J�D��y�y�F�"�6<�T�Y�Y�6G��	�	�$�+�+�2����3����c�!�17����-�K��"�-�-�c�2� �-9�D�I�I�k�*�2@�	���[�)�	��	�s�AC;�;D
�D
N)	rrrrrlrprrrvr~rrrrYrY�s%����238��4�
�:rrYc��t|||||�}|jtj|��|jSr
)rY�visitr_�parserO)rNr4rWrVrOrM�mbrowsers       rrLrL
s3���j�$��t�Y�G�H��N�N�3�9�9�V�$�%��=�=�rc�$�ddl}	tjd}|jj|�r\|jj
|�g}|jj|�}|j�jd�r|dd}ng}t||�}d�}t|j�|d��}d	}|�rA|j�}t|t�r�$t!|d
�sd|_t|t$�rRt|j&j�|d��}|D]}	|j"|z|	_�|j)|�t|t*�rIt-dj/d|j"z|j0|j2|j4��nMt|t6�r=t-d
j/d|j"z|j0|j4��|r��@yy#t}Y���xYw)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��2rT)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���
���h�h�q�k��
�w�w�~�~�c��������$�%���g�g���s�#���9�9�;����&��c�r�(�C�����d�#�D�2�J��$�+�+�-�Z��>�D��L�
��h�h�j���c�4� ���s�H�%��C�J��c�7�#��c�l�l�1�1�3�",�d�<�H����J�J��5��	���K�K��!��c�5�!��$��6�#��
�
�*�C�H�H�c�i�i����L�
N�
��X�
&��-�&�&�s�S�Z�Z�'7����3�:�:�N�O�%�����s�H�H�__main__)Fr
)rr_r>�importlib.utilrC�__all__r=rrrr,r0rrr2�NodeVisitorrYrLr�rrrr�<module>r�s���)�V�
��
>��
��)�)�*�w�*��G��I�
3�
�+�=J�@P:�S�_�_�P:�f�$P�L�z��	�G�r