§
    Ètºfús  ã                  ó¨  — d Z ddlmZ ddlZddlZddlZddlZddlZddlm	Z	 ddlm
Z
 ddlmZ ddlmZmZmZ ddlZddlmZ  ed	ed
ef         ¬¦  «        ZdadZ G d„ de¦  «        Zd%d„ZdZ G d„ de¦  «        Zd„ Z G d„ d¦  «        Z G d„ d¦  «        Z G d„ d¦  «        Z g Z!d&d„Z" G d„ de#¦  «        Z$d „ Z%d!Z&dddd"e$j'        fd#„Z(d$„ Z)dS )'z9
Asynchronous-friendly error mechanism.

See L{Failure}.
é    )ÚannotationsN)Úpartial)Úgetmro)ÚStringIO)ÚCallableÚNoReturnÚTypeVar)ÚreflectÚ_T_Callable.)Úboundé   c                  ó   — e Zd ZdS )ÚDefaultExceptionN)Ú__name__Ú
__module__Ú__qualname__© ó    úU/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/python/failure.pyr   r   %   s   € € € € € Ø€Dr   r   Údefaultc           
     óª  — |dvrt          d|›d�¦  «        ‚|}|dk    r!| D ]\  }}}}} ||› d|› d|› d�¦  «         ŒdS |dk    rU| D ]P\  }}}}} |d|› d	|› d
|› d�¦  «          |dt          j        ||¦  «                             ¦   «         z  ¦  «         ŒQdS |dk    r)| D ]\  }}}}} |d|||fz  ¦  «         Œ |d¦  «         dS |dk    r€| D ]\  }}}}} |d|||fz  ¦  «          |d¦  «         |D ]$\  }	}
 |d|	› dt	          |
¦  «        › d�¦  «         Œ% |d¦  «         |D ]$\  }	}
 |d|	› dt	          |
¦  «        › d�¦  «         Œ%Œ~dS dS )a˜  
    Format and write frames.

    @param frames: is a list of frames as used by Failure.frames, with
        each frame being a list of
        (funcName, fileName, lineNumber, locals.items(), globals.items())
    @type frames: list
    @param write: this will be called with formatted strings.
    @type write: callable
    @param detail: Four detail levels are available:
        default, brief, verbose, and verbose-vars-not-captured.
        C{Failure.printDetailedTraceback} uses the latter when the caller asks
        for verbose, but no vars were captured, so that an explicit warning
        about the missing data is shown.
    @type detail: string
    )r   ÚbriefÚverboseúverbose-vars-not-capturedzKDetail must be default, brief, verbose, or verbose-vars-not-captured. (not ú)r   ú:ú
r   z  File "z", line z, in z    %s
r   z%s:%d: %s(...)
zA [Capture of Locals and Globals disabled (use captureVars=True)]
r   z [ Locals ]
z  z : z ( Globals )
N)Ú
ValueErrorÚ	linecacheÚgetlineÚstripÚrepr)ÚframesÚwriteÚdetailÚwÚmethodÚfilenameÚlinenoÚ	localVarsÚ
globalVarsÚnameÚvals              r   Úformat_framesr.   )   s{  € ð" ÐQÐQÐQÝˆjà5;°V°Vð>ñ
ô 
ð 	
ð 	€AØ�ÒÐØ?Eð 	1ð 	1Ñ;ˆF�H˜f i°ØˆA�Ð/Ð/˜FÐ/Ð/ VÐ/Ð/Ð/Ñ0Ô0Ð0Ð0ð	1ð 	1à	�9Ò	Ð	Ø?Eð 	Hð 	HÑ;ˆF�H˜f i°ØˆAÐB˜ÐBÐB¨6ÐBÐB¸ÐBÐBÐBÑCÔCÐCØˆAˆj�9Ô,¨X°vÑ>Ô>×DÒDÑFÔFÑFÑGÔGÐGÐGð	Hð 	Hð 
Ð.Ò	.Ð	.Ø?Eð 	?ð 	?Ñ;ˆF�H˜f i°ØˆAÐ  H¨f°fÐ#=Ñ=Ñ>Ô>Ð>Ð>Ø	ˆÐ
NÑOÔOÐOÐOÐOØ	�9Ò	Ð	Ø?Eð 	/ð 	/Ñ;ˆF�H˜f i°ØˆAÐ  H¨f°fÐ#=Ñ=Ñ>Ô>Ð>ØˆAˆoÑÔÐà&ð /ð /‘	��cØ�Ð-�tÐ-Ð-¥ S¡	¤	Ð-Ð-Ð-Ñ.Ô.Ð.Ð.ØˆAÐÑÔÐØ'ð /ð /‘	��cØ�Ð-�tÐ-Ð-¥ S¡	¤	Ð-Ð-Ð-Ñ.Ô.Ð.Ð.ð/ð 
Ð	ð	/ð 	/r   z--- <exception caught here> ---c                  ó   — e Zd ZdZdS )ÚNoCurrentExceptionErrorzŠ
    Raised when trying to create a Failure from the current interpreter
    exception state and there is no current exception state.
    N)r   r   r   Ú__doc__r   r   r   r0   r0   \   s   € € € € € ðð ð ð r   r0   c                ó,  — t          |¦  «        dk    s
