OwlCyberSecurity - MANAGER
Edit File: inspector.cpython-311.pyc
� ������h�:���������������������������d�Z�ddlmZ�ddlZddlZddlZddlZddlmZm Z �ddl mZ�ddlm Z mZmZ�ddlZddlmZmZ�ddlmZ�dd lmZ�eeegej��������f���������egeej�����������������f���������Zd,d�Zd-d�Z�G�d��d������������Z�G�d��d������������Z�G�d��deej��������������������Z�G�d��de������������Z �G�d��de ������������Z!�G�d��d e!������������Z"�G�d!��d"e!������������Z#ed#ej$��������fd.d+�Z%dS�)/z|Visitor doing some post-processing on the astroid tree. Try to resolve definitions (namespace) dictionary, relationship... �����)�annotationsN)�ABC�abstractmethod)� Generator)�Any�Callable�Optional)�nodes�util)� constants)�utils�func�Callable[[str], nodes.Module]�modname�str�return�nodes.Module | Nonec�����������������������t����������d|��d�������������� ��|�|������������S�#�t����������j��������j��������$�r}t����������|�������������Y�d�}~n&d�}~wt����������$�r�t����������j�����������������������Y�nw�xY�wd�S�)Nzparsing z...)�print�astroid� exceptions�AstroidBuildingException� Exception� traceback� print_exc)r���r����excs��� �k/builddir/build/BUILD/cloudlinux-venv-1.0.8/venv/lib/python3.11/site-packages/pylint/pyreverse/inspector.py�_astroid_wrapperr������s�������� � !�W� !� !� !�"�"�"���t�G�}�}�����6������� �c� � � � � � � � ������������������������4s���� ��A+�A� A+�*A+�node�nodes.ClassDef�Generator[Any, None, None]c��������������#������K���� �t�����������j�����������������������������|����������������������������������d������������d���������}n#�t�����������j��������j��������$�r�Y�dS�w�xY�w|���������������������d�������������|�urdS�t������������������������}d}t����������j ��������|������������D�]<}t����������|t����������j��������������������rd}�||vr|� ��������������������|�������������|V����=|rt�����������j��������������������������������������������dS�)zEReturn an iterator on interfaces implemented by the given class node.�__implements__r���NT��futureF)r����bases�Instance�getattrr���� NotFoundError�frame�setr ����unpack_infer� isinstancer����UninferableBase�add�InferenceError)r���� implements�found�missing�ifaces��� r���� interfacesr5���*���s�����������]�+�+�D�1�1�9�9�:J�K�K�A�N� � ����+�����������������t��$�$�D�0�0����E�E�E��G��#�J�/�/�������e�T�1�2�2�� ��G�������I�I�e�����K�K�K����2�� �/�/�1�1�1�2��2s����8=��A�Ac�������������������.�����e�Zd�ZdZddd�Zddd�Zd d �Zd S�)�IdGeneratorMixInz1Mixin adding the ability to generate integer uid.r����start_value�intr����Nonec����������������������||�_���������d�S��N��id_count��selfr8���s��� r����__init__zIdGeneratorMixIn.__init__B���s ������#�� � � �����c����������������������||�_���������dS�)zInit the id counter.Nr=���r?���s��� r����init_counterzIdGeneratorMixIn.init_counterE���s ������#�� � � rB���c�����������������0�����|�xj���������dz ��c_���������|�j���������S�)zGenerate a new identifier.����r=����r@���s��� r����generate_idzIdGeneratorMixIn.generate_idI���s������� � ��� � ��}�rB���N)r���)r8���r9���r���r:���)r���r9���)�__name__� __module__�__qualname__�__doc__rA���rD���rH�����rB���r���r7���r7���?���s`��������������;�;�$��$��$��$��$�$��$��$��$��$�����������rB���r7���c�������������������<�����e�Zd�ZdZddd�Zdd �Zdd�Zdd �Zdd�ZdS�)�Projectz-A project handle a set of modules / packages.���namer���c����������������������||�_���������d�|�_��������d|�_��������g�|�_��������i�|�_��������|�j��������j��������|�_��������|�j��������j��������|�_��������|�j��������j��������|�_��������|�j��������j��������|�_��������|�j��������j ��������|�_ ��������d�S�)NrP���) rQ����uid�path�modules�locals�__getitem__�__iter__�values�keys�items�r@���rQ���s��� r���rA���zProject.__init__R���sf�������� �#����� �+-���/1����;�2�����,�� ��k�(����K�$�� ��[�&�� � � rB���r����nodes.Moduler���r:���c�����������������X�����||�j���������|j��������<���|�j�����������������������������|�������������d�S�r<���)rV���rQ���rU����append�r@���r���s��� r���� add_modulezProject.add_module^���s,������!%���D�I������D�!�!�!�!�!rB���c����������������������|�j���������|���������S�r<���)rV���r\���s��� r���� get_modulezProject.get_moduleb���s�������{�4� � rB����list[nodes.Module]c����������������������|�j���������S�r<���)rU���rG���s��� r����get_childrenzProject.get_childrene���s �������|�rB���c�����������������b�����d|�j����������dt����������|���������������dt����������|�j����������������������d�S�)Nz <Project z at z (z modules)>)rQ����id�lenrU���rG���s��� r����__repr__zProject.__repr__h���s5������U�4�9�U�U�B�t�H�H�U�U��D�L�8I�8I�U�U�U�UrB���N)rP���)rQ���r����r���r]���r���r:���)rQ���r���r���r]���)r���rd���)r���r���) rI���rJ���rK���rL���rA���ra���rc���rf���rj���rM���rB���r���rO���rO���O���s���������������7�7� '�� '�� '�� '�� '�"��"��"��"�!��!��!��!��������V��V��V��V��V��VrB���rO���c�������������������|�����e�Zd�ZdZd#d$d �Zd%d�Zd&d �Zd'd�Zd(d�Zd)d�Z e d*d���������������Zd+d�Zd,d�Z d-d�Zd.d!�Zd"S�)/�Linkera���Walk on the project tree and resolve relationships. According to options the following attributes may be added to visited nodes: * uid, a unique identifier for the node (on astroid.Project, astroid.Module, astroid.Class and astroid.locals_type). Only if the linker has been instantiated with tag=True parameter (False by default). * Function a mapping from locals names to their bounded value, which may be a constant like a string or an integer, or an astroid node (on astroid.Module, astroid.Class and astroid.Function). * instance_attrs_type as locals_type but for klass member attributes (only on astroid.Class) * associations_type as instance_attrs_type but for association relationships * aggregations_type as instance_attrs_type but for aggregations relationships * implements, list of implemented interface _objects_ (only on astroid.Class nodes) F�projectrO����tag�boolr���r:���c���������������������t��������������������������������|��������������t����������j�����������������������������|��������������||�_��������||�_��������t ������������������������|�_��������|�j�����������������������������t�������������������������������������d�S�r<���) r7���rA���r ���� LocalsVisitorro���rn����AggregationsHandler�associations_handler�set_next�OtherAssociationsHandler)r@���rn���ro���s��� r���rA���zLinker.__init__����sm�������!�!�$�'�'�'� ��$�$�T�*�*�*�������$7�$9�$9��!��!�*�*�+C�+E�+E�F�F�F�F�FrB���r���c����������������������|�j���������r|������������������������������������|_��������|j��������D�]}|����������������������|��������������dS�)zbVisit a pyreverse.utils.Project node. * optionally tag the node with a unique id N)ro���rH���rS���rU����visit)r@���r����modules��� r���� visit_projectzLinker.visit_project����sQ������ ��8�� *��'�'�)�)�D�H��l�� �� �F��J�J�v����� �� rB���r]���c����������������������t����������|d������������rdS�t����������j��������t����������������������|_��������g�|_��������|�j��������r|������������������������������������|_��������dS�dS�)z�Visit an astroid.Module node. * set the locals_type mapping * set the depends mapping * optionally tag the node with a unique id �locals_typeN) �hasattr�collections�defaultdict�listr|����dependsro���rH���rS���r`���s��� r����visit_modulezLinker.visit_module����s`��������4��'�'�� ��F�&�2�4�8�8�������8�� *��'�'�)�)�D�H�H�H� *�� *rB���r ���c���������������������t����������|d������������rdS�t����������j��������t����������������������|_��������|�j��������r|������������������������������������|_��������|���������������������d�������������D�]/}t����������|dg�������������}|� ��������������������|�������������||_���������0t����������j��������t����������������������|_��������t����������j��������t����������������������|_ ��������t����������j��������t����������������������|_��������t����������|j�������������������������������������������������������D�]R}|D�]M}t%����������|t&����������j��������������������s1|�j�����������������������������||�������������|����������������������||��������������N�S �t1����������|������������}|�9t����������|������������|_��������|j��������rt5����������j��������dt8�����������������������dS�dS�g�|_��������dS�#�t:����������j��������$�r�g�|_��������Y�dS�w�xY�w)z�Visit an astroid.Class node. * set the locals_type and instance_attrs_type mappings * set the implements list and build it * optionally tag the node with a unique id r|���NF)�recurs�specializationsz�pyreverse will drop support for resolving and displaying implemented interfaces in pylint 3.0. The implementation relies on the '__implements__' attribute proposed in PEP 245, which was rejected in 2006.)r}���r~���r���r����r|���ro���rH���rS���� ancestorsr(���r_���r�����instance_attrs_type�aggregations_type�associations_type�tuple�instance_attrsrY���r-���r ����Unknownrt����handle�handle_assignattr_typer5���r1����warnings�warn�DeprecationWarningr���r0���)r@���r����baseobjr�����assignattrs� assignattr�ifacess��� r����visit_classdefzLinker.visit_classdef����s��������4��'�'�� ��F�&�2�4�8�8����8�� *��'�'�)�)�D�H��~�~�U�~�3�3�� 6�� 6�G�%�g�/@�"�E�E�O��"�"�4�(�(�(�&5�G�#�#�#.�#:�4�#@�#@�� �!,�!8��!>�!>���!,�!8��!>�!>��� ��!4�!;�!;�!=�!=�>�>�� B�� B�K�)�� B�� B� �!�*�e�m�<�<��B��-�4�4�Z��F�F�F��/�/� �D�A�A�A�� B� !���%�%�F��!�"&�v�,�,����?����M�8��+��������������#%�������%�� !�� !�� !� �D�O�O�O�O� !���s����+AF>��5F>��>G�G�nodes.FunctionDefc����������������������t����������|d������������rdS�t����������j��������t����������������������|_��������|�j��������r|������������������������������������|_��������dS�dS�)z�Visit an astroid.Function node. * set the locals_type mapping * optionally tag the node with a unique id r|���N)r}���r~���r���r����r|���ro���rH���rS���r`���s��� r����visit_functiondefzLinker.visit_functiondef����sY��������4��'�'�� ��F�&�2�4�8�8����8�� *��'�'�)�)�D�H�H�H� *�� *rB����nodes.AssignNamec�����������������r����t����������|d������������rdS�d|_��������|j��������|���������������������d�������������v�r|���������������������d�������������}n|�����������������������������������}t����������|d������������sut����������|t����������j��������������������r|����������������������|�������������nEt����������|t����������j ��������������������r|�� ��������������������|�������������n|����������������������|�������������|j��������|j�����������������}t����������t����������|������������t����������j��������|������������z��������������|j��������|j��������<���dS�)zFVisit an astroid.AssignName node. handle locals_type �_handledNTr$���r|���)r}���r����rQ���r*����rootr-���r ����ClassDefr�����FunctionDefr����r����r|���r����r+���r ���� infer_node)r@���r���r*����currents��� r����visit_assignnamezLinker.visit_assignname����s"�������4��$�$�� ��F��� ��9�� � �$� �/�/�/�/��J�J�d�J�+�+�E�E���I�I�K�K�E��u�m�,�,�� )���%���0�0�� )��#�#�E�*�*�*�*��E�5�#4�5�5�� )��&�&�u�-�-�-�-��!�!�%�(�(�(��#�D�I�.��'+�C��L�L�5�;K�D�;Q�;Q�,Q�'R�'R���$�)�$�$�$rB����nodes.AssignAttr�parentc����������������������t����������|j��������|�j�����������������������������}t����������|t ����������j��������|�������������z��������������|j��������|�j��������<���dS�)zOHandle an astroid.assignattr node. handle instance_attrs_type N)r+���r�����attrnamer����r ���r����)r���r����r����s��� r���r����zLinker.handle_assignattr_type��sM��������f�0���?�@�@��48��e�&�t�,�,�,�5 ��5 ��"�4�=�1�1�1rB����nodes.Importc�����������������������|������������������������������������j��������}|j��������D�]E}t����������j�����������������������������|d���������|������������}|����������������������||d���������|��������������FdS�)zKVisit an astroid.Import node. resolve module dependencies r���N)r�����file�namesr����modutils�is_relative�_imported_module)r@���r����context_filerQ����relatives��� r����visit_importzLinker.visit_import ��sj������ ��y�y�{�{�'���J�� ;�� ;�D��'�3�3�D��G�\�J�J�H��!�!�$��Q���:�:�:�:� ;�� ;rB����nodes.ImportFromc���������������������|j���������}|�����������������������������������j��������}|�!t����������j�����������������������������||������������}nd}|j��������D�]�}|d���������dk����r�|��d|d������������}|���������������������d������������dk����r2 �t����������j�����������������������������||������������}n#�t����������$�r�Y��cw�xY�w||k����r|�� ��������������������|||���������������dS�)zOVisit an astroid.ImportFrom node. resolve module dependencies NFr����*�.���)r���r����r����r���r����r����r�����find�get_module_part�ImportErrorr����)r@���r����basenamer����r����rQ����fullnames��� r����visit_importfromzLinker.visit_importfrom��s������ ��<���y�y�{�{�'���#��'�3�3�H�l�K�K�H�H��H��J�� @�� @�D��A�w�#�~�~��"�.�.�T�!�W�.�.�H��}�}�S�!�!�B�&�&��&�/�?�?��,�W�W�H�H��"��������H������8�#�#��%�%�d�H�h�?�?�?�� @�� @s���� B$�$ B1�0B1�context_namer����mod_pathc����������������������t�����������j�����������������������������|�j��������j��������������������}||k����rdS�t����������j�����������������������������||f������������S�)z,Should the module be added to dependencies ?F)�osrT����dirnamern���r���r�����module_in_path)r@���r����r�����package_dirs��� r����compute_modulezLinker.compute_module/��sG�������g�o�o�d�l�&7�8�8���8�#�#��5����.�.�x�+��H�H�HrB����nodes.Import | nodes.ImportFromr����c�����������������L����|������������������������������������}|j��������}|r5d���������������������|���������������������d������������dd������������������������d|���}|����������������������||������������r9t����������|d������������sg�|_��������|j��������}||vr|���������������������|�������������dS�dS�dS�)z8Notify an imported module, used to analyze dependencies.r����Nr����r����)r����rQ����join�splitr����r}���r����r_���)r@���r���r����r����ry���r����� mod_pathss��� r���r����zLinker._imported_module8��s���������������{���� N��(�(�<�#5�#5�c�#:�#:�3�B�3�#?�@�@�M�M�8�M�M�H����|�X�6�6�� +��6�9�-�-�� $�!#�����I��y�(�(�� � ��*�*�*�*�*� +�� +� �)�(rB���N)F)rn���rO���ro���rp���r���r:���)r���rO���r���r:���rk���)r���r ���r���r:���)r���r����r���r:���)r���r����r���r:����r���r����r����r ���r���r:���)r���r����r���r:���)r���r����r���r:���)r����r���r����r���r���rp���)r���r����r����r���r����rp���r���r:���)rI���rJ���rK���rL���rA���rz���r����r����r����r�����staticmethodr����r����r����r����r����rM���rB���r���rm���rm���l���s����������������8G��G��G��G��G��������*��*��*��*�+!��+!��+!��+!�Z *�� *�� *�� *�S��S��S��S�<�� �� �� ���\� �;��;��;��;�@��@��@��@�0I��I��I��I�+��+��+��+��+��+rB���rm���c�������������������>�����e�Zd�Zedd���������������Zedd ���������������Zd S�) �AssociationHandlerInterface�handlerr���c����������������������d�S�r<���rM����r@���r����s��� r���ru���z$AssociationHandlerInterface.set_nextJ��s ������� �rB���r���r����r����r ���r:���c����������������������d�S�r<���rM����r@���r���r����s��� r���r����z"AssociationHandlerInterface.handleP��s�������rB���N�r����r����r���r����r����)rI���rJ���rK���r���ru���r����rM���rB���r���r����r����I��sR��������������� �� �� ���^� � �� �� �� ���^� �� �� rB���r����c�������������������>�����e�Zd�ZU�dZded<���dd�Zedd���������������Zd S�)�AbstractAssociationHandlera��� Chain of Responsibility for handling types of association, useful to expand in the future if we want to add more distinct associations. Every link of the chain checks if it's a certain type of association. If no association is found it's set as a generic association in `associations_type`. The default chaining behavior is implemented inside the base handler class. r����� _next_handlerr����r���c����������������������||�_���������|S�r<���)r����r����s��� r���ru���z#AbstractAssociationHandler.set_nextc��s�������%����rB���r���r����r����r ���r:���c�����������������N�����|�j���������r|�j������������������������������||�������������d�S�d�S�r<���)r����r����r����s��� r���r����z!AbstractAssociationHandler.handlei��s6��������� 4���%�%�d�F�3�3�3�3�3� 4�� 4rB���Nr����r����)rI���rJ���rK���rL����__annotations__ru���r���r����rM���rB���r���r����r����U��sb���������������� �� ��/�.�.�.����������4��4��4���^�4��4��4rB���r����c������������������� �������e�Zd�Zd��fd�Z��xZS�) rs���r���r����r����r ���r���r:���c����������������������t����������|j��������t����������j��������t����������j��������f������������r{t����������|j��������j��������t����������j��������j��������������������rRt����������|j ��������|j�����������������������������}t����������|t����������j��������|������������z��������������|j ��������|j��������<���d�S�t���������������������������������������������||�������������d�S�r<���)r-���r����r ���� AnnAssign�Assign�valuer����node_classes�Namer+���r����r����r����r ���r�����superr����)r@���r���r����r����� __class__s��� �r���r����zAggregationsHandler.handlep��s���������d�k�E�O�U�\�#B�C�C�� )� ��K��w�3�8�I ��I �� )���&�2�4�=�A�B�B�G�6:��%�*�4�0�0�0�7��7�F�$�T�]�3�3�3�� �G�G�N�N�4��(�(�(�(�(rB���r����)rI���rJ���rK���r����� __classcell__)r����s���@r���rs���rs���o��s=��������������� )�� )�� )�� )�� )�� )�� )�� )�� )�� )rB���rs���c������������������������e�Zd�Zd d�ZdS�) rv���r���r����r����r ���r���r:���c����������������������t����������|j��������|j�����������������������������}t����������|t ����������j��������|������������z��������������|j��������|j��������<���d�S�r<���)r+���r����r����r����r ���r����)r@���r���r����r����s��� r���r����zOtherAssociationsHandler.handle}��sG�������f�.�t�}�=�>�>��26�w��AQ�RV�AW�AW�7W�2X�2X�� ���/�/�/rB���Nr����)rI���rJ���rK���r����rM���rB���r���rv���rv���|��s.��������������Y��Y��Y��Y��Y��YrB���rv���zno name�files� list[str]�func_wrapper� _WrapperFuncT�project_name� black_list�tuple[str, ...]c�����������������*����t�����������j��������}t����������|������������}|�D��]s}t����������j�����������������������������|������������s3t�����������j�����������������������������|���������������������d������������������������}nBt����������j��������� ��������������������|������������r!t����������j��������� ��������������������|d������������}n|}�||j��������|������������}|���|j��������p|j��������|_��������|� ��������������������|�������������|j��������} |j��������r�|���������������������d������������dk����ryt�����������j�����������������������������t����������j�����������������������������|j��������������������|������������D�]6}�||j��������|������������}|�|j��������| k����r�!|� ��������������������|��������������7��u|S�)z1Return a Project from a list of files or modules.r����z__init__.pyNrA���r����)r����MANAGERrO���r����rT����existsr�����file_from_modpathr�����isdirr����� ast_from_filer����ra���rQ����packager�����get_module_filesr����) r����r����r����r�����astroid_managerrn���� something�fpath�ast� base_names ��� r����project_from_filesr�������sx�������o�O��l�#�#�G���(��(� ��w�~�~�i�(�(�� ��$�6�6�y���s�7K�7K�L�L�E�E� �W�]�]�9� %� %�� ��G�L�L��M�:�:�E�E��E��l�?�8�%�@�@���;���|�/�s�x������3�����H� ��;�� (�9�>�>�*�5�5��;�;� �)�:�:�������)�)�:����� (�� (���#�l�?�#@�%�H�H���;�#�(�i�"7�"7���"�"�3�'�'�'�'���NrB���)r���r���r���r���r���r���)r���r ���r���r!���) r����r����r����r����r����r���r����r����r���rO���)&rL���� __future__r���r~���r����r���r�����abcr���r����collections.abcr����typingr���r���r ���r���r ���r����pylintr����pylint.pyreverser ���r����Moduler����r���r5���r7���rO���rr���rm���r����r����rs���rv����DEFAULT_IGNORE_LISTr����rM���rB���r����<module>r�����s����� ��� �#��"��"��"��"��"���������� � � � ���������������#��#��#��#��#��#��#��#��%��%��%��%��%��%��*��*��*��*��*��*��*��*��*��*�����������������������������������"��"��"��"��"��"��(�C�5�%�,�#6�7��=�x���?U�U�V� � �� �� �� �2��2��2��2�* �� �� �� �� �� �� �� � V��V��V��V��V��V��V��V�:Z+��Z+��Z+��Z+��Z+� �u�2��Z+��Z+��Z+�z �� �� �� �� �#�� �� �� �4��4��4��4��4�!<��4��4��4�4 )�� )�� )�� )�� )�4�� )�� )�� )�Y��Y��Y��Y��Y�9��Y��Y��Y��#3�!�"+�"?� !��!��!��!��!��!��!rB���