o
    ï›h’
  ã                   @   sž   d Z ddlZddlZddlZejjZejjdureejj7 Ze d 	e 
e¡¡¡Z[dd„ Zdd„ Zdd	„ ZG d
d„ deƒZdd„ Zdd„ ZG dd„ dƒZdS )zC A universal module with functions / classes without dependencies. é    Nz (?:\.[^{0}]+|[{0}]__init__\.py)$c                    ó   ‡ fdd„}|S )Nc                     ó   t ˆ | i |¤ŽƒS ©N)Úlist©ÚargsÚkwargs©Úfunc© úJc:\Users\shubh\Videos\agent\nova\Lib\site-packages\jedi/inference/utils.pyÚwrapper   ó   zto_list.<locals>.wrapperr   ©r
   r   r   r	   r   Úto_list   ó   r   c                    r   )Nc                     r   r   )Útupler   r	   r   r   r      r   zto_tuple.<locals>.wrapperr   r   r   r	   r   Úto_tuple   r   r   c                 C   s   t dd„ | D ƒƒS )z5Turns a two dimensional array into a one dimensional.c                 s   s   � | ]
}|D ]}|V  qqd S r   r   )Ú.0ÚtypesÚtypr   r   r   Ú	<genexpr>   s   € zunite.<locals>.<genexpr>)Úset)Úiterabler   r   r   Úunite   s   r   c                   @   s   e Zd ZdZdS )ÚUncaughtAttributeErrora˜  
    Important, because `__getattr__` and `hasattr` catch AttributeErrors
    implicitly. This is really evil (mainly because of `__getattr__`).
    Therefore this class originally had to be derived from `BaseException`
    instead of `Exception`.  But because I removed relevant `hasattr` from
    the code base, we can now switch back to `Exception`.

    :param base: return values of sys.exc_info().
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r      s    r   c                 C   s   t t| ƒƒS r   )ÚpropertyÚreraise_uncaughtr	   r   r   r   Úsafe_property+   s   r"   c                    s   t  ˆ ¡‡ fdd„ƒ}|S )a*  
    Re-throw uncaught `AttributeError`.

    Usage:  Put ``@rethrow_uncaught`` in front of the function
    which does **not** suppose to raise `AttributeError`.

    AttributeError is easily get caught by `hasattr` and another
    ``except AttributeError`` clause.  This becomes problem when you use
    a lot of "dynamic" attributes (e.g., using ``@property``) because you
    can't distinguish if the property does not exist for real or some code
    inside of the "dynamic" attribute through that error.  In a well
    written code, such error should not exist but getting there is very
    difficult.  This decorator is to help us getting there by changing
    `AttributeError` to `UncaughtAttributeError` to avoid unexpected catch.
    This helps us noticing bugs earlier and facilitates debugging.
    c               
      s4   zˆ | i |¤ŽW S  t y } zt|ƒ|‚d }~ww r   )ÚAttributeErrorr   )r   ÚkwdsÚer	   r   r   r   @   s   
€ÿz!reraise_uncaught.<locals>.wrapper)Ú	functoolsÚwrapsr   r   r	   r   r!   /   s   r!   c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚPushBackIteratorc                 C   s   g | _ || _d | _d S r   )ÚpushesÚiteratorÚcurrent)Úselfr*   r   r   r   Ú__init__J   s   
zPushBackIterator.__init__c                 C   s   | j  |¡ d S r   )r)   Úappend)r,   Úvaluer   r   r   Ú	push_backO   s   zPushBackIterator.push_backc                 C   s   | S r   r   ©r,   r   r   r   Ú__iter__R   s   zPushBackIterator.__iter__c                 C   s*   | j r| j  ¡ | _| jS t| jƒ| _| jS r   )r)   Úpopr+   Únextr*   r1   r   r   r   Ú__next__U   s
   ÿzPushBackIterator.__next__N)r   r   r   r-   r0   r2   r5   r   r   r   r   r(   I   s
    r(   )r   r&   ÚreÚosÚpathÚsepZ_sepÚaltsepÚcompileÚformatÚescapeZ_path_rer   r   r   Ú	Exceptionr   r"   r!   r(   r   r   r   r   Ú<module>   s     