J d¦   «         ‚d}| D ]}t          ||¦  «        }Œt          |d         |¦  «        }t          |¦  «        x}}|dd…         D ]-}t          ||¦  «        }t          |¦  «        |_        |j        }Œ.|S )a5  
    Construct a fake traceback object using a list of frames.

    It should have the same API as stdlib to allow interaction with
    other tools.

    @param stackFrames: [(methodname, filename, lineno, locals, globals), ...]
    @param tbFrames: [(methodname, filename, lineno, locals, globals), ...]
    r   zMust pass some framesNé   )ÚlenÚ_FrameÚ_TracebackFrameÚtb_next)ÚstackFramesÚtbFramesÚstackÚsfÚfirstTbÚtbs         r   Ú
_Tracebackr>   c   s·   € õ ˆx‰=Œ=˜1ÒÐÐÐ5ÑÔÐð €EØð "ð "ˆÝ�r˜5Ñ!Ô!ˆˆõ �8˜A”; Ñ&Ô&€EÝ" 5Ñ)Ô)Ð)€GˆbØ�q�r�rŒlð ð ˆÝ�r˜5Ñ!Ô!ˆÝ$ UÑ+Ô+ˆŒ
ØŒZˆˆð €Nr   c                  ó   — e Zd ZdZd„ ZdS )r6   zq
    Fake traceback object which can be passed to functions in the standard
    library L{traceback} module.
    c                óR   — || _         |j        | _        |j        | _        d| _        dS )z-
        @param frame: _Frame object
        N)Útb_frameÚf_linenoÚ	tb_linenoÚf_lastiÚtb_lastir7   )ÚselfÚframes     r   Ú__init__z_TracebackFrame.__init__’   s(   € ð ˆŒØœˆŒØœˆŒØˆŒˆˆr   N©r   r   r   r1   rH   r   r   r   r6   r6   Œ   s-   € € € € € ðð ð
ð ð ð ð r   r6   c                  ó   — e Zd ZdZd„ ZdS )r5   aD  
    A fake frame object, used by L{_Traceback}.

    @ivar f_code: fake L{code<types.CodeType>} object
    @ivar f_lineno: line number
    @ivar f_globals: fake f_globals dictionary (usually empty)
    @ivar f_locals: fake f_locals dictionary (usually empty)
    @ivar f_back: previous stack frame (towards the caller)
    c                ó&  — |\  }}}}}t          ||¦  «        | _        || _        t          |pi ¦  «        | _        t          |pi ¦  «        | _        || _        d| _        t          t          ¦  «         
                    ¦   «         | _        d| _        dS )z¢
        @param frameinfo: (methodname, filename, lineno, locals, globals)
        @param back: previous (older) stack frame
        @type back: C{frame}
        r   N)Ú_CodeÚf_coderB   ÚdictÚ	f_globalsÚf_localsÚf_backrD   ÚvarsÚbuiltinsÚcopyÚ
f_builtinsÚf_trace)rF   Ú	frameinfoÚbackr,   r(   r)   ÚlocalzÚglobalzs           r   rH   z_Frame.__init__§   s„   € ð 3<Ñ/ˆˆh˜ ¨Ý˜D (Ñ+Ô+ˆŒØˆŒÝ˜g˜m¨Ñ,Ô,ˆŒÝ˜V˜\ rÑ*Ô*ˆŒØˆŒØˆŒÝ�x™.œ.×-Ò-Ñ/Ô/ˆŒØˆŒˆˆr   NrI   r   r   r   r5   r5   œ   s-   € € € € € ðð ðð ð ð ð r   r5   c                  ó   — e Zd ZdZd„ Zd„ ZdS )rL   zÉ
    A fake code object, used by L{_Traceback} via L{_Frame}.

    It is intended to have the same API as the stdlib code type to allow
    interoperation with other tools based on that interface.
    c                óæ   — || _         || _        d| _        d| _        d| _        g | _        d| _        d| _        d| _        d| _	        d| _
        d| _        d| _        d| _        d| _        d| _        d S )Nr   r   r   )Úco_nameÚco_filenameÚ	co_lnotabÚco_firstlinenoÚco_argcountÚco_varnamesÚco_codeÚco_cellvarsÚ	co_constsÚco_flagsÚco_freevarsÚco_posonlyargcountÚco_kwonlyargcountÚco_namesÚ
