
    -h_                         S r SSKJr  SSKJr  \" 5       r\" 5       r\SS4S jr\4S jr	\4S jr
S r " S	 S
\5      rS rg)z
- the popular ``_memoize_default`` works like a typical memoize and returns the
  default otherwise.
- ``CachedMetaClass`` uses ``_memoize_default`` to do the same with classes.
    wraps)debugFc                    ^ ^^ U UU4S jnU$ )a:  This is a typical memoization decorator, BUT there is one difference:
To prevent recursion it sets defaults.

Preventing recursion is in this case the much bigger use than speed. I
don't think, that there is a big speed difference, but there are many cases
where recursion could happen (think about a = b; b = a).
c                    >^  UU UU4S jnU$ )Nc                 F  > T	(       a  U R                   nO-T
(       a  US   R                   nOU R                  R                   n UT   nX[        UR	                  5       5      4nXT;   a  XE   $ T[
        La  TXE'   T" U /UQ70 UD6nXdU'   U$ ! [         a
    0 =UT'   n NVf = f)Nr   )memoize_cacheinference_stateKeyError	frozensetitems_NO_DEFAULT)objargskwargscachememokeyrvdefaultfunctioninference_state_is_first_argsecond_arg_is_inference_states          gC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\jedi/inference/cache.pywrapper/_memoize_default.<locals>.func.<locals>.wrapper   s    +)).Q--++99,X i78C{y +- 'DIc3D3F3S		  ,)++h$,s   B B B  )r   r   r   r   r   s   ` r   func_memoize_default.<locals>.func   s    	 	.     r   )r   r   r   r   s   ``` r   _memoize_defaultr!      s    4 Kr    c                    ^  U 4S jnU$ )Nc                 $   > [        TSS9" U 5      $ )NT)r   r   r!   r   r   s    r   	decorator1inference_state_function_cache.<locals>.decorator5   s    dSTXYYr    r   r   r&   s   ` r   inference_state_function_cacher)   4   s    Z r    c                    ^  U 4S jnU$ )Nc                 "   > [        TS9" U 5      $ )N)r   r$   r%   s    r   r&   /inference_state_method_cache.<locals>.decorator<   s    066r    r   r(   s   ` r   inference_state_method_cacher-   ;   s    7 r    c                      S n U $ )Nc                      [        SS9" U 5      $ )NT)r   r$   )calls    r   r&   8inference_state_as_method_param_cache.<locals>.decoratorC   s    dCDIIr    r   )r&   s    r   %inference_state_as_method_param_cacher2   B   s    J r    c                   @   ^  \ rS rSrSr\" 5       U 4S j5       rSrU =r$ )CachedMetaClassI   z
This is basically almost the same than the decorator above, it just caches
class initializations. Either you do it this way or with decorators, but
with decorators you lose class access (isinstance, etc).
c                 $   > [         TU ]  " U0 UD6$ )N)super__call__)selfr   r   	__class__s      r   r8   CachedMetaClass.__call__O   s    w000r    r   )	__name__
__module____qualname____firstlineno____doc__r2   r8   __static_attributes____classcell__)r:   s   @r   r4   r4   I   s    
 +,1 -1r    r4   c                      S n U $ )z
This is a special memoizer. It memoizes generators and also checks for
recursion errors and returns no further iterator elemends in that case.
c                 0   ^  [        T 5      U 4S j5       nU$ )Nc              ?     >#    U R                   R                  n UT
   nX[        UR	                  5       5      4nXT;   a  XE   u  pgOT
" U /UQ70 UD6n/ nXg4XE'   Sn  Xx   n	U	[
        L a  [        R                  " SU -  5        g  U	v   US-  nM4  ! [         a
    0 =UT
'   n Nf = f! [         a=    UR                  [
        5        [        US 5      n	U	c  UR                  5          g XS'    Nhf = f7f)Nr   z"Found a generator recursion for %s   )r
   r	   r   r   r   _RECURSION_SENTINELr   warning
IndexErrorappendnextpop)r   r   r   r   r   r   actual_generator
cached_lstinext_elementr   s             r   r   Einference_state_method_generator_cache.<locals>.func.<locals>.wrapperZ   s#    ''55E,X i78C{/3y, *#+C#A$#A&#A 
,8	A2#-=L#'::&JS&PQ ; #"Q   ,)++h$,( " 2%%&9:#'(8$#?L#+"(%1rN2sW   C2B =C2&B( C2B%"C2$B%%C2(>C/&C2(C/,C2.C//C2r   )r   r   s   ` r   r   4inference_state_method_generator_cache.<locals>.funcY   s!    	x 	 
 	B r    r   )r   s    r   &inference_state_method_generator_cacherT   T   s    
#J Kr    N)r@   	functoolsr   jedir   objectr   rH   r!   r)   r-   r2   typer4   rT   r   r    r   <module>rY      s[   
  hh  )u38#L ,7  *5 1d 1*r    