o
    ð›hïW  ã                   @   s6  d dl mZ d dlmZ d dlmZ 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mZ d d	lmZmZmZmZ d d
lmZmZmZmZmZ d dlmZmZ d dlm Z  d dl!m"Z"m#Z# d dl$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z* d dl+m,Z, d dl-m.Z. d dl/m0Z0m1Z1 G dd„ deƒZ2G dd„ deƒZ3G dd„ de(ƒZ4G dd„ de)ƒZ5G dd„ deƒZ6G dd„ de6ƒZ7G dd„ de6ƒZ8G d d!„ d!e8ƒZ9G d"d#„ d#e8ƒZ:G d$d%„ d%eƒZ;G d&d'„ d'eƒZ<G d(d)„ d)e&eƒZ=G d*d+„ d+eƒZ>G d,d-„ d-eƒZ?G d.d/„ d/eƒZ@G d0d1„ d1eƒZAG d2d3„ d3e,ƒZBG d4d5„ d5e#ƒZCd6S )7é    )Úabstractproperty)Úsearch_ancestor)Údebug)Úsettings)Úcompiled)ÚCompiledValueFilter)Úvalues_from_qualified_namesÚis_big_annoying_library)ÚAbstractFilterÚ AnonymousFunctionExecutionFilter)Ú	ValueNameÚTreeNameDefinitionÚ	ParamNameÚNameWrapper)ÚValueÚ	NO_VALUESÚValueSetÚiterator_to_value_setÚValueWrapper)ÚLazyKnownValueÚLazyKnownValues)Úinference_state_method_cache)ÚValuesArgumentsÚTreeArgumentsWrapper)ÚFunctionValueÚFunctionMixinÚOverloadedFunctionValueÚBaseFunctionExecutionContextÚFunctionExecutionContextÚFunctionNameInClass)ÚClassFilter)Úget_dynamic_array_instance)Úfunction_is_staticmethodÚfunction_is_classmethodc                       s,   e Zd Z‡ fdd„Zdd„ Zdd„ Z‡  ZS )ÚInstanceExecutedParamNamec                    s   t ƒ j||d d� || _d S )N©Ú	arguments©ÚsuperÚ__init__Ú	_instance)ÚselfÚinstanceZfunction_valueÚ	tree_name©Ú	__class__© úSc:\Users\shubh\Videos\agent\nova\Lib\site-packages\jedi/inference/value/instance.pyr)      s   ÿ
z"InstanceExecutedParamName.__init__c                 C   s   t | jgƒS ©N)r   r*   ©r+   r0   r0   r1   Úinfer    ó   zInstanceExecutedParamName.inferc                 C   ó   dS ©NTr0   r3   r0   r0   r1   Úmatches_signature#   ó   z+InstanceExecutedParamName.matches_signature)Ú__name__Ú
__module__Ú__qualname__r)   r4   r8   Ú__classcell__r0   r0   r.   r1   r$      s    r$   c                       s(   e Zd Z‡ fdd„Z‡ fdd„Z‡  ZS )ÚAnonymousMethodExecutionFilterc                    ó   t ƒ j|i |¤Ž || _d S r2   r'   ©r+   r,   ÚargsÚkwargsr.   r0   r1   r)   (   ó   
z'AnonymousMethodExecutionFilter.__init__c                    sT   |j dkr#t| jjƒrt| j ¡ | j|ƒS t| jjƒs#t| j| j|ƒS tƒ  	||¡S ©Nr   )
Úposition_indexr#   Z_function_valueÚ	tree_noder$   r*   Úpy__class__r"   r(   Ú_convert_param)r+   ÚparamÚnamer.   r0   r1   rH   ,   s   
ýýz-AnonymousMethodExecutionFilter._convert_param)r:   r;   r<   r)   rH   r=   r0   r0   r.   r1   r>   '   s    r>   c                       s.   e Zd Z‡ fdd„Zddd„Zdd„ Z‡  ZS )	ÚAnonymousMethodExecutionContextc                    ó   t ƒ  |¡ || _d S r2   ©r(   r)   r,   )r+   r,   Úvaluer.   r0   r1   r)   >   ó   
z(AnonymousMethodExecutionContext.__init__Nc                 c   s   � t | j| | j||d�V  d S )N)Úuntil_positionÚorigin_scope)r>   r,   Ú_value)r+   rP   rQ   r0   r0   r1   Úget_filtersB   s   €
ýz+AnonymousMethodExecutionContext.get_filtersc                 C   s,   t | j ¡ ƒ}t| j| j|d jƒ|d< |S rD   )ÚlistrR   Úget_param_namesr$   r,   r-   )r+   Zparam_namesr0   r0   r1   rU   I   s   ýz/AnonymousMethodExecutionContext.get_param_names)NN)r:   r;   r<   r)   rS   rU   r=   r0   r0   r.   r1   rK   =   s    
rK   c                       s   e Zd Z‡ fdd„Z‡  ZS )ÚMethodExecutionContextc                    r?   r2   rM   r@   r.   r0   r1   r)   U   rC   zMethodExecutionContext.__init__)r:   r;   r<   r)   r=   r0   r0   r.   r1   rV   T   s    rV   c                       s˜   e Zd ZdZ‡ fdd„Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	e
dd„ ƒZdd„ Zdd„ Zdd„ Zd dd„Z‡ fdd„Zd!‡ fdd„	Zdd„ Z‡  ZS )"ÚAbstractInstanceValuer,   c                    s   t ƒ  ||¡ || _d S r2   )r(   r)   Úclass_value)r+   Úinference_stateÚparent_contextrX   r.   r0   r1   r)   ]   s   
zAbstractInstanceValue.__init__c                 C   r6   r7   r0   r3   r0   r0   r1   Úis_instancec   r9   z!AbstractInstanceValue.is_instancec                 C   s
   | j  ¡ S r2   )rX   Úget_qualified_namesr3   r0   r0   r1   r\   f   s   
