o
    à›hÊ  ã                   @   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
   úIc:\Users\shubh\Videos\agent\nova\Lib\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 )zìConverts 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 )zßReturns 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 )záReturns 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 )z�Disables 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   	




 