o
    i&                     @   s   d dl Z d dlZd dlZedfddZG dd deZG dd deZdd
dZ	dddZ
dddZdddZdddZdd Zdd Zdd ZdS )    Nevalc                 C   s   t | |d}t|i tjS )Nr   )compiler   sysmodules)codepathmodeexpr r
   N/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/debugpy/common/util.pyevaluate
   s   r   c                       s,   e Zd ZdZdZdd Z fddZ  ZS )
Observablez$An object with change notifications.r
   c                 C   s
   g | _ d S N)	observers)selfr
   r
   r   __init__   s   
zObservable.__init__c              
      s@   zt  ||W | jD ]}|| | qS | jD ]}|| | qw r   )super__setattr__r   )r   namevalueob	__class__r
   r   r      s   
zObservable.__setattr__)__name__
__module____qualname____doc__r   r   r   __classcell__r
   r
   r   r   r      s
    r   c                   @   s.   e Zd ZdZedd Zd	ddZdd ZdS )
Envz!A dict for environment variables.c                   C   s
   t tjS )z.Returns a snapshot of the current environment.)r   osenvironr
   r
   r
   r   snapshot&   s   
zEnv.snapshotNc                 C   s   t | }|d ur|| |S r   )r   update)r   updated_fromresultr
   r
   r   copy+   s   
zEnv.copyc                 C   s<   z
t jj| |  }W n ty   d}Y nw || | |< dS )ztPrepends a new entry to a PATH-style environment variable, creating
        it if it doesn't exist already.
         N)r   r   pathsepKeyError)r   keyentrytailr
   r
   r   
prepend_to1   s   zEnv.prepend_tor   )r   r   r   r   staticmethodr!   r%   r,   r
   r
   r
   r   r   #   s    

r   strictc                 C   s   t | tr| ||S t| S )zcConverts s to str, using the provided encoding. If s is already str,
    it is returned as is.
    )
isinstancebytesdecodestrsencodingerrorsr
   r
   r   	force_str<   s   r7   c                 C   s6   t | tr| ||S t| } |dkr| || | S )zConverts s to bytes, using the provided encoding. If s is already bytes,
    it is returned as is.

    If errors="strict" and s is bytes, its encoding is verified by decoding it;
    UnicodeError is raised if it cannot be decoded.
    r.   )r/   r2   encoder0   r1   r3   r
   r
   r   force_bytesC   s   
r9   c                 C      t | d|S )z'Same as force_bytes(s, "ascii", errors)asciir9   r4   r6   r
   r
   r   force_asciiT      r>   c                 C   r:   )z&Same as force_bytes(s, "utf8", errors)utf8r<   r=   r
   r
   r   
force_utf8Y   r?   rA   Fc                 C   s   z| j }W n- ty2   z| j}W n ty/   zt| }W n ty*   Y Y Y dS w d}Y nw Y nw |rEzt|}W n	 tyD   Y nw t|ddS )zReturns the most descriptive name of a Python module, class, or function,
    as a Unicode string

    If quote=True, name is quoted with repr().

    Best-effort, but guaranteed to not fail - always returns something.
    z	<unknown>Fzutf-8replace)r   	Exceptionr   reprr7   )objquoter   r
   r
   r   nameof^   s,   	


rG   c                 C   s~   t | dd}zt| }W n
 ty   Y |S w |d|7 }z	t| \}}W n	 ty1   Y nw |d| 7 }|d7 }|S )zReturns the most descriptive name of a Python module, class, or function,
    including source information (filename and linenumber), if available.

    Best-effort, but guaranteed to not fail - always returns something.
    T)rF   z (file z, line ))rG   inspectgetsourcefilerC   getsourcelines)rE   r   src_file_
src_linenor
   r
   r   	srcnameof~   s    rO   c                   C   s
   dt jvS )z>Returns True if the caller should hide something from debugpy.DEBUGPY_TRACE_DEBUGPY)r   r    r
   r
   r
   r   hide_debugpy_internals   s   
rQ   c                 C   s   t  rd| _d| _dS dS )zDisables tracing for the given thread if DEBUGPY_TRACE_DEBUGPY is not set.
    DEBUGPY_TRACE_DEBUGPY is used to debug debugpy with debugpy
    TN)rQ   pydev_do_not_traceis_pydev_daemon_thread)threadr
   r
   r   hide_thread_from_debugger   s   
rU   )r.   )F)rI   r   r   __file__r   objectr   dictr   r7   r9   r>   rA   rG   rO   rQ   rU   r
   r
   r
   r   <module>   s   	




 