z)AbstractInstanceValue.get_qualified_namesc                 C   ó   | j S r2   ©rX   r3   r0   r0   r1   Úget_annotated_class_objecti   ó   z0AbstractInstanceValue.get_annotated_class_objectc                 C   r]   r2   r^   r3   r0   r0   r1   rG   l   r`   z!AbstractInstanceValue.py__class__c                 C   s   d S r2   r0   r3   r0   r0   r1   Ú
py__bool__o   ó   z AbstractInstanceValue.py__bool__c                 C   s   t ‚r2   )ÚNotImplementedErrorr3   r0   r0   r1   rJ   s   rb   zAbstractInstanceValue.namec                    s*   ˆ   d¡ ˆ ˆ j¡}‡ fdd„| ¡ D ƒS )NÚ__call__c                    ó   g | ]}|  ˆ ¡‘qS r0   ©Úbind)Ú.0Úsr3   r0   r1   Ú
<listcomp>y   ó    z8AbstractInstanceValue.get_signatures.<locals>.<listcomp>)Úpy__getattribute__Ú	py__get__rX   Úget_signatures)r+   Z
call_funcsr0   r3   r1   rn   w   s   z$AbstractInstanceValue.get_signaturesc                 C   s,   | j dd�D ]}| |¡}|r|  S qg S )NF)Úinclude_self_names)rS   Úget)r+   rJ   ÚfilterÚnamesr0   r0   r1   Úget_function_slot_names{   s   
ÿz-AbstractInstanceValue.get_function_slot_namesc                    s   t  ‡ fdd„|D ƒ¡S )Nc                 3   s   � | ]
}|  ¡ jˆ Ž V  qd S r2   )r4   Zexecute_with_values©rh   rJ   ©Úinferred_argsr0   r1   Ú	<genexpr>†   s
   € ÿ
ÿz?AbstractInstanceValue.execute_function_slots.<locals>.<genexpr>)r   Ú	from_sets)r+   rr   rv   r0   ru   r1   Úexecute_function_slots…   s   þz,AbstractInstanceValue.execute_function_slotsTc                 C   s   |   ¡ S r2   )Ú
py__name__)r+   Zadd_class_infor0   r0   r1   Úget_type_hint‹   s   z#AbstractInstanceValue.get_type_hintc                    s>   |   d¡}|stƒ  ||¡S t|gƒ‰ t ‡ fdd„|D ƒ¡S )NÚ__getitem__c                 3   ó   � | ]
}|  ¡  ˆ ¡V  qd S r2   ©r4   Úexecutert   ©rA   r0   r1   rw   —   ó   € z6AbstractInstanceValue.py__getitem__.<locals>.<genexpr>)rs   r(   Úpy__getitem__r   r   rx   )r+   Zindex_value_setÚcontextualized_noderr   r.   r€   r1   r‚   Ž   s   
þ
z#AbstractInstanceValue.py__getitem__Nc                    s0   ˆ  d¡‰ˆstƒ  ˆ ¡S ‡ ‡‡fdd„}|ƒ S )NÚ__iter__c                  3   s&   � ˆ  ˆ¡D ]
} |  ˆ ¡E d H  qd S r2   )ry   Ú
py__next__)Ú	generator©rƒ   Ziter_slot_namesr+   r0   r1   Úiteratež   s   €ÿz1AbstractInstanceValue.py__iter__.<locals>.iterate)rs   r(   Ú
py__iter__)r+   rƒ   rˆ   r.   r‡   r1   r‰   ™   s
   
z AbstractInstanceValue.py__iter__c                 C   ó   d| j j| jf S )Nz
<%s of %s>)r/   r:   rX   r3   r0   r0   r1   Ú__repr__£   ó   zAbstractInstanceValue.__repr__)Tr2   )r:   r;   r<   Úapi_typer)   r[   r\   r_   rG   ra   r   rJ   rn   rs   ry   r{   r‚   r‰   r‹   r=   r0   r0   r.   r1   rW   Z   s"    



rW   c                       s:   e Zd Z‡ fdd„Zddd„Zedd„ ƒZd	d
„ Z‡  ZS )ÚCompiledInstancec                    s   t ƒ  |||¡ || _d S r2   )r(   r)   Ú
_arguments©r+   rY   rZ   rX   r&   r.   r0   r1   r)   ª   s   
zCompiledInstance.__init__NTc                 c   s2   � |   ¡ }|j|dd�}|D ]}t| |ƒV  qd S ©NT)rQ   r[   )r_   rS   ÚCompiledInstanceClassFilter)r+   rQ   ro   rX   Úclass_filtersÚfr0   r0   r1   rS   ®   s   €þÿzCompiledInstance.get_filtersc                 C   s   t  | | jjj¡S r2   )r   ZCompiledValueNamerX   rJ   Ústring_namer3   r0   r0   r1   rJ   ·   ó   zCompiledInstance.namec                 C   r6   )NFr0   r3   r0   r0   r1   Úis_stub»   r9   zCompiledInstance.is_stubr7   )	r:   r;   r<   r)   rS   ÚpropertyrJ   r—   r=   r0   r0   r.   r1   rŽ   §   s    
	
rŽ   c                       sf   e Zd Zedd„ ƒZedd„ ƒZddd„Zeƒ d	d
„ ƒZdd„ Z	ddd„Z
‡ fdd„Zdd„ Z‡  ZS )Ú_BaseTreeInstancec                 C   s(   | j  ¡ }|dv r| j ¡  ¡ r|S d S )N)rT   ÚsetÚdict)rX   rz   rZ   Úget_root_contextÚis_builtins_module©r+   rJ   r0   r0   r1   Ú
array_typeÀ   s   
ÿz_BaseTreeInstance.array_typec                 C   s   t | | jjjƒS r2   )r   rX   rJ   r-   r3   r0   r0   r1   rJ   È   s   z_BaseTreeInstance.nameNTc                 c   sŠ   � |   ¡ }|r| ¡ D ]}| ¡ st| || ¡ |ƒV  q|j|dd�}|D ]}t|tƒr3t| |ƒV  q%t|t	ƒr?t
| |ƒV  q%|V  q%d S r‘   )r_   Ú	py__mro__Zis_compiledÚSelfAttributeFilterÚ
as_contextrS   Ú
isinstancer    ÚInstanceClassFilterr   r’   )r+   rQ   ro   rX   Úclsr“   r”   r0   r0   r1   rS   Ì   s$   €€þ

ùz_BaseTreeInstance.get_filtersc                 C   sh   |}	 |}t |ddƒ}|j|u r.t ||¡}t| ||ƒ}|jjdkr)| | j¡}n| ¡ }nq| 	|¡S )NTÚfuncdefZclassdefr)   )
r   rF   r   Zfrom_contextÚBoundMethodrJ   rN   r¢   r�   Úcreate_context)r+   Úclass_contextÚnodeÚnewZ	func_nodeÚfuncÚbound_methodÚcontextr0   r0   r1   Úcreate_instance_contextã   s   
ö
z)_BaseTreeInstance.create_instance_contextc                 C   sH   |   ¡ rtS t | j|¡}t| jƒrtS |  d¡p|  d¡}|  ||¡S )z»
        Since nothing was inferred, now check the __getattr__ and
        __getattribute__ methods. Stubs don't need to be checked, because
        they don't contain any logic.
        Ú__getattr__Ú__getattribute__)	r—   r   r   Úcreate_simple_objectrY   r	   rZ   rs   ry   )r+   r•   rJ   rr   r0   r0   r1   Úpy__getattribute__alternativesó   s   
	
ÿz0_BaseTreeInstance.py__getattribute__alternativesc                 c   s8   � d}|   |¡}|rt|  |¡ƒV  d S t d| ¡ d S )NÚ__next__z(Instance has no __next__ function in %s.)rs   r   ry   r   Úwarning)r+   rƒ   rJ   Znext_slot_namesr0   r0   r1   r…     s   €

ÿz_BaseTreeInstance.py__next__c                    s2   |   d¡}|stƒ  ˆ ¡S t ‡ fdd„|D ƒ¡S )Nrd   c                 3   r}   r2   r~   rt   r%   r0   r1   rw     r�   z/_BaseTreeInstance.py__call__.<locals>.<genexpr>)rs   r(   Ú
py__call__r   rx   )r+   r&   rr   r.   r%   r1   r¶     s   
z_BaseTreeInstance.py__call__c                 C   sj   | j  ¡ D ]}| | ||¡}|tur|  S q|  d¡}|r0|du r)t | jd¡}|  |||¡S t	| gƒS )z"
        obj may be None.
        Ú__get__NÚNone)
rX   r    Zpy__get__on_classÚNotImplementedrs   r   Zbuiltin_from_namerY   ry   r   )r+   r,   rX   r¥   Úresultrr   r0   r0   r1   rm     s   ÿ

z_BaseTreeInstance.py__get__r7   r2   )r:   r;   r<   r˜   rŸ   rJ   rS   r   r¯   r³   r…   r¶   rm   r=   r0   r0   r.   r1   r™   ¿   s    





r™   c                       sR   e Zd Z‡ fdd„Zedd�dd„ ƒZdd„ Zd	d
„ Z‡ fdd„Zdd„ Z	‡  Z
S )ÚTreeInstancec                    sJ   |  ¡ dv r| ¡  ¡ rtjrt| |ƒ}tƒ  |||¡ || _|j	| _	d S )N)rT   rš   )
rz   rœ   r�   r   Zdynamic_array_additionsr!   r(   r)   r�   rF   r�   r.   r0   r1   r)   2  s   
ÿ
zTreeInstance.__init__N)Údefaultc           
      C   s¸   ddl m}m} t| | jƒ}| j d¡ ¡ D ]C}|jj	}|d u s*|j
dks*| |¡s+qt| | j ¡ |jƒ}||ƒ}||||ƒ}|rY| j ||j||ƒ¡\}	tjd|	dd� |	  S qd S )Nr   )Úpy__annotations__Úinfer_type_vars_for_executionr)   r¦   zInferred instance value as %sZBLUE)Úcolor)Ú!jedi.inference.gradual.annotationr½   r¾   ÚInstanceArgumentsr�   rX   rl   rn   rN   rF   Útyper8   r§   r¢   Zdefine_genericsr   Zdbg)
r+   r½   r¾   rA   Ú	signaturer¦   r­   Zall_annotationsZtype_var_dictZdefinedr0   r0   r1   Ú_get_annotated_class_objectA  s&   ÿÿûz(TreeInstance._get_annotated_class_objectc                 C   s   |   ¡ p| jS r2   )rÄ   rX   r3   r0   r0   r1   r_   [  ó   z'TreeInstance.get_annotated_class_objectc                 C   sv   t }| jdkr9t| j ¡ ƒD ]*\}\}}|d u r*|dkr*|t dd„ | ¡ D ƒ¡O }|r8|tt 	| j
|¡gƒO }q|S )Nr›   r   c                 s   s"   � | ]}|j d kr| ¡ V  qdS ©r›   N)rŸ   Úget_key_values)rh   Úvr0   r0   r1   rw   c  s   € 
þýz.TreeInstance.get_key_values.<locals>.<genexpr>)r   rŸ   Ú	enumerater�   Úunpackr   rx   r4   r   r²   rY   )r+   ÚvaluesÚiÚkeyr,   r0   r0   r1   rÇ   ^  s   

þ
þ€zTreeInstance.get_key_valuesc                    sx   | j dkr6tt| j ¡ ƒƒD ]'\}}|d u r+t ‡ fdd„| ¡ D ƒ¡}|r*|  S q|ˆ kr5| ¡   S qtƒ  	ˆ ¡S )Nr›   c                 3   s$   � | ]}|j d kr| ˆ ¡V  qdS rÆ   )rŸ   Úpy__simple_getitem__)rh   Z	dct_value©Úindexr0   r1   rw   {  s   € 
þýz4TreeInstance.py__simple_getitem__.<locals>.<genexpr>)
rŸ   ÚreversedrT   r�   rÊ   r   rx   r4   r(   rÎ   )r+   rÐ   rÍ   Zlazy_contextrË   r.   rÏ   r1   rÎ   p  s   
þÿÿz!TreeInstance.py__simple_getitem__c                 C   s   d| j j| j| jf S )Nz<%s of %s(%s)>)r/   r:   rX   r�   r3   r0   r0   r1   r‹   ‡  s   ÿzTreeInstance.__repr__)r:   r;   r<   r)   r   rÄ   r_   rÇ   rÎ   r‹   r=   r0   r0   r.   r1   r»   1  s    
r»   c                   @   s   e Zd ZdZdS )ÚAnonymousInstanceN)r:   r;   r<   r�   r0   r0   r0   r1   rÒ   Œ  s    rÒ   c                   @   s   e Zd Zedd„ ƒZdS )ÚCompiledInstanceNamec                 c   s2   � | j  ¡ D ]}|jdkrt|ƒV  q|V  qd S )NÚfunction)Ú_wrapped_namer4   r�   ÚCompiledBoundMethod©r+   Zresult_valuer0   r0   r1   r4   ‘  s   €
üzCompiledInstanceName.inferN)r:   r;   r<   r   r4   r0   r0   r0   r1   rÓ   �  s    rÓ   c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
r’   c                 C   ó   || _ || _d S r2   ©r*   Ú_class_filter)r+   r,   r”   r0   r0   r1   r)   ›  ó   
z$CompiledInstanceClassFilter.__init__c                 C   ó   |   | j |¡¡S r2   ©Ú_convertrÚ   rp   rž   r0   r0   r1   rp   Ÿ  rŒ   zCompiledInstanceClassFilter.getc                 C   ó   |   | j ¡ ¡S r2   ©rÞ   rÚ   rË   r3   r0   r0   r1   rË   ¢  ó   z"CompiledInstanceClassFilter.valuesc                 C   s   dd„ |D ƒS )Nc                 S   s   g | ]}t |ƒ‘qS r0   )rÓ   ©rh   Únr0   r0   r1   rj   ¦  s    z8CompiledInstanceClassFilter._convert.<locals>.<listcomp>r0   ©r+   rr   r0   r0   r1   rÞ   ¥  rÅ   z$CompiledInstanceClassFilter._convertN)r:   r;   r<   r)   rp   rË   rÞ   r0   r0   r0   r1   r’   š  s
    r’   c                       sr   e Zd Z‡ fdd„Zdd„ Ze‡ fdd„ƒZdd„ Zd	d
„ Zddd„Z	dd„ Z
dd„ Z‡ fdd„Zdd„ Z‡  ZS )r§   c                    s   t ƒ  |¡ || _|| _d S r2   )r(   r)   r,   Ú_class_context)r+   r,   r©   rÔ   r.   r0   r1   r)   ª  s   
zBoundMethod.__init__c                 C   r6   r7   r0   r3   r0   r0   r1   Úis_bound_method¯  r9   zBoundMethod.is_bound_methodc                    s   t | jtƒ jƒS r2   )r   rå   r(   rJ   r3   r.   r0   r1   rJ   ²  s   þzBoundMethod.namec                 C   s   t | jddƒ\}|S )NÚtypesÚ
MethodType)r   rY   )r+   Úcr0   r0   r1   rG   ¹  s   zBoundMethod.py__class__c                 C   s   |d usJ ‚t | j|ƒS r2   )rÁ   r,   ©r+   r&   r0   r0   r1   Ú_get_arguments½  s   zBoundMethod._get_argumentsNc                 C   s,   |d u r
t | j| ƒS |  |¡}t| j| |ƒS r2   )rK   r,   rë   rV   rê   r0   r0   r1   Ú_as_contextÁ  s   
zBoundMethod._as_contextc                 C   s0   t | jtƒr| j |  |¡¡S |  |¡}| ¡ S r2   )r£   Ú_wrapped_valuer   r¶   rë   r¢   r4   )r+   r&   Zfunction_executionr0   r0   r1   r¶   È  s   
zBoundMethod.py__call__c                    ó   ‡ fdd„ˆ j  ¡ D ƒS )Nc                    ó   g | ]
}t ˆ jˆ j|ƒ‘qS r0   )r§   r,   rå   )rh   r”   r3   r0   r1   rj   Ð  s    ÿÿz7BoundMethod.get_signature_functions.<locals>.<listcomp>)rí   Úget_signature_functionsr3   r0   r3   r1   rð   Ï  s   
þz#BoundMethod.get_signature_functionsc                    s   ‡ fdd„t ƒ  ¡ D ƒS )Nc                    re   r0   rf   ©rh   Úsigr3   r0   r1   rj   Ö  rk   z.BoundMethod.get_signatures.<locals>.<listcomp>)r(   rn   r3   r.   r3   r1   rn   Õ  ó   zBoundMethod.get_signaturesc                 C   rŠ   )Nz<%s: %s>)r/   r:   rí   r3   r0   r0   r1   r‹   Ø  rŒ   zBoundMethod.__repr__r2   )r:   r;   r<   r)   ræ   r˜   rJ   rG   rë   rì   r¶   rð   rn   r‹   r=   r0   r0   r.   r1   r§   ©  s    
r§   c                   @   s   e Zd Zdd„ Zdd„ ZdS )rÖ   c                 C   r6   r7   r0   r3   r0   r0   r1   ræ   Ý  r9   z#CompiledBoundMethod.is_bound_methodc                    rî   )Nc                    re   r0   rf   rñ   r3   r0   r1   rj   á  rk   z6CompiledBoundMethod.get_signatures.<locals>.<listcomp>)rí   rn   r3   r0   r3   r1   rn   à  ró   z"CompiledBoundMethod.get_signaturesN)r:   r;   r<   ræ   rn   r0   r0   r0   r1   rÖ   Ü  s    rÖ   c                       s<   e Zd ZdZdd„ Zedd„ ƒZdd„ Z‡ fdd	„Z‡  Z	S )
ÚSelfNamez9
    This name calculates the parent_context lazily.
    c                 C   s   || _ || _|| _d S r2   )r*   r©   r-   )r+   r,   r©   r-   r0   r0   r1   r)   è  s   
zSelfName.__init__c                 C   s   | j  | j| j¡S r2   )r*   r¯   r©   r-   r3   r0   r0   r1   rZ   í  r–   zSelfName.parent_contextc                 C   r]   r2   ©r*   r3   r0   r0   r1   Úget_defining_qualified_valueñ  r`   z%SelfName.get_defining_qualified_valuec                    s^   t | jdƒ}|d ur*|jd jdkr*ddlm} || j|jd jd ƒ ¡ }|r*|S tƒ  	¡ S )NZ	expr_stmté   Z	annassignr   )Úinfer_annotation)
r   r-   ÚchildrenrÂ   rÀ   rø   rZ   Zexecute_annotationr(   r4   )r+   Ústmtrø   rË   r.   r0   r1   r4   ô  s   ÿþ
zSelfName.infer)
r:   r;   r<   Ú__doc__r)   r˜   rZ   rö   r4   r=   r0   r0   r.   r1   rô   ä  s    
rô   c                       s8   e Zd Z‡ fdd„Zedd„ ƒZdd„ Zdd„ Z‡  ZS )	ÚLazyInstanceClassNamec                    rL   r2   r'   )r+   r,   Zclass_member_namer.   r0   r1   r)     rO   zLazyInstanceClassName.__init__c                 c   s0   � | j  ¡ D ]}| | j| j ¡ ¡E d H  qd S r2   )rÕ   r4   rm   r*   rG   r×   r0   r0   r1   r4     s   €ÿzLazyInstanceClassName.inferc                 C   s   |   ¡  ¡ S r2   )r4   rn   r3   r0   r0   r1   rn     r5   z$LazyInstanceClassName.get_signaturesc                 C   r]   r2   rõ   r3   r0   r0   r1   rö     r`   z2LazyInstanceClassName.get_defining_qualified_value)	r:   r;   r<   r)   r   r4   rn   rö   r=   r0   r0   r.   r1   rü     s    
rü   c                   @   s8   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ ZdS )r¤   zæ
    This filter is special in that it uses the class filter and wraps the
    resulting names in LazyInstanceClassName. The idea is that the class name
    filtering can be very flexible and always be reflected in instances.
    c                 C   rØ   r2   rÙ   )r+   r,   Zclass_filterr0   r0   r1   r)     rÛ   zInstanceClassFilter.__init__c                 C   rÜ   r2   rÝ   rž   r0   r0   r1   rp     rŒ   zInstanceClassFilter.getc                 C   rß   r2   rà   r3   r0   r0   r1   rË     rá   zInstanceClassFilter.valuesc                    ó   ‡ fdd„|D ƒS )Nc                    s   g | ]}t ˆ j|ƒ‘qS r0   )rü   r*   râ   r3   r0   r1   rj   #  s    
