o
    ð›h9  ã                   @   s°   d dl mZ d dlmZ d dlmZ d dlmZmZ d dl	m
Z
 d dlmZ G dd„ deƒZG d	d
„ d
eƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZdS )é    )ÚValueWrapper)ÚModuleValue)ÚParserTreeFilter)ÚStubNameÚStubModuleName)ÚTypingModuleFilterWrapper)ÚModuleContextc                       sR   e Zd ZeZ‡ fdd„Zdd„ Z‡ fdd„Zdd„ Zd‡ fd
d„	Z	dd„ Z
‡  ZS )ÚStubModuleValuec                    s   t ƒ j|i |¤Ž || _d S ©N)ÚsuperÚ__init__Únon_stub_value_set)Úselfr   ÚargsÚkwargs©Ú	__class__© úWc:\Users\shubh\Videos\agent\nova\Lib\site-packages\jedi/inference/gradual/stub_value.pyr      s   
zStubModuleValue.__init__c                 C   s   dS )NTr   ©r   r   r   r   Úis_stub   s   zStubModuleValue.is_stubc              	      sN   i }| j D ]}z|j}W n	 ty   Y qw | |ƒ ¡ q| 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ÚAttributeErrorÚupdater   )r   ÚnamesÚvalueÚmethodr   r   r   r      s   

ÿz StubModuleValue.sub_modules_dictc                 C   s   t |  ¡ |d�gt|  ¡ ƒ S )N)Zparent_contextÚorigin_scope)Ú
StubFilterZ
as_contextÚlistZiter_star_filters)r   r   r   r   r   Ú_get_stub_filters$   s   þ
ýz!StubModuleValue._get_stub_filtersNc                 #   s<   � t ƒ  |¡}t|d ƒ | j|d�}|E d H  |E d H  d S ©N)r   )r   Úget_filtersÚnextr    )r   r   ÚfiltersZstub_filtersr   r   r   r"   *   s   €

zStubModuleValue.get_filtersc                 C   ó   t | ƒS r
   )ÚStubModuleContextr   r   r   r   Ú_as_context1   ó   zStubModuleValue._as_contextr
   )Ú__name__Ú
__module__Ú__qualname__r   Z_module_name_classr   r   r   r    r"   r'   Ú__classcell__r   r   r   r   r	   	   s    r	   c                       s   e Zd Zd‡ fdd„	Z‡  ZS )r&   Nc                    s   t ƒ j|d�S r!   )r   r"   )r   Zuntil_positionr   r   r   r   r"   6   s   zStubModuleContext.get_filters)NN©r)   r*   r+   r"   r,   r   r   r   r   r&   5   s    r&   c                       s$   e Zd Z‡ fdd„Zdd„ Z‡  ZS )ÚTypingModuleWrapperc                 /   sB   � t ƒ j|i |¤Ž}t|d ƒ}|d usJ ‚t|ƒV  |E d H  d S r
   )r   r"   r#   r   )r   r   r   r$   Úfr   r   r   r"   =   s   €

zTypingModuleWrapper.get_filtersc                 C   r%   r
   )ÚTypingModuleContextr   r   r   r   r'   D   r(   zTypingModuleWrapper._as_context)r)   r*   r+   r"   r'   r,   r   r   r   r   r.   <   s    r.   c                       s   e Zd Z‡ fdd„Z‡  ZS )r0   c                 /   s2   � t ƒ j|i |¤Ž}tt|d ƒƒV  |E d H  d S r
   )r   r"   r   r#   )r   r   r   r$   r   r   r   r"   I   s   €zTypingModuleContext.get_filtersr-   r   r   r   r   r0   H   s    r0   c                       s    e Zd ZeZ‡ fdd„Z‡  ZS )r   c                    sj   t ƒ  |¡sdS | ¡ }|d u rdS |jdv r|jjdvrdS |j}| d¡r3| d¡r1| d¡s3dS dS )NF)Zimport_fromÚimport_name)Zimport_as_nameZdotted_as_nameÚ_Ú__T)r   Ú_is_name_reachableZget_definitionÚtypeÚparentr   Ú
startswithÚendswith)r   ÚnameZ
definitionÚnr   r   r   r4   R   s   
zStubFilter._is_name_reachable)r)   r*   r+   r   Z
name_classr4   r,   r   r   r   r   r   O   s    r   c                   @   s   e Zd ZdS )ÚVersionInfoN)r)   r*   r+   r   r   r   r   r;   e   s    r;   N)Zjedi.inference.base_valuer   Zjedi.inference.value.moduler   Zjedi.inference.filtersr   Zjedi.inference.namesr   r   Zjedi.inference.gradual.typingr   Zjedi.inference.contextr   r	   r&   r.   r0   r   r;   r   r   r   r   Ú<module>   s    ,