← Back
Editing: getattr_static.cpython-311.pyc
� p�{c � �f � d Z ddlZddlmZ e� � Zd� Zd� Zd� Zd� Z d� Z d � Zd � Zefd�Z dS )z� A static version of getattr. This is a backport of the Python 3 code with a little bit of additional information returned to enable Jedi to make decisions. � N)�debugc � � i } t � | d� � }n# t $ r Y nw xY wt � ||t � � S �N�__dict__)�object�__getattribute__�AttributeError�dict�get� _sentinel)�obj�attr� instance_dicts �H/usr/lib/python3/dist-packages/jedi/inference/compiled/getattr_static.py�_check_instancer sY � ��M� ��/�/��Z�@�@� � ��� � � ��� �����8�8�M�4��3�3�3s � � -�-c � � t | � � D ]E}t t |� � � � t u r |j | c S # t $ r Y �Aw xY w�Ft S �N)�_static_getmro�_shadowed_dict�typer r �KeyError)�klassr �entrys r �_check_classr sw � ���&�&� � ���$�u�+�+�&�&�)�3�3� ��~�d�+�+�+�+��� � � ��� ���� 4� �s �A� A�Ac �J � t | � � n# t $ r Y dS w xY wdS )NFT)r � TypeError�r s r �_is_typer ! s? � ���s������� � � ��u�u������4s � � � c � � t j d }t | � � D ]a} |� |� � d }t |� � t j u r|j dk r |j |u s|c S �R# t $ r Y �^w xY wt S r ) r r r �__get__�types�GetSetDescriptorType�__name__�__objclass__r r )r � dict_attrr � class_dicts r r r ) s� � �� �j�)�I���&�&� "� "�� "�"�*�*�5�1�1�*�=�J� ��$�$��(B�B�B�"�+�z�9�9�"�/�5�8�8�!�!�!�!� 9�� � � � ��D� ���� �s �A4�4 B� Bc �� � t j d � | � � }t |t t f� � st j d| �d|�d�� � dS |S )N�__mro__zmro of z returned z, should be a tuple� )r r r � isinstance�tuple�listr �warning)r �mros r r r 8 s] � � �-� � "� *� *�5� 1� 1�C��c�E�4�=�)�)� � � � �E�E�E�3�3�3�O�P�P�P��r��J� c �J � t t | � � |� � t uS r )r r r )r �names r � _safe_hasattrr2 C s � ���S� � �4�(�(� �9�9r/ c �B � t | d� � pt | d� � S )N�__set__� __delete__)r2 r s r �_safe_is_data_descriptorr6 G s! � ���i�(�(�L�M�#�|�,L�,L�Lr/ c � � t }t | � � sSt | � � }t |� � }|t u st |� � t j u rt | |� � }n| }t ||� � }|t ur,|t ur#t |d� � rt |� � r|dfS |t ur|dfS |t ur|t |d� � fS | |u rdt t |� � � � D ]G}t t |� � � � t u r" |j | dfc S # t $ r Y �Cw xY w�H|t ur|dfS t |� � �)a� Retrieve attributes without triggering dynamic lookup via the descriptor protocol, __getattr__ or __getattribute__. Note: this function may not be able to retrieve all attributes that getattr can fetch (like dynamically created attributes) and may find attributes that getattr can't (like descriptors that raise AttributeError). It can also return descriptor objects instead of instance members in some cases. See the documentation for details. Returns a tuple `(attr, is_get_descriptor)`. is_get_descripter means that the attribute is a descriptor that has a `__get__` attribute. r TF)r r r r r! �MemberDescriptorTyper r r2 r6 r r r r )r r �default�instance_resultr r% �klass_resultr s r �getattr_staticr<