
    -h                         S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr  SSKJr  S	 rS
 rS rS rS rS rg)a  
Searching for names with given scope and name. This is very central in Jedi and
Python. The name resolution is quite complicated with descripter,
``__getattribute__``, ``__getattr__``, ``global``, etc.

If you want to understand name resolution, please read the first few chapters
in http://blog.ionelmc.ro/2015/02/09/understanding-python-metaclasses/.

Flow checks
+++++++++++

Flow checks are not really mature. There's only a check for ``isinstance``.  It
would check whether a flow has the form of ``if isinstance(a, type_or_tuple)``.
Unfortunately every other thing is being ignored (e.g. a == '' would be easy to
check for -> a is a string). There's big potential in these checks.
    )search_ancestor)Name)settings)TreeArguments)iterable)	NO_VALUES)is_scopec                     [        U[        5      (       a  UR                  OUn/ nU  H  nUR                  U5      nU(       d  M    O   [	        [        U5      5      $ )z\
Searches names that are defined in a scope (the different
``filters``), until a name fits.
)
isinstancer   valuegetlist_remove_del_stmt)filtersname_or_strstring_namenamesfilters        hC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\jedi/inference/finder.pyfilter_namer      sU    
 (2+t'D'D+##+KE

;'5 
  '((    c              #      #    U  HC  nUR                   b/  UR                   R                  5       nUb  UR                  S:X  a  M?  Uv   ME     g 7f)Ndel_stmt)	tree_nameget_definitiontype)r   name
definitions      r   r   r   +   sD     >>%668J%*//Z*G
 s   AAc                    [         R                  (       d  gSn[        U5      (       a  UR                  5       n UR	                  5       UR
                     n[        U Vs/ s H?  nUR                  UR                  s=::  a  U=(       d    UR                  :  d  M9  O  M=  UPMA     sn5      nU H1  n[        US5      n	U	c  M  [        X	R                  U5      nUc  M/  Us  $    UR                  S;   ac  UR                  SSS2    V
s/ s H  oS:w  d  M
  U
PM     nn
[        U5       H+  nUR                  UR                  :  d  M  [        XU5      s  $    U$ ! [         a     gf = fs  snf s  sn
f )zTry to find out the type of a variable just with the information that
is given by the flows: e.g. It is also responsible for assert checks.::

    if isinstance(k, str):
        k.  # <- completion here

ensures that `k` is a string.
Nassert_stmt)if_stmt
while_stmt      :)r   dynamic_flow_informationr	   get_root_nodeget_used_namesr   KeyErrorreversed	start_posend_posr   _check_isinstance_type	assertionr   children)r   flowsearch_nameposresultmodule_noder   nr   asscpotential_ifsif_tests                r   check_flow_informationr:   5   sY    ,,F~~((*	..01B1BCE 
!~~D0Ct||D D u
 
 D!$6C/}}kR%!M  yy--$(MM!$Q$$7D$7q8$7D.G$$w6-ekJJ / M'  		
 Es/   E  8E)E) E)	E.E.
E&%E&c                     U R                   S;   al  [        U R                  5      S:X  aS  U R                  u  pUR                   S:X  a5  UR                  S:X  a%  UR                   S:X  a  UR                  S   S:X  a  U$ g )N)power	atom_expr   r   r   trailerr   ()r   lenr/   r   )nodefirstr?   s      r   _get_isinstance_trailer_arglistrD   ]   sg    yy**s4==/AQ/F::EKK<$?LLI-'2B2B12E2LNr   c                    S n[        U5      nUb  [        UR                  5      S:X  a  UR                  S   n[        U R                  XU5      n[        UR                  5       5      n[        U5      S:X  aR  [        UR                  5      S:X  a9  Uu  u  pu  pUc-  U
c*  [        U5      n[        UR                  S   5      nX:X  a  UnUc  g [        nUR                  5        H~  n[        U[        R                  5      (       aJ  UR                  S:X  a:  UR                  5        H$  nUUR                  5       R                  5       -  nM&     Ml  XR                  5       -  nM     U$ )N   r#   r>   r   tuple)rD   rA   r/   r   inference_stater   unpack_get_call_stringr   inferr   r   Sequence
array_type
py__iter__execute_with_values)r   rB   r1   lazy_clsr?   arglistargs
param_listkey1_key2lazy_value_clscallis_instance_call	value_set
cls_or_tup
lazy_values                    r   r-   r-   g   sJ   H-d3Gs7#3#349""1%U22EGL$++-(
z?aC(8(8$9Q$>0:-IT-|'4#3G4D4DQ4G#H  +-HInn&
j("3"3449N9NRY9Y(335
Z--/CCEE	 6 7799I ' r   c                 <   U R                   R                  S:X  a  [        U R                   5      $ SnU R                  5       nU R	                  5       R
                  nUR                  U:  a0  XR                  -  nUR                  5       nUR                  U:  a  M0  U$ )Nr=    )	parentr   rJ   get_first_leafget_last_leafr,   r+   r   get_next_leaf)rB   codeleafends       r   rJ   rJ      s    {{;&,,D D




&
&C
..3


!!# ..3
 Kr   N)__doc__
parso.treer   parso.python.treer   jedir   jedi.inference.argumentsr   jedi.inference.valuer   jedi.inference.base_valuer   jedi.parser_utilsr	   r   r   r:   rD   r-   rJ    r   r   <module>ro      sA   " ' "  2 ) / &)%PB
r   