U
    ‡ª/e0  ã                   @   s>   d dl Z d dlZe jdd„ ƒZd
dd„Zddd„Zdd	„ ZdS )é    Nc              	   c   s.   t  ¡ }t  | ¡ z
|V  W 5 t  |¡ X dS )z9A context manager for operating in a different directory.N)ÚosÚgetcwdÚchdir)ÚdirnameÚorig© r   ú;/tmp/pip-unpacked-wheel-dg3irmqq/debugpy/_vendored/_util.pyÚcwd	   s
    

r	   c                 c   s4   | g}|r0|  d¡}t||||ƒD ]
}|V  q"qdS )zŸYield (dirname, basename, filename) for each file in the tree.

    This is an alternative to os.walk() that flattens out the tree and
    with filtering.
    r   N)ÚpopÚ_iter_files)ÚrootÚ	prune_dirÚexclude_fileÚpendingr   Úresultr   r   r   Úiter_all_files   s
    
r   c           	      c   sP   | g}|rL|  d¡}g }t||||ƒD ]\}}}| ||f¡ q&||fV  qdS )z²Yield (dirname, files) for each directory in the tree.

    The list of files is actually a list of (basename, filename).

    This is an alternative to os.walk() with filtering.r   N)r
   r   Úappend)	r   r   r   r   r   ÚfilesÚ_ÚbÚfr   r   r   Ú	iter_tree!   s    
r   c                 c   sn   t  | ¡D ]^}t j | |¡}t j |¡rH|d k	r<|| |ƒr<q
| |¡ q
|d k	r\|| |ƒr\q
| ||fV  q
d S )N)r   ÚlistdirÚpathÚjoinÚisdirr   )r   Úsubdirsr   r   ÚbasenameÚfilenamer   r   r   r   0   s    r   )NN)NN)Ú
contextlibr   Úcontextmanagerr	   r   r   r   r   r   r   r   Ú<module>   s   



