
    bi                         d dl Z d dlZd dlZedfdZ G d de      Z G d de      ZddZ	dd	Z
dd
ZddZddZd Zd Zd Zy)    Nevalc                 R    t        | |d      }t        |i t        j                        S )Nr   )compiler   sysmodules)codepathmodeexprs       N/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/debugpy/common/util.pyevaluater   
   s%    
 4v&Db#++&&    c                   ,     e Zd ZdZdZd Z fdZ xZS )
Observablez$An object with change notifications. c                     g | _         y N)	observers)selfs    r   __init__zObservable.__init__   s	    r   c                     	 t         |   ||      | j                  D ]  } || |        S # | j                  D ]  } || |        w xY wr   )super__setattr__r   )r   namevalueob	__class__s       r   r   zObservable.__setattr__   sP    	7&tU3nn 4dnn 4s	   - A	)__name__
__module____qualname____doc__r   r   r   __classcell__)r   s   @r   r   r      s    .I r   r   c                   .    e Zd ZdZed        ZddZd Zy)Envz!A dict for environment variables.c                  4    t        t        j                        S )z.Returns a snapshot of the current environment.)r$   osenvironr   r   r   snapshotzEnv.snapshot&   s     2::r   Nc                 B    t        |       }||j                  |       |S r   )r$   update)r   updated_fromresults      r   copyzEnv.copy+   s"    T#MM,'r   c                 x    	 t         j                  j                  | |   z   }||z   | |<   y# t        $ r d}Y w xY w)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tails       r   
prepend_tozEnv.prepend_to1   sB    	77??T#Y.D DLS	  	D	s    + 99r   )r   r   r    r!   staticmethodr(   r-   r5   r   r   r   r$   r$   #   s!    + !r   r$   c                 \    t        | t              r| j                  ||      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errorss      r   	force_strr@   <   s'     *4Au)=188Hf%I3q6Ir   c                     t        | t              r| j                  ||      S t        |       } |dk(  r| j	                  ||       | 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.
    strict)r8   r;   encoder9   r:   r<   s      r   force_bytesrD   C   sC     !Sxx&))!HXHHXv&r   c                     t        | d|      S )z'Same as force_bytes(s, "ascii", errors)asciirD   r=   r?   s     r   force_asciirI   T   s    q'6**r   c                     t        | d|      S )z&Same as force_bytes(s, "utf8", errors)utf8rG   rH   s     r   
force_utf8rL   Y   s    q&&))r   c                    	 | j                   }|r	 t        |      }t	        |dd      S # t        $ r@ 	 | j                  }n/# t        $ r# 	 t        |       }d}n# t        $ r Y Y Y yw xY wY nw xY wY cw xY w# t        $ r Y dw xY w)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.
    Fz	<unknown>zutf-8replace)r    	Exceptionr   reprr@   )objquoter   s      r   nameofrS   ^   s     	:D T7I..%  
		<<D 	Cy   #"# 	
  		sl   ) A5 	A2A A2 	A,
AA,	A&!A,"A2%A&&A,)A2+A,,A21A25	B Bc                     t        | d      }	 t        j                  |       }|d|z  }	 t        j                  |       \  }}|d| z  }|dz  }|S # t        $ r Y w xY w# t        $ r Y |S w xY w)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)rR   z (file z, line ))rS   inspectgetsourcefilegetsourcelinesrO   )rQ   r   src_file_
src_linenos        r   	srcnameofr\   ~   s     #T"D((- 	'(&&	+#2237MAz gj\**DK  		   Ks"   A# A 	A A #	A0/A0c                  &    dt         j                  vS )z>Returns True if the caller should hide something from debugpy.DEBUGPY_TRACE_DEBUGPY)r&   r'   r   r   r   hide_debugpy_internalsr_      s    ""**44r   c                 6    t               rd| _        d| _        yy)zDisables tracing for the given thread if DEBUGPY_TRACE_DEBUGPY is not set.
    DEBUGPY_TRACE_DEBUGPY is used to debug debugpy with debugpy
    TN)r_   pydev_do_not_traceis_pydev_daemon_thread)threads    r   hide_thread_from_debuggerrd      s     $(!(,%  r   )rB   )F)rV   r&   r   __file__r   objectr   dictr$   r@   rD   rI   rL   rS   r\   r_   rd   r   r   r   <module>rh      s^   
  	 
 !v '  !$ !2J"+
*
/@65
-r   