Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : fdshops ( 1003)
PHP Version : 8.2.21
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/certbot/_internal/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/certbot/_internal/error_handler.pyo
�
���_c@sZdZddlZddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	l
mZeje�Zejd
kr$ejgZxWejejejejgD].Zeje�ejkr�eje�q�q�WngZdefd��YZd
efd��YZdS(sBRegisters functions to be called if an exception or signal occurs.i����N(tAny(tCallable(tDict(tList(tUnion(terrors(tostnttErrorHandlercBs_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
sGContext 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.

    cOsSt|_t|_g|_i|_g|_|dk	rO|j|||�ndS(N(tFalsetcall_on_regular_exitt
body_executedtfuncst
prev_handlerstreceived_signalstNonetregister(tselftfunctargstkwargs((sC/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.pyt__init__Ms					cCst|_|j�dS(N(R	Rt_set_signal_handlers(R((sC/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.pyt	__enter__Vs	cCs�t|_t}|tkr|S|dkr;|js�|SnS|tjkrftj	d|j
�t}n(tj	ddjtj
|||���|j�|j�|j�|S(NsEncountered signals: %ssEncountered exception:
%st(tTrueRR	t
SystemExitRR
Rt
SignalExittloggertdebugRtjoint	tracebacktformat_exceptiont_call_registeredt_reset_signal_handlerst
_call_signals(Rt	exec_typet
exec_valuettracetretval((sC/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.pyt__exit__Zs 			


cOs#|jjtj|||��dS(s�Sets func to be run with the given arguments during cleanup.

        :param function func: function to be called in case of an error

        N(Rtappendt	functoolstpartial(RRRR((sC/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.pyRoscCs�tjd�xy|jr�y|jd�WnJtk
rw}tjt|�|�}tjddj|�j	��nX|jj
�qWdS(sCalls all registered functionssCalling registered functionsi����s)Encountered exception during recovery: %sRN(RRRt	ExceptionRtformat_exception_onlyttypeterrorRtrstriptpop(Rtexctoutput((sC/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.pyR!xs
	cCsSxLtD]D}tj|�}|dk	r||j|<tj||j�qqWdS(s-Sets signal handlers for signals in _SIGNALS.N(t_SIGNALStsignalt	getsignalRR
t_signal_handler(Rtsignumtprev_handler((sC/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.pyR�s


cCs<x(|jD]}tj||j|�q
W|jj�dS(s/Resets signal handlers for signals in _SIGNALS.N(R
R5tclear(RR8((sC/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.pyR"�scCs)|jj|�|js%tj�ndS(sReplacement function for handling received signals.

        Store the received signal. If we are executing the code block in
        the body of the context manager, stop by raising signal exit.

        :param int signum: number of current signal

        N(RR)RRR(RR8tunused_frame((sC/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.pyR7�s		cCs>x7|jD],}tjd|�tjtj�|�q
WdS(s"Finally call the deferred signals.sCalling signal %sN(RRRRtkilltgetpid(RR8((sC/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.pyR#�s(t__name__t
__module__t__doc__RRR(RR!RR"R7R#(((sC/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.pyR0s											
tExitHandlercBseZdZd�ZRS(s�Context manager for running code that must be cleaned up.

    Subclass of ErrorHandler, with the same usage and parameters.
    In addition to cleaning up on all signals, also cleans up on
    regular exit.
    cOs#tj||||�t|_dS(N(RRRR
(RRRR((sC/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.pyR�s(R>R?R@R(((sC/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.pyRA�s( R@R*tloggingR5Rtacme.magic_typingRRRRRtcertbotRtcertbot.compatRt	getLoggerR>RtnametSIGTERMR4tSIGHUPtSIGQUITtSIGXCPUtSIGXFSZtsignal_codeR6tSIG_IGNR)tobjectRRA(((sC/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.pyt<module>s*v

Spamworldpro Mini