3 ָVX� � @ s$ d dl Z G dd� de�Zdd� ZdS )� Nc @ s6 e Zd ZdZdd� Zdd� Zddd�Zed d � �ZdS )�Exitable�_at_exit_cbsc C s6 y | j W n tk r$ g | _ Y nX | j j|� d S )N)r �AttributeError�append)�self�cb� r �/usr/lib/python3.6/exitable.py�_at_exit s zExitable._at_exitc C s | S )Nr )r r r r � __enter__ s zExitable.__enter__Nc C sr | j r d S x\t| j�D ]N}d}ytj||||� W n tk rJ d}Y nX |r^||||� q|� qW d | _d S )NTF)�_exited�reversedr �inspectZgetcallargs� TypeError)r �exc_type� exc_value� tracebackr Z call_with_excr r r �__exit__ s zExitable.__exit__c C s$ y | j d kS tk r dS X d S )NT)r r )r r r r r # s zExitable._exited)NNN) �__name__� __module__�__qualname__� __slots__r r r �propertyr r r r r r s r c G s6 G dd� dt �}dd� }x| D ]}t|||� qW |S )Nc @ s e Zd ZdS )z+ExitableWithAliases.<locals>.CustomExitableN)r r r r r r r �CustomExitable+ s r c S s | j � d S )N)r )r r r r �exit. s z!ExitableWithAliases.<locals>.exit)r �setattr)Zexit_methodsr r Zexit_method_namer r r �ExitableWithAliases* s r )r �objectr r r r r r �<module> s '