ÿÿz0InstanceClassFilter._convert.<locals>.<listcomp>r0   rä   r0   r3   r1   rÞ   "  s   
þzInstanceClassFilter._convertc                 C   rŠ   )Nz<%s for %s>)r/   r:   rÚ   r3   r0   r0   r1   r‹   (  rŒ   zInstanceClassFilter.__repr__N)	r:   r;   r<   rû   r)   rp   rË   rÞ   r‹   r0   r0   r0   r1   r¤     s    r¤   c                       sH   e Zd ZdZ‡ fdd„Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	‡  Z
S )r¡   zU
    This class basically filters all the use cases where `self.*` was assigned.
    c                    s   t ƒ j|||dd� || _d S )NT)rX   Únode_contextrQ   r[   r'   )r+   r,   Zinstance_classrþ   rQ   r.   r0   r1   r)   0  s   ü
zSelfAttributeFilter.__init__c                    s0   | j j| j j‰‰ ‡ ‡fdd„|D ƒ}|  |¡S )Nc                    s*   g | ]}ˆ|j   k rˆ k rn n|‘qS r0   )Ú	start_posrâ   ©ÚendÚstartr0   r1   rj   ;  s   * z/SelfAttributeFilter._filter.<locals>.<listcomp>)Ú_parser_scoperÿ   Úend_posÚ_filter_self_namesrä   r0   r   r1   Ú_filter9  s   
zSelfAttributeFilter._filterc                 c   sj   � |D ]/}|j }|jdkr2t|j jƒdkr2|jd dkr2| ¡ r2|  |¡r2|  |j jd |¡r2|V  qd S )NÚtraileré   r   Ú.)ÚparentrÂ   Úlenrù   Zis_definitionZ_access_possibleÚ_is_in_right_scope)r+   rr   rJ   r  r0   r0   r1   r  >  s   €
€÷z&SelfAttributeFilter._filter_self_namesc                    s2   ˆ j  |¡}|j||jd�}t‡ fdd„|D ƒƒS )N)Úpositionc                 3   s8   � | ]}|j d ko|j ¡ jdko|jjˆ ju V  qdS )rI   r   N)r�   r-   Zget_definitionrE   rZ   rF   r  râ   r3   r0   r1   rw   M  s   € 
ýÿ
ýz9SelfAttributeFilter._is_in_right_scope.<locals>.<genexpr>)Ú_node_contextr¨   Zgotorÿ   Úany)r+   Ú	self_namerJ   Zself_contextrr   r0   r3   r1   r  J  s
   üz&SelfAttributeFilter._is_in_right_scopec                    rý   )Nc                    rï   r0   )rô   r*   r  rt   r3   r0   r1   rj   U  s    z6SelfAttributeFilter._convert_names.<locals>.<listcomp>r0   rä   r0   r3   r1   Ú_convert_namesT  rŒ   z"SelfAttributeFilter._convert_namesc                 C   s   |S r2   r0   rä   r0   r0   r1   Ú_check_flowsW  r9   z SelfAttributeFilter._check_flows)r:   r;   r<   rû   r)   r  r  r  r  r  r=   r0   r0   r.   r1   r¡   ,  s    	
