o
    [Zh&                     @   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
   J/var/www/html/lang_env/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   Z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   r6   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.   r1   encoder/   r0   r2   r
   r
   r   force_bytesC   s   
r8   c                 C      t | d|S )z'Same as force_bytes(s, "ascii", errors)asciir8   r3   r5   r
   r
   r   force_asciiT      r=   c                 C   r9   )z&Same as force_bytes(s, "utf8", errors)utf8r;   r<   r
   r
   r   
force_utf8Y   r>   r@   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   reprr6   )objquoter   r
   r
   r   nameof^   s,   	


rF   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)rE   z (file z, line ))rF   inspectgetsourcefilerB   getsourcelines)rD   r   Zsrc_file_Z
src_linenor
   r
   r   	srcnameof~   s    rL   c                   C   s
   dt jvS )z>Returns True if the caller should hide something from debugpy.ZDEBUGPY_TRACE_DEBUGPY)r   r    r
   r
   r
   r   hide_debugpy_internals   s   
rM   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)rM   Zpydev_do_not_traceZis_pydev_daemon_thread)threadr
   r
   r   hide_thread_from_debugger   s   
rO   )r-   )F)rH   r   r   __file__r   objectr   dictr   r6   r8   r=   r@   rF   rL   rM   rO   r
   r
   r
   r   <module>   s   	




 