
    Xh&                     P   d dl Z d dlmZ d dlZd dlZddlmZ ej                  j                  ej                  j                  e
            Zd ej                  e      vrej                  j                  e      ZddZd ZddZd	 Zd
 ZddZe j&                  dd       Zd Zy)    N)import_module   )_utilpydevdc                 L    dg}| s|S |D cg c]  }t        |       c}S c c}w )z%Return the list of vendored projects.r   )project_root)resolveprojectsnames      N/var/www/html/myenv/lib/python3.12/site-packages/debugpy/_vendored/__init__.pylist_allr      s,     zH+344L444s   !c                 R    | sd} t         j                  j                  t        |       S )zReturn the path the root dir of the vendored project.

    If "project" is an empty string then the path prefix for vendored
    projects (e.g. "debugpy/_vendored/") will be returned.
     )ospathjoinVENDORED_ROOT)projects    r   r   r      s!     77<<w//    c              +     K   |rCt        j                  t              5  t        j                  | fi |D ]  }|  	 ddd       yt	        |       }t        j                  |fi |D ]  }|  y# 1 sw Y   yxY ww)zAYield (dirname, basename, filename) for all files in the project.N)r   cwdr   iter_all_filesr   )r   relativekwargsresultroots        r   iter_project_filesr   (   s     YY}% 	..wA&A 	 	 G$**4:6: 	FL		 	s   A? A34A?3A<8A?c              #      K   d}d}	 t        dj                  |       t              }t        |d|      }t        |d|      }t        | d||      }|D ]
  \  }}}|  y# t        $ r Y *w xY ww)zYield the filenames for all files in the project.

    The filenames are relative to "debugpy/_vendored".  This is most
    useful for the "package data" in a setup.py.
    Nz._{}_packaging	prune_direxclude_fileT)r   r   r    )r   format__name__getattrImportErrorr   )r   r   r    modresults_filenames          r   iter_packaging_filesr)   4   s      ILB,33G<hG Ci8	sNLA $),G " 1h  s'   A/A  9A/ 	A,)A/+A,,A/c                        sJ  fd}|S )zBReturn a module match func that matches any of the given prefixes.c                 :    D ]  }| j                  |      s y y)NTF)
startswith)r   moduleprefixprefixess      r   matchzprefix_matcher.<locals>.matchO   s&     	Fv&	 r    )r/   r0   s   ` r   prefix_matcherr2   K   s    O8 Lr   c                 "   |t        |       }g }i }t        t        j                  j	                               D ]H  \  }} |||      s	 t        |dd      }|s|j                  |       2|j                  |      rD|||<   J ||fS #  d}Y 7xY w)z5Verify that only vendored modules have been imported.N__file__)r   listsysmodulesitemsr#   appendr,   )r   r0   r   
extensions
unvendoredmodnamer%   r(   s           r   check_modulesr=   Y   s    |G$JJS[[..01 
+Wc"	sJ5H g&$$T*"*Jw
+ z!!	Hs   
BBc              #      K   |t        |       }t        j                  j                  d|       	 | t        j                  j	                  |       y# t        j                  j	                  |       w xY ww)zDA context manager under which the vendored project will be imported.Nr   )r   r6   r   insertremove)r   r   s     r   vendoredrA   m   sS      |G$HHOOAt
s   .A9A  A9!A66A9c                 l    t        | fi |5  |D ]  }t        |        	 ddd       y# 1 sw Y   yxY w)z=Import each of the named modules out of the vendored project.N)rA   r   )r   r7   r   r   s       r   	preimportrC   z   s;    	'	$V	$   	 D$	      s   *3)F)N)
contextlib	importlibr   r   r6   r   r   r   dirnameabspathr4   r   listdirr   r   r   r)   r2   r=   contextmanagerrA   rC   r1   r   r   <module>rJ      s   
  # 	 
   9: :2::m,,GGOOM2M50	."( 	 	 r   