o
    Zh
                     @   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 K/var/www/html/lang_env/lib/python3.10/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     