co_nlocalsÚco_stacksize)rF   r,   r(   s      r   rH   z_Code.__init__À   s�   € ØˆŒØ#ˆÔØˆŒØˆÔØˆÔØˆÔØˆŒØˆÔØˆŒØˆŒØˆÔØ"#ˆÔØ!"ˆÔØˆŒØˆŒØˆÔÐÐr   c                ó   — dS )N))NNNNr   ©rF   s    r   Úco_positionsz_Code.co_positionsÒ   s   € Ø*Ð*r   N)r   r   r   r1   rH   ro   r   r   r   rL   rL   ¸   s<   € € € € € ðð ðð ð ð$+ð +ð +ð +ð +r   rL   ÚfÚreturnc                óD   — t                                | j        ¦  «         | S )a  
    Mark the given callable as extraneous to inlineCallbacks exception
    reporting; don't show these functions.

    @param f: a function that you NEVER WANT TO SEE AGAIN in ANY TRACEBACK
        reported by Failure.

    @type f: function

    @return: f
    )Ú_inlineCallbacksExtraneousÚappendÚ__code__)rp   s    r   Ú_extraneousrv   Ù   s   € õ ×%Ò% a¤jÑ1Ô1Ð1Ø€Hr   c                  ó4  — e Zd ZdZdZdZdZej        d         Z	d&d„Z