r¡   c                       s&   e Zd Z‡ fdd„Zddd„Z‡  ZS )rÁ   c                    rL   r2   rM   )r+   r,   r&   r.   r0   r1   r)   \  rO   zInstanceArguments.__init__Nc                 c   s(   � d t | jƒfV  | j |¡E d H  d S r2   )r   r,   Z_wrapped_argumentsrÊ   )r+   r¬   r0   r0   r1   rÊ   `  s   €zInstanceArguments.unpackr2   )r:   r;   r<   r)   rÊ   r=   r0   r0   r.   r1   rÁ   [  s    rÁ   N)DÚabcr   Z
parso.treer   Zjedir   r   Zjedi.inferencer   Zjedi.inference.compiled.valuer   Zjedi.inference.helpersr   r	   Zjedi.inference.filtersr
   r   Zjedi.inference.namesr   r   r   r   Zjedi.inference.base_valuer   r   r   r   r   Zjedi.inference.lazy_valuer   r   Zjedi.inference.cacher   Zjedi.inference.argumentsr   r   Zjedi.inference.value.functionr   r   r   r   r   r   Zjedi.inference.value.klassr    Z#jedi.inference.value.dynamic_arraysr!   Zjedi.parser_utilsr"   r#   r$   r>   rK   rV   rW   rŽ   r™   r»   rÒ   rÓ   r’   r§   rÖ   rô   rü   r¤   r¡   rÁ   r0   r0   r0   r1   Ú<module>   sF     Mr[
3/