/
proc
/
self
/
root
/
lib
/
python3
/
dist-packages
/
certbot
/
_internal
/
__pycache__
/
Upload File
HOME
� E��c � � � d Z ddlZddlZddlZddlZddlmZ ddlmZ ddlm Z ddlm Z ddlmZ ddlmZ dd lm Z dd lmZ ddlmZ ddlmZ ej e� � Zej d k rTej gZej ej ej ej fD ]0Z ej e� � ej k re� e� � �1ng Z G d� d� � Z! G d� de!� � Z"dS )zBRegisters functions to be called if an exception or signal occurs.� N)� TracebackType)�Any)�Callable)�Dict)�List)�Optional)�Type)�Union)�errors)�os�ntc �� � e Zd ZdZdedef dededdfd�Zdd �Zd ee e dee dee defd �Z dedef dededdfd�Zdd�Zdd�Zdd�Zdededdfd�Zdd�ZdS )�ErrorHandleraG Context manager for running code that must be cleaned up on failure. The context manager allows you to register functions that will be called when an exception (excluding SystemExit) or signal is encountered. Usage:: handler = ErrorHandler(cleanup1_func, *cleanup1_args, **cleanup1_kwargs) handler.register(cleanup2_func, *cleanup2_args, **cleanup2_kwargs) with handler: do_something() Or for one cleanup function:: with ErrorHandler(func, args, kwargs): do_something() If an exception is raised out of do_something, the cleanup functions will be called in last in first out order. Then the exception is raised. Similarly, if a signal is encountered, the cleanup functions are called followed by the previously received signal handler. Each registered cleanup function is called exactly once. If a registered function raises an exception, it is logged and the next function is called. Signals received while the registered functions are executing are deferred until they finish. �func.�args�kwargs�returnNc �v � d| _ d| _ g | _ i | _ g | _ |� | j |g|�R i |�� d S d S �NF)�call_on_regular_exit� body_executed�funcs� prev_handlers�received_signals�register��selfr r r s �A/usr/lib/python3/dist-packages/certbot/_internal/error_handler.py�__init__zErrorHandler.__init__P s_ � �$)��!�"���.0�� �DF���+-������D�M�$�0��0�0�0��0�0�0�0�0� �� c �<