ed„ ¦   «         Zej        d„ ¦   «         Zd	„ Zed'd„¦   «         Zd„ Zd„ Zd(d„Zed„ ¦   «         Zed„ ¦   «         Zd)d„Zd)d„Zd„ Zd„ Zd„ Zd„ Zd„ Zd)d„Zd)d„Z d*d+d"„Z!d,d#„Z"d-d$„Z#d-d%„Z$dS ).ÚFailureaì  
    A basic abstraction for an error that has occurred.

    This is necessary because Python's built-in error mechanisms are
    inconvenient for asynchronous communication.

    The C{stack} and C{frame} attributes contain frames.  Each frame is a tuple
    of (funcName, fileName, lineNumber, localsItems, globalsItems), where
    localsItems and globalsItems are the contents of
    C{locals().items()}/C{globals().items()} for that frame, or an empty tuple
    if those details were not captured.

    @ivar value: The exception instance responsible for this failure.
    @ivar type: The exception's class.
    @ivar stack: list of frames, innermost last, excluding C{Failure.__init__}.
    @ivar frames: list of frames, innermost first.
    r   NÚYIELD_VALUEFc                óÄ  — t           dz   a t           | _         dx| _        x| _        }|| _        d}|€|                      ¦   «         }|€9t          j        ¦   «         \  | _        | _        }| j        €t          ¦   «         ‚d}nN|€>t          |t          ¦  «        r|j
        | _        nt          |¦  «        | _        || _        n|| _        || _        t          | j        t          ¦  «        r|                      | j        ¦  «         dS t          | j        d¦  «        r(|                      | j        j        ¦  «         | j        `dS |€'|r|}n"t          | j        dd¦  «        r| j        j        }g x}| _        g x}| _        || _        |r|j        }	nt          | j        t          ¦  «        sdx}	}|r|	r|	j        }	|dz  }|r|	°|	r½|rz|	j                             ¦   «         }
|	j        |	j        u ri }n|	j                             ¦   «         }||
fD ]	}d|v r|d= Œ
|
                     ¦   «         }
|                     ¦   «         }ndx}
}|                     d|	j        j        |	j        j        |	j        |
|f¦  «         |	j        }	|	°½|�ß|j        }	|r”|	j                             ¦   «         }
|	j        |	j        u ri }n|	j                             ¦   «         }||
fD ]	}d|v r|d= Œ
t?          |
                     ¦   «         ¦  «        }
t?          |                     ¦   «         ¦  «        }ndx}
}|                      |	j        j        |	j        j        |j!        |
|f¦  «         |j"        }|­ÝdS dS )a-  
        Initialize me with an explanation of the error.

        By default, this will use the current C{exception}
        (L{sys.exc_info}()).  However, if you want to specify a
        particular kind of failure, you can pass an exception as an
        argument.

        If no C{exc_value} is passed, then an "original" C{Failure} will
        be searched for. If the current exception handler that this
        C{Failure} is being constructed in is handling an exception
        raised by L{raiseException}, then this C{Failure} will act like
        the original C{Failure}.

        For C{exc_tb} only L{traceback} instances or L{None} are allowed.
        If L{None} is supplied for C{exc_value}, the value of C{exc_tb} is
        ignored, otherwise if C{exc_tb} is L{None}, it will be found from
        execution context (ie, L{sys.exc_info}).

        @param captureVars: if set, capture locals and globals of stack
            frames.  This is pretty slow, and makes no difference unless you
            are going to use L{printDetailedTraceback}.
        r3   Nr   Ú__failure__Ú__traceback__Ú__builtins__r   )#ÚcountÚtypeÚvalueÚcaptureVarsÚ_findFailureÚsysÚexc_infor0   Ú
isinstanceÚ	ExceptionÚ	__class__rx   Ú_extrapolateÚhasattrr{   Úgetattrr|   r#   r:   r=   rA   rQ   rP   rT   rO   ÚitemsÚinsertrM   r]   r^   rB   Úlistrt   rC   r7   )rF   Ú	exc_valueÚexc_typeÚexc_tbr�   r=   ÚstackOffsetr#   r:   rp   rY   rZ   Úds                r   rH   zFailure.__init__  sÒ  € õ2 ˜‘	ˆÝˆŒ
Ø&*Ð*ˆŒ	Ð*�D”J Ø&ˆÔàˆàÐØ×)Ò)Ñ+Ô+ˆIàÐÝ(+¬©¬Ñ%ˆDŒI�t”z 2ØŒyÐ Ý-Ñ/Ô/Ð/ØˆKˆKØÐÝ˜)¥YÑ/Ô/ð ,Ø%Ô/�”	�	õ ! ™OœO�”	Ø"ˆDŒJˆJà ˆDŒIØ"ˆDŒJå�d”j¥'Ñ*Ô*ð 	Ø×Ò˜dœjÑ)Ô)Ð)ØˆFå�4”:˜}Ñ-Ô-ð 	ð ×Ò˜dœjÔ4Ñ5Ô5Ð5ð ”
Ð&ØˆFàˆ:Øð .Ø��Ý˜œ _°dÑ;Ô;ð .à”ZÔ-�à!Ð!ˆ�”ØÐˆ�”
ð
 ˆŒàð 	#Ø”ˆAˆAÝ˜DœJ­Ñ0Ô0ð 	#ð #Ð"ˆA�àð 	˜að 	ð ”ˆAØ˜1ÑˆKð	 ð 	˜að 	ð ð 	Øð &ØœŸšÑ*Ô*�Ø”: ¤Ð,Ð,Ø �G�Gàœk×.Ò.Ñ0Ô0�GØ  &˜ð .ð .�AØ%¨Ð*Ð*Ø˜nÐ-øØŸš™œ�Ø!Ÿ-š-™/œ/��à#%Ð%�˜Ø�LŠLØà”HÔ$Ø”HÔ(Ø”JØØðñ	ô 	ð 	ð ”ˆAð1 ð 	ð4 ˆnØ”ˆAØð &ØœŸšÑ*Ô*�Ø”: ¤Ð,Ð,Ø �G�Gàœk×.Ò.Ñ0Ô0�GØ  &˜ð .ð .�AØ%¨Ð*Ð*Ø˜nÐ-øÝ˜fŸlšl™nœnÑ-Ô-�Ý˜wŸ}š}™œÑ/Ô/��à#%Ð%�˜Ø�MŠMà”HÔ$Ø”HÔ(Ø”LØØðñô ð ð ”ˆBð1 ˆnˆnˆnˆnˆnr   c                ó.  — | j         �| j         S t          j        | j        ¦  «        r[t	          | j        t
          ¦  «        rAt          | j        ¦  «        }t          t          t          j
        |¦  «        ¦  «        | _         n| j        g| _         | j         S ©N)Ú_parentsÚinspectÚisclassr   Ú
issubclassr†   r   r�   Úmapr
   Úqual)rF   ÚparentCss     r   ÚparentszFailure.parents¤  sx   € àŒ=Ð$Ø”=Ð åŒ?˜4œ9Ñ%Ô%ð 	(­*°T´YÅ	Ñ*JÔ*Jð 	(Ý˜dœiÑ(Ô(ˆHÝ ¥¥W¤\°8Ñ!<Ô!<Ñ=Ô=ˆDŒMˆMà!œY˜KˆDŒMØŒ}Ðr   c                ó   — || _         d S r”   )r•   )rF   rœ   s     r   rœ   zFailure.parents°  s   € àˆŒˆˆr   c                ó\  — t          j         |j        ¦  «        | _        t          j        ¦   «         \  }}}g }|�Q|j        }|j        t          vr3|                     |j        j        |j        j	        |j
        ddf¦  «         |j        }|­Q|                     | j        ¦  «         || _        dS )a,  
        Extrapolate from one failure into another, copying its stack frames.

        @param otherFailure: Another L{Failure}, whose traceback information,
            if any, should be preserved as part of the stack presented by this
            one.
        @type otherFailure: L{Failure}
        Nr   )rT   Ú__dict__rƒ   r„   rA   rM   rs   rt   r]   r^   rC   r7   Úextendr#   )rF   ÚotherFailureÚ_r=   r#   rp   s         r   rˆ   zFailure._extrapolate´  s«   € õ œ	 ,Ô"7Ñ8Ô8ˆŒõ ”<‘>”>‰ˆˆ1ˆbØˆØˆnØ”ˆAØŒxÕ9Ð9Ð9Ø—’Ø”XÔ% q¤xÔ';¸R¼\È2ÈrÐRñô ð ð ”ˆBð ˆnð 	�Š�d”kÑ"Ô"Ð"ØˆŒˆˆr   r€   ÚBaseExceptionrq   c                óÎ   — t                                t           ¦  «        }t          dz  ad|_        t          |_        g |_        g |_        | |_        | j        |_        d|_	        |S )z¨
        Create a L{Failure} for an exception without a traceback.

        By restricting the inputs significantly, this constructor runs much
        faster.
        r3   FN)
rx   Ú__new__r~   r�   r#   r:   r€   r‡   r   r=   )r€   Úresults     r   Ú_withoutTracebackzFailure._withoutTracebackÑ  sW   € õ —’¥Ñ)Ô)ˆå�‰
ˆØ"ˆÔÝˆŒØˆŒØˆŒØˆŒØ”oˆŒØˆŒ	Øˆr   c                óF   —  | j         |Ž }|s|                      ¦   «          |S )a€  
        Trap this failure if its type is in a predetermined list.

        This allows you to trap a Failure in an error callback.  It will be
        automatically re-raised if it is not a type that you expect.

        The reason for having this particular API is because it's very useful
        in Deferred errback chains::

            def _ebFoo(self, failure):
                r = failure.trap(Spam, Eggs)
                print('The Failure is due to either Spam or Eggs!')
                if r == Spam:
                    print('Spam did it!')
                elif r == Eggs:
                    print('Eggs did it!')

        If the failure is not a Spam or an Eggs, then the Failure will be
        'passed on' to the next errback. In Python 2 the Failure will be
        raised; in Python 3 the underlying exception will be re-raised.

        @type errorTypes: L{Exception}
        )ÚcheckÚraiseException)rF   Ú
errorTypesÚerrors      r   ÚtrapzFailure.trapå  s1   € ð0 �”
˜JÐ'ˆØð 	"Ø×ÒÑ!Ô!Ð!Øˆr   c                ó¨   — |D ]N}|}t          j        |¦  «        r)t          |t          ¦  «        rt	          j        |¦  «        }|| j        v r|c S ŒOdS )a  
        Check if this failure's type is in a predetermined list.

        @type errorTypes: list of L{Exception} classes or
                          fully-qualified class names.
        @returns: the matching L{Exception} type, or None if no match.
        N)r–   r—   r˜   r†   r
   rš   rœ   )rF   r«   r¬   Úerrs       r   r©   zFailure.check  sj   € ð  ð 	ð 	ˆEØˆCÝŒ˜uÑ%Ô%ð *­*°U½IÑ*FÔ*Fð *Ý”l 5Ñ)Ô)�Ø�d”lÐ"Ð"Ø���ð #àˆtr   r   c                ó@   — | j                              | j        ¦  «        ‚)zf
        raise the original exception, preserving traceback
        information if available.
        )r€   Úwith_tracebackr=   rn   s    r   rª   zFailure.raiseException  s   € ð
 Œj×'Ò'¨¬Ñ0Ô0Ð0r   c                óf   — |                      | j                             | j        ¦  «        ¦  «        S )aJ  
        Throw the original exception into the given generator,
        preserving traceback information if available.

        @return: The next value yielded from the generator.
        @raise StopIteration: If there are no more values in the generator.
        @raise anything else: Anything that the generator raises.
        )Úthrowr€   r±   r=   )rF   Úgs     r   ÚthrowExceptionIntoGeneratorz#Failure.throwExceptionIntoGenerator  s(   € ð �wŠw�t”z×0Ò0°´Ñ9Ô9Ñ:Ô:Ð:r   c                ó   — t          j        ¦   «         d         }|sdS d}|}|j        r|}|j        }|j        °|j        }|j        | j        j        u r|j                             d¦  «        S |j        j	        r |j        j	        |j
                 | j        k    rdS |r4|j        }|j        | j        j        u r|j                             d¦  «        S |j        j        }|r-|j        | j        j        u r|j                             d¦  «        S dS dS )zV
        Find the failure that represents the exception currently in context.
        éÿÿÿÿNrF   )rƒ   r„   r7   rA   rM   rª   ru   rP   Úgetrc   rE   Ú_yieldOpcoderµ   rQ   )Úclsr=   ÚsecondLastTbÚlastTbÚ	lastFramerG   s         r   r‚   zFailure._findFailure'  sC  € õ
 Œ\‰^Œ^˜BÔˆØð 	ØˆFàˆØˆØŒnð 	$Ø!ˆLØ”^ˆFð Œnð 	$ð ”Oˆ	ð Ô˜sÔ1Ô:Ð:Ð:ØÔ%×)Ò)¨&Ñ1Ô1Ð1ð Ô Ô(ð 	¨YÔ-=Ô-EØŒOô.
àÔò.ð .ð ˆFð
 ð 	2Ø Ô)ˆEØŒ|˜sÔ>ÔGÐGÐGØ”~×)Ò)¨&Ñ1Ô1Ð1ð ”Ô"ˆØð 	.�U”\ SÔ%DÔ%MÐMÐMØ”>×%Ò% fÑ-Ô-Ð-ð	.ð 	.ÐMÐMr   Ústrc                ó°   — d                      t          j        | j        ¦  «        t          j        | j        ¦  «        |                      ¦   «         ¦  «        S )Nz<{} {}: {}>)Úformatr
   rš   r‡   r   ÚgetErrorMessagern   s    r   Ú__repr__zFailure.__repr__b  sG   € Ø×#Ò#ÝŒL˜œÑ(Ô(ÝŒL˜œÑ#Ô#Ø× Ò Ñ"Ô"ñ
ô 
ð 	
r   c                ó0   — d|                       ¦   «         z  S )Nz[Failure instance: %s])ÚgetBriefTracebackrn   s    r   Ú__str__zFailure.__str__i  s   € Ø'¨$×*@Ò*@Ñ*BÔ*BÑBÐBr   c                ój   — |                      d¦  «        |d<   | j                             |¦  «         d S )Nrœ   r•   )ÚpoprŸ   Úupdate)rF   Ústates     r   Ú__setstate__zFailure.__setstate__l  s4   € Ø!ŸIšI iÑ0Ô0ˆˆjÑØŒ×Ò˜UÑ#Ô#Ð#Ð#Ð#r   c                ó  — | j         }| j                             ¦   «         }|                     d¦  «        |d<   | j        rd„ | j        D ¦   «         |d<   d|d<   | j        �| j        rd„ | j        D ¦   «         |d<   d	|d
<   |S )zë
        Avoid pickling objects in the traceback.

        This is not called direclty by pickle, since C{BaseException}
        implements reduce; instead, pickle calls C{Failure.__reduce__} which
        then calls this API.
        r•   rœ   c           
     óŒ   — g | ]A}|d          |d         |d         t          |d         ¦  «        t          |d         ¦  «        g‘ŒBS ©r   r3   é   é   r   ©Ú_safeReprVars©Ú.0Úvs     r   ú
<listcomp>z(Failure.__getstate__.<locals>.<listcomp>�  s_   € ð 	ð 	ð 	ð ð �a”DØ�a”DØ�a”DÝ! ! A¤$Ñ'Ô'Ý! ! A¤$Ñ'Ô'ðð	ð 	ð 	r   r#   Nr=   c           
     óŒ   — g | ]A}|d          |d         |d         t          |d         ¦  «        t          |d         ¦  «        g‘ŒBS rÍ   rÐ   rÒ   s     r   rÕ   z(Failure.__getstate__.<locals>.<listcomp>“  s_   € ð 	ð 	ð 	ð ð ˜!œØ˜!œØ˜!œÝ% a¨¤dÑ+Ô+Ý% a¨¤dÑ+Ô+ðð	ð 	ð 	r   r:   r3   Úpickled)rœ   rŸ   rT   rÇ   r�   r#   r:   )rF   r¢   Úcs      r   Ú__getstate__zFailure.__getstate__p  s¼   € ð ŒLˆàŒM×ÒÑ Ô ˆð —u’u˜ZÑ(Ô(ˆˆ)‰àÔð 
	ð	ð 	ð œð	ñ 	ô 	ˆAˆh‰Kð ˆˆ$‰àŒ:Ð!ð Ôð 
ð	ð 	ð "œZð	ñ 	ô 	��'‘
ð ˆˆ)‰Øˆr   c                ój   — t          t          j        t          ¦  «        d|                      ¦   «         fS )Nr   )r   rx   r¥   rÙ   rn   s    r   Ú
__reduce__zFailure.__reduce__¡  s)   € õ �œ­Ñ1Ô1°2°t×7HÒ7HÑ7JÔ7JÐKÐKr   c                ó€   — |                       ¦   «         | _        t          | j        dd¦  «        rd| j        _        dS dS )zÈ
        Remove references to other objects, replacing them with strings.

        On Python 3, this will also set the C{__traceback__} attribute of the
        exception instance to L{None}.
        r|   N)rÙ   rŸ   rŠ   r€   r|   rn   s    r   ÚcleanFailurezFailure.cleanFailure¦  sG   € ð ×)Ò)Ñ+Ô+ˆŒÝ�4”:˜°Ñ5Ô5ð 	,à'+ˆDŒJÔ$Ð$Ð$ð	,ð 	,r   c                ó†   — | j         �| j         S t          | j        ¦  «        dk    rt          | j        | j        ¦  «        S dS )a‘  
        Get an object that represents this Failure's stack that can be passed
        to traceback.extract_tb.

        If the original traceback object is still present, return that. If this
        traceback object has been lost but we still have the information,
        return a fake traceback object (see L{_Traceback}). If there is no
        traceback information at all, return None.
        Nr   )r=   r4   r#   r>   r:   rn   s    r   ÚgetTracebackObjectzFailure.getTracebackObject²  sA   € ð Œ7ÐØ”7ˆNÝ�”ÑÔ Ò!Ð!Ý˜dœj¨$¬+Ñ6Ô6Ð6à�4r   c                óš   — t          | j        t          ¦  «        r| j                             ¦   «         S t	          j        | j        ¦  «        S )zJ
        Get a string of the exception which caused this Failure.
        )r…   r€   rx   rÁ   r
   Úsafe_strrn   s    r   rÁ   zFailure.getErrorMessageÃ  s?   € õ �d”j¥'Ñ*Ô*ð 	0Ø”:×-Ò-Ñ/Ô/Ð/ÝÔ ¤
Ñ+Ô+Ð+r   c                ór   — t          ¦   «         }|                      |¬¦  «         |                     ¦   «         S )N)Úfile)r   ÚprintBriefTracebackÚgetvalue)rF   Úios     r   rÄ   zFailure.getBriefTracebackË  s0   € Ý‰ZŒZˆØ× Ò  bÐ Ñ)Ô)Ð)Ø�{Š{‰}Œ}Ðr   r   ÚelideFrameworkCodeÚintr%   c                óv   — t          ¦   «         }|                      |||¬¦  «         |                     ¦   «         S )N)rã   rç   r%   )r   ÚprintTracebackrå   )rF   rç   r%   ræ   s       r   ÚgetTracebackzFailure.getTracebackÐ  s@   € Ý‰ZŒZˆØ×ÒØÐ(:À6ð 	ñ 	
ô 	
ð 	
ð �{Š{‰}Œ}Ðr   c           	     ó†  — |€ddl m} |j        }|j        }|dk    r
| j        sd}n|}|dk    r |d| j        | j        rdpdfz  ¦  «         n`|d	k    rO| j        rd
}nd} ||›dt          j	        | j
        ¦  «        ›dt          j	        | j        ¦  «        ›d�¦  «         n |d¦  «         | j        rP|s7t          | j        t           d…         ||¦  «          |t          › d�¦  «         t          | j        ||¦  «         n|d	k    s |d¦  «         |d	k    s? |t          j        | j
        ¦  «        › dt          j	        | j        ¦  «        › d�¦  «         t#          | j        t$          ¦  «        r1|                     d¦  «         | j                             |||¦  «         |dk    r |d| j        z  ¦  «         dS dS )a  
        Emulate Python's standard error reporting mechanism.

        @param file: If specified, a file-like object to which to write the
            traceback.

        @param elideFrameworkCode: A flag indicating whether to attempt to
            remove uninteresting frames from within Twisted itself from the
            output.

        @param detail: A string indicating how much information to include
            in the traceback.  Must be one of C{'brief'}, C{'default'}, or
            C{'verbose'}.
        Nr   )Úlogr   r   z*--- Failure #%d%s---
