Format: application/x-python-code
⬇ Download File (5.1 KB)
   1  o
   2  
   3  �h��@s�ddlmZddlmZmZddlmZddlmZddl	m
   4  Z
   5  ddlmZddd	�Z
   6  d
   7  d�Zeddd
   8  ��Zdd�Zeddd��Zddd�Zddd�Zdd�ZdS)�)�debug)�ValueSet�	NO_VALUES)�to_list)�StubModuleValue)�try_to_load_stub_cached��	DecorateeFcs�|��}|��s
   9  t|g�Sd�t|t�r|j�|��}|r't|dd��|��}|�	�}|dur1t
  10  S|��}|rE|d}|dd�}d}d�t|||�}|rYt�
  11  �fdd�|D��}|r`|�|�}�durot�fdd�|D��}|S)NZ
  12  _arguments�����Tc3s2�|]}|��r�dur|��n|���VqdS�N)�is_class�execute_with_values�execute��.0�c)�	arguments��Wc:\Users\shubh\Videos\agent\nova\Lib\site-packages\jedi/inference/gradual/conversion.py�	<genexpr>&s��
  13  �z,_stub_to_python_value_set.<locals>.<genexpr>c3s�|]}t|��VqdSrr)r�v)�	decoratesrrr0s�)�get_root_context�is_stubr�
  14  isinstancer	Z_original_value�is_instance�getattr�py__class__�get_qualified_namesr�is_bound_method�_infer_from_stub�	from_sets�py__getattribute__)�
  15  stub_value�ignore_compiled�stub_module_context�was_instance�qualified_names�was_bound_method�method_name�valuesr)rrr�_stub_to_python_value_set
  16  s:
  17  
  18  �
  19  r+cCsZddlm}|��}t|t|f�sJ|��|j}|r!|�dd��}|D]}|�|�}q#|S)Nr)�MixedObjectcSs
  20  |��Sr)Zis_compiled)rrrr�<lambda>:s
  21  z"_infer_from_stub.<locals>.<lambda>)Zjedi.inference.compiled.mixedr,�	get_valuerrZnon_stub_value_set�filterr")r%r'r$r,�stub_moduleZ	non_stubs�namerrrr 4sr c	cs��|D]W}|��}|��s|Vq|jdkr+t|��|d�}|r*|D]}|jVq"qn,|��}|durWt||d�}|rW|�|�	��}|rW|D]}|����rR|VqF|VqFq|VqdS)N�module�r$)
  22  rr�api_type�convert_values�inferr1�get_defining_qualified_valuer+�goto�get_public_name)	�names�prefer_stub_to_compiledr1�module_contextr*r�	converted�converted_names�nrrr�_try_stub_to_python_names@s4�
  23  
  24  ��r@cCs.|��r|St|j|jt|g�d|j��d�S)N)Zimport_namesZpython_value_setZparent_module_value�sys_path)rrZinference_stateZstring_namesrZget_sys_path)r2rrr�_load_stub_moduleas�rBccs��|D]j}|��}|��r|Vq|jdkrKd}|��D]*}|jdkr7t|��dd�}|D]}|jVd}q-qt|g|d�D]}|Vd}q>q|rJqn|��}|durht	|�}	|	rh|	�|�
  25  ��}
  26  |
  27  rh|
  28  EdHq|rm|VqdS)Nr2FT)�
  29  only_stubs��fallback_to_python)rrr4r8r5r6r1�_python_to_stub_namesr7�to_stubr9)r:rEr1r<�
  30  found_namer?r*r�xr=r>rrrrFmsD�
  31  
  32  ���
  33  ��rFTcCsl|r|rtd��t�d��|s|rt||d�Wd�St||d�Wd�S1s/wYdS)Nz3You cannot use both of only_stubs and prefer_stubs.z
  34  convert namesrD)r;)�
  35  ValueErrorr�increase_indent_cmrFr@)r:rC�prefer_stubsr;rrr�
  36  convert_names�s
  37  ��$�rMcs�|r�rJ�t�d��+|s�r#t��fdd�|D��Wd�St��fdd�|D��Wd�S1s9wYdS)Nzconvert valuesc3s*�|]}t|�p�rt|h�ntVqdSr)rGrr)r�value)rLrrr�s��
  38  �z!convert_values.<locals>.<genexpr>c3s&�|]}t|�d�pt|h�VqdS)r3N)r+r)rr#r3rrr�s��
  39  �)rrKrr!)r*rCrLr$r)r$rLrr5�s���$�r5cCs�|��r	t|g�S|��}|r|��}|��}t|�����}|dus'|dur)tS|�	�}|r;|d}|dd�}d}t|g�}|D]}|�
  40  |�}qB|rVt�dd�|D��}|r]|�
  41  |�}|S)Nr
  42  Tcss �|]}|��r|��VqdSr)rr
  43  rrrrr�s��
  44  �zto_stub.<locals>.<genexpr>)rrrrrrBrr.rrr"r!)rNr&r'r0r(r)Zstub_valuesr1rrrrG�s0
  45  
  46  
  47  �
  48  rGN)F)FFT)ZjedirZjedi.inference.base_valuerrZjedi.inference.utilsrZ!jedi.inference.gradual.stub_valuerZjedi.inference.gradual.typeshedrZjedi.inference.value.decoratorr	r+r r@rBrFrMr5rGrrrr�<module>s 
  49  * 
  50  $
  51