Format: application/x-python-code
⬇ Download File (4.1 KB)
   1  o
   2  
   3  �h9
   4  �@s�ddlmZddlmZddlmZddlmZmZddl	m
   5  Z
   6  ddlmZGdd�de�Z
   7  Gd	d
   8  �d
   9  e�ZGdd�de
  10  �ZGd
  11  d�de�ZGdd�de�ZGdd�de�ZdS)�)�ValueWrapper)�ModuleValue)�ParserTreeFilter)�StubName�StubModuleName)�TypingModuleFilterWrapper)�
  12  ModuleContextcsReZdZeZ�fdd�Zdd�Z�fdd�Zdd�Zd�fd
  13  d�	Z	dd
  14  �Z
  15  �ZS)�StubModuleValuecst�j|i|��||_dS�N)�super�__init__�non_stub_value_set)�selfr
  16  �args�kwargs��	__class__��Wc:\Users\shubh\Videos\agent\nova\Lib\site-packages\jedi/inference/gradual/stub_value.pyrs
  17  zStubModuleValue.__init__cCsdS)NTr�rrrr�is_stubszStubModuleValue.is_stubc	sNi}|jD]}z|j}Wn	tyYqw|�|��q|�t����|S)z�
  18          We have to overwrite this, because it's possible to have stubs that
  19          don't have code for all the child modules. At the time of writing this
  20          there are for example no stubs for `json.tool`.
  21          )r
  22  �sub_modules_dict�AttributeError�updater)r�names�value�methodrrrrs
  23  
  24  �z StubModuleValue.sub_modules_dictcCst|��|d�gt|���S)N)Zparent_context�origin_scope)�
  25  StubFilterZ
  26  as_context�listZiter_star_filters)rrrrr�_get_stub_filters$s�
  27  �z!StubModuleValue._get_stub_filtersNc#s<�t��|�}t|d�|j|d�}|EdH|EdHdS�N)r)r�get_filters�nextr )rr�filtersZstub_filtersrrrr"*s�
  28  
  29  zStubModuleValue.get_filterscC�t|�Sr
  30  )�StubModuleContextrrrr�_as_context1�zStubModuleValue._as_contextr
  31  )�__name__�
  32  __module__�__qualname__rZ_module_name_classrrrr r"r'�
  33  __classcell__rrrrr		sr	cseZdZd�fdd�	Z�ZS)r&Ncst�j|d�Sr!)rr")rZuntil_positionrrrrr"6szStubModuleContext.get_filters)NN�r)r*r+r"r,rrrrr&5sr&cs$eZdZ�fdd�Zdd�Z�ZS)�TypingModuleWrapperc/sB�t�j|i|��}t|d�}|dusJ�t|�V|EdHdSr
  34  )rr"r#r)rrrr$�frrrr"=s�
  35  
  36  zTypingModuleWrapper.get_filterscCr%r
  37  )�TypingModuleContextrrrrr'Dr(zTypingModuleWrapper._as_context)r)r*r+r"r'r,rrrrr.<sr.cseZdZ�fdd�Z�ZS)r0c/s2�t�j|i|��}tt|d��V|EdHdSr
  38  )rr"rr#)rrrr$rrrr"Is�zTypingModuleContext.get_filtersr-rrrrr0Hsr0cs eZdZeZ�fdd�Z�ZS)rcsjt��|�sdS|��}|durdS|jdvr|jjdvrdS|j}|�d�r3|�d�r1|�d�s3dSdS)NF)Zimport_from�import_name)Zimport_as_nameZdotted_as_name�_�__T)r�_is_name_reachableZget_definition�type�parentr�
  39  startswith�endswith)r�nameZ
  40  definition�nrrrr4Rs
  41  zStubFilter._is_name_reachable)r)r*r+rZ
  42  name_classr4r,rrrrrOsrc@seZdZdS)�VersionInfoN)r)r*r+rrrrr;esr;N)Zjedi.inference.base_valuerZjedi.inference.value.modulerZjedi.inference.filtersrZjedi.inference.namesrrZjedi.inference.gradual.typingrZjedi.inference.contextrr	r&r.r0rr;rrrr�<module>s,