z (pickled) ú r   Ú	Tracebackz"Traceback (failure with no frames)z: r   z#Traceback (most recent call last):
z	Failure: z (chained Failure)
z*--- End of Failure #%d ---
)Útwisted.pythonrí   Úlogerrr$   r�   r~   r×   r#   r
   rá   r   r€   r.   r:   ÚtraceupLengthÚEXCEPTION_CAUGHT_HERErš   r…   rx   rê   )rF   rã   rç   r%   rí   r&   ÚformatDetailÚ	hasFramess           r   rê   zFailure.printTraceback×  sO  € ð ˆ<Ø*Ð*Ð*Ð*Ð*Ð*à”:ˆDØŒJˆà�YÒÐ tÔ'7Ðð 7ˆLˆLà!ˆLð �YÒÐØˆAØ)Ø”: ¤Ð >°ÐFÀ3ÐGñHñô ð ð ð �wÒÐØŒ{ð AØ'�	�	à@�	ØˆAà�9�9�gÔ.¨t¬yÑ9Ô9Ð9Ð9½7Ô;KÈDÌJÑ;WÔ;WÐ;WÐ;WðYñô ð ð ð
 ˆAÐ4Ñ5Ô5Ð5ð Œ;ð 	Ø%ð 0Ý˜dœj­-¨¨¨Ô9¸1¸lÑKÔKÐKØ�Õ*Ð.Ð.Ð.Ñ/Ô/Ð/Ý˜$œ+ q¨,Ñ7Ô7Ð7Ð7Ø˜7Ò"Ð"àˆAˆk‰NŒNˆNð ˜Ò Ð ØˆA•”˜dœiÑ(Ô(ÐLÐL­GÔ,<¸T¼ZÑ,HÔ,HÐLÐLÐLÑMÔMÐMõ �d”j¥'Ñ*Ô*ð 	Hà�JŠJÐ-Ñ.Ô.Ð.ØŒJ×%Ò% dÐ,>ÀÑGÔGÐGØ�YÒÐØˆAÐ-°´
Ñ:Ñ;Ô;Ð;Ð;Ð;ð Ðr   c                ó6   — |                       ||d¬¦  «         dS )z;
        Print a traceback as densely as possible.
        r   ©r%   N©rê   ©rF   rã   rç   s      r   rä   zFailure.printBriefTraceback  s&   € ð 	×Ò˜DÐ"4¸WÐÑEÔEÐEÐEÐEr   c                ó6   — |                       ||d¬¦  «         dS )zQ
        Print a traceback with detailed locals and globals information.
        r   r÷   Nrø   rù   s      r   ÚprintDetailedTracebackzFailure.printDetailedTraceback"  s&   € ð 	×Ò˜DÐ"4¸YÐÑGÔGÐGÐGÐGr   )NNNF)r€   r£   rq   rx   )rq   r   )rq   r¾   )r   r   )rç   rè   r%   r¾   rq   r¾   )NFr   )Nr   )%r   r   r   r1   r×   r:   r•   ÚopcodeÚopmapr¹   rH   Úpropertyrœ   Úsetterrˆ   Ústaticmethodr§   r­   r©   rª   rv   rµ   Úclassmethodr‚   rÂ   rÅ   rÊ   rÙ   rÛ   rÝ   rß   rÁ   rÄ   rë   rê   rä   rû   r   r   r   rx   rx   é   s-  € € € € € ðð ð$ €GØ€EØ€Hð ”< Ô.€LðZð Zð Zð Zðx ð	ð 	ñ „Xð	ð „^ð ð  ñ „^ð ðð ð ð: ðð ð ñ „\ðð&ð ð ð:ð ð ð 1ð 1ð 1ð 1ð ð;ð ;ñ „[ð;ð ð8.ð 8.ñ „[ð8.ðt
ð 
ð 
ð 
ðCð Cð Cð Cð$ð $ð $ð/ð /ð /ðbLð Lð Lð

,ð 
,ð 
,ðð ð ð",ð ,ð ,ð ,ðð ð ð ð
ð ð ð ð ðC<ð C<ð C<ð C<ðJFð Fð Fð FðHð Hð Hð Hð Hð Hr   rx   c                ó   — d„ | D ¦   «         S )aq  
    Convert a list of (name, object) pairs into (name, repr) pairs.

    L{twisted.python.reflect.safe_repr} is used to generate the repr, so no
    exceptions will be raised by faulty C{__repr__} methods.

    @param varsDictItems: a sequence of (name, value) pairs as returned by e.g.
        C{locals().items()}.
    @returns: a sequence of (name, repr) pairs.
    c                ó@   — g | ]\  }}|t          j        |¦  «        f‘ŒS r   )r
   Ú	safe_repr)rÓ   r,   Úobjs      r   rÕ   z!_safeReprVars.<locals>.<listcomp>4  s,   € ÐLÐLÐL©{°°cˆT•7Ô$ SÑ)Ô)Ð*ÐLÐLÐLr   r   )ÚvarsDictItemss    r   rÑ   rÑ   )  s   € ð MÐL¸mÐLÑLÔLÐLr   TFc                ó`  — |||fdk    r•t          j        ¦   «         }|d         | j        k    sqt          rj	 t	          |d         ¦  «        }n# t
          $ r d}Y nw xY wt          d                     |¦  «        ¦  «         ddl}| 	                    |d         ¦  «          || ||||¦  «         dS )z;
    Initialize failure object, possibly spawning pdb.
    )NNNr   r3   z
broken strz8Jumping into debugger for post-mortem of exception '{}':NrÎ   )
rƒ   r„   r‡   ÚDO_POST_MORTEMr¾   r£   ÚprintrÀ   ÚpdbÚpost_mortem)	rF   rŽ   r�   r�   r�   ÚFailure__init__ÚexcÚstrreprr
  s	            r   Ú
_debuginitr  <  sÙ   € ð 	�8˜VÐ$Ð(:Ò:Ð:ÝŒl‰nŒnˆØ�1Œv˜œÒ'Ð'­NÐ'ð'Ý˜c !œf™+œ+��øÝ ð 'ð 'ð 'Ø&���ð'øøøåØJ×QÒQØñô ñô ð ð
 ˆJˆJˆJà�OŠO˜C œFÑ#Ô#Ð#Ø€O�D˜) X¨v°{ÑCÔCÐCÐCÐCs   ¶A ÁAÁAc                 ó(   — t           t          _        dS )z*
    Enable debug hooks for Failures.
    N)r  rx   rH   r   r   r   ÚstartDebugModer  Y  s   € õ "…GÔÐÐr   )r   )rp   r   rq   r   )*r1   Ú
__future__r   rS   rT   r–   r   rƒ   Ú	functoolsr   r   ræ   r   Útypingr   r   r	   rü   rð   r
   Úobjectr   r~   rò   r†   r   r.   ró   r0   r>   r6   r5   rL   rs   rv   r£   rx   rÑ   r  rH   r  r  r   r   r   ú<module>r     s™  ððð ð #Ð "Ð "Ð "Ð "Ð "ð €€€Ø €€€Ø €€€Ø Ð Ð Ð Ø 
€
€
€
Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø .Ð .Ð .Ð .Ð .Ð .Ð .Ð .Ð .Ð .à €€€à "Ð "Ð "Ð "Ð "Ð "àˆg�m¨8°C¸°KÔ+@ÐAÑAÔA€à	€Ø€ð	ð 	ð 	ð 	ð 	�yñ 	ô 	ð 	ð+/ð +/ð +/ð +/ð` :Ð ðð ð ð ð ˜iñ ô ð ð#ð #ð #ðRð ð ð ð ñ ô ð ð ð ð ð ð ñ ô ð ð8+ð +ð +ð +ð +ñ +ô +ð +ð<  Ð ðð ð ð ð }Hð }Hð }Hð }Hð }Hˆmñ }Hô }Hð }Hð@Mð Mð Mð  €ð
 ØØØØÔ$ðDð Dð Dð Dð:"ð "ð "ð "ð "r   