← Back
Editing: stub_value.cpython-311.pyc
� p�{c9 � � � d dl mZ d dlmZ d dlmZ d dlmZmZ d dl m Z d dlmZ G d� de� � Z G d � d e� � Z G d� de � � Z G d � de� � Z G d� de� � Z G d� de� � ZdS )� )�ValueWrapper)�ModuleValue)�ParserTreeFilter)�StubName�StubModuleName)�TypingModuleFilterWrapper)� ModuleContextc �J � � e Zd ZeZ� fd�Zd� Z� fd�Zd� Zd� fd� Z d� Z � xZS ) �StubModuleValuec �H �� t � � j |i |�� || _ d S �N)�super�__init__�non_stub_value_set)�selfr �args�kwargs� __class__s ��C/usr/lib/python3/dist-packages/jedi/inference/gradual/stub_value.pyr zStubModuleValue.__init__ s- �� ������$�)�&�)�)�)�"4����� c � � dS )NT� �r s r �is_stubzStubModuleValue.is_stub s � ��tr c �� �� i }| j D ]7} |j }|� |� � � � �(# t $ r Y �4w xY w|� t � � � � � � � |S )z� We have to overwrite this, because it's possible to have stubs that don't have code for all the child modules. At the time of writing this there are for example no stubs for `json.tool`. )r �sub_modules_dict�update�AttributeErrorr )r �names�value�methodr s �r r z StubModuleValue.sub_modules_dict s� �� � ���,� '� '�E� '��/�� ���V�V�X�X�&�&�&�&�� "� � � ��� ���� ���U�W�W�-�-�/�/�0�0�0��s �3� A �A c � � t | � � � |�� � gt | � � � � � z S )N)�parent_context�origin_scope)� StubFilter� as_context�list�iter_star_filters)r r$ s r �_get_stub_filtersz!StubModuleValue._get_stub_filters$ sL � ���?�?�,�,�%� � � � � �$�(�(�*�*� +� +�,� ,r Nc # � �K � t � � � |� � }t |d � � | � |�� � }|E d {V �� |E d {V �� d S �N)r$ )r �get_filters�nextr) )r r$ �filters�stub_filtersr s �r r, zStubModuleValue.get_filters* sz �� � � ��'�'�%�%�l�3�3���W�d�����-�-�<�-�H�H�������������������r c � � t | � � S r )�StubModuleContextr s r �_as_contextzStubModuleValue._as_context1 s � � ��&�&�&r r )�__name__� __module__�__qualname__r �_module_name_classr r r r) r, r2 � __classcell__�r s @r r r s� �� � � � � �'��5� 5� 5� 5� 5�� � �� � � � �",� ,� ,�� � � � � �'� '� '� '� '� '� 'r r c � � � e Zd Zd� fd� Z� xZS )r1 Nc �H �� t � � � |�� � S r+ )r r, )r �until_positionr$ r s �r r, zStubModuleContext.get_filters6 s �� � �w�w�"�"��"�=�=�=r )NN�r3 r4 r5 r, r7 r8 s @r r1 r1 5 s= �� � � � � �>� >� >� >� >� >� >� >� >� >r r1 c �$ � � e Zd Z� fd�Zd� Z� xZS )�TypingModuleWrapperc / � �K � t � � j |i |��}t |d � � }|�J �t |� � V � |E d {V �� d S r )r r, r- r )r r r r. �fr s �r r, zTypingModuleWrapper.get_filters= sl �� � � �%�%�'�'�%�t�6�v�6�6����$�����}�}�}�'��*�*�*�*�*����������r c � � t | � � S r )�TypingModuleContextr s r r2 zTypingModuleWrapper._as_contextD s � �"�4�(�(�(r )r3 r4 r5 r, r2 r7 r8 s @r r>