a
    ø£Bei  ã                   @   s,   d Z ddlZddlmZ G dd„ deƒZdS )z+Backport of Python 3.11's contextlib.chdir.é    N)ÚAbstractContextManagerc                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚchdirzHNon thread-safe context manager to change the current working directory.c                 C   s   || _ g | _dS )zInitialize the manager.N)ÚpathÚ_old_cwd)Úselfr   © r   úd/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/nbconvert/utils/_contextlib_chdir.pyÚ__init__   s    zchdir.__init__c                 C   s    | j  t ¡ ¡ t | j¡ dS )zEnter the context.N)r   ÚappendÚosÚgetcwdr   r   )r   r   r   r   Ú	__enter__   s    zchdir.__enter__c                 G   s   t  | j ¡ ¡ dS )zExit the context.N)r   r   r   Úpop)r   Úexcinfor   r   r   Ú__exit__   s    zchdir.__exit__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   r   r   r   r   r   r   r      s   r   )r   r   Ú
contextlibr   r   r   r   r   r   Ú<module>   s   