
    "e/                         d dl mZmZmZ d dlmZ d dlmZmZ d dl	Z	d dl
mZ dZ G d d      Zd	 Z e         G d
 d      Zd ZddZd Zy)    )get_current_thread_idNullForkSafeLock)*get_abs_path_real_path_and_base_from_frame)thread	threadingN)	pydev_logFc                       e Zd ZdZdZdZdZy)CustomFramesContainerN)__name__
__module____qualname__custom_frames_lockcustom_frames_next_frame_id_py_db_command_thread_event     E/usr/lib/python3/dist-packages/_pydevd_bundle/pydevd_custom_frames.pyr   r   
   s     MN"&r   r   c                  |    t               t        _        i t        _        dt        _        t               t        _        y Nr   )r   r   r   r   r   r   r   r   r   r   custom_frames_container_initr      s0    /;~, +-' ,-( 9=5r   c                       e Zd Zd Zy)CustomFramec                 <    || _         || _        d| _        || _        y r   )nameframemod_time	thread_id)selfr   r   r   s       r   __init__zCustomFrame.__init__.   s$    	 
  #r   N)r   r   r   r!   r   r   r   r   r   ,   s    #r   r   c                    t         j                  5  t        t        j                               }t         j
                  dz   x}t         _        d|d|}t        rVt        j                  j                  d|dt        |       d   d| j                  d| j                  j                  d		       t        || |      t         j                  |<   t         j                   j#                          |cd
d
d
       S # 1 sw Y   y
xY w)aQ  
    It's possible to show paused frames by adding a custom frame through this API (it's
    intended to be used for coroutines, but could potentially be used for generators too).

    :param frame:
        The topmost frame to be shown paused when a thread with thread.ident == thread_id is paused.

    :param name:
        The name to be shown for the custom thread in the UI.

    :param thread_id:
        The thread id to which this frame is related (must match thread.ident).

    :return: str
        Returns the custom thread id which will be used to show the given frame paused.
       z
__frame__:|zadd_custom_frame: z (z)  
N)r   r   r   r   current_threadr   DEBUGsysstderrwriter   f_linenof_codeco_namer   r   r   set)r   r   r   curr_thread_idnext_idframe_custom_thread_ids         r   add_custom_framer4   <   s    " 
	1	1 &.y/G/G/IJ9N9]9]`a9aa'6 7>~!NJJ&(RSX(YZ\(]_d_m_moto{o{  pD  pDE F GRRVX]_hFi++,BC99==?%& & &s   CC88Dc                    t         j                  5  t        r"t        j                  j                  d| z         	 t         j                  |    }|||_        |xj                  dz  c_        ||_	        t         j                  j                          d d d        y #  t        j                  j                  d| d       t        j                          Y bxY w# 1 sw Y   y xY w)Nzupdate_custom_frame: %s
r#   z Unable to get frame to replace: r'   )r   r   r)   r*   r+   r,   r   r   r   r   r	   	exceptionr   r0   )r3   r   r   r   olds        r   update_custom_framer8   ]   s    		1	1 @JJ8;QQR	"'556LMCLLAL%CM
 	99==?@ @	"JJG]_`!@ @s"   )C8B3C9CCC!c                    t         j                  5  t        r"t        j                  j                  d| z         t         j                  j                  | d        t         j                  j                          d d d        y # 1 sw Y   y xY w)Nzremove_custom_frame: %s
)
r   r   r)   r*   r+   r,   r   popr   r0   )r3   s    r   remove_custom_framer;   n   si    		1	1 @JJ8;QQR++//0FM99==?	@ @ @s   A'BB
)N)_pydevd_bundle.pydevd_constantsr   r   r   pydevd_file_utilsr   "_pydev_bundle._pydev_saved_modulesr   r   r*   _pydev_bundler	   r)   r   r   r   r4   r8   r;   r   r   r   <module>r@      sO    U U H @ 
 #	' 	'?&  # # &B@"@r   