Ë
    oj¸m  ã                   óp  — d 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
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edefd„Z G d„ de«      Z d„ Z!dZ"dddde jF                  fd „Z$d!„ Z%y)#z9
Asynchronous-friendly error mechanism.

See L{Failure}.
é    N)Úgetmro)ÚStringIO)ÚCallableÚNoReturnÚTypeVar)ÚreflectÚ_T_Callable.)Úboundé   c                   ó   — e Zd Zy)ÚDefaultExceptionN)Ú__name__Ú
__module__Ú__qualname__© ó    ú8/usr/lib/python3/dist-packages/twisted/python/failure.pyr   r   #   s   „ Ør   r   c           
      óV  — |dvrt        d|›d�«      ‚|}|dk(  r| D ]  \  }}}}} ||› d|› d|› d�«       Œ y|dk(  rM| D ]G  \  }}}}} |d|› d	|› d
|› d�«        |dt        j                  ||«      j                  «       z  «       ŒI y|dk(  r$| D ]  \  }}}}} |d|||fz  «       Œ  |d«       y|dk(  rp| D ]j  \  }}}}} |d|||fz  «        |d«       |D ]  \  }	}
 |d|	› dt	        |
«      › d�«       Œ  |d«       |D ]  \  }	}
 |d|	› dt	        |
«      › d�«       Œ Œl yy)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
    )ÚdefaultÚ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Ýâ5;ð>ó
ð 	
ð 	€AØ�ÒØ?Eò 	1Ñ;ˆF�H˜f i°Ù��
˜!˜F˜8 1 V H¨BÐ/Õ0ñ	1à	�9Ò	Ø?Eò 	HÑ;ˆF�H˜f i°Ù�˜˜
 (¨6¨(°%¸°x¸rÐBÔCÙˆjœ9×,Ñ,¨X°vÓ>×DÑDÓFÑFÕGñ	Hð 
Ð.Ò	.Ø?Eò 	?Ñ;ˆF�H˜f i°ÙÐ  H¨f°fÐ#=Ñ=Õ>ð	?á	Ð
NÕOØ	�9Ò	Ø?Eò 	/Ñ;ˆF�H˜f i°ÙÐ  H¨f°fÐ#=Ñ=Ô>ÙˆoÔà&ò /‘	��cÙ�B�t�f˜C¤ S£	˜{¨"Ð-Õ.ð/áÐÔØ'ò /‘	��cÙ�B�t�f˜C¤ S£	˜{¨"Ð-Õ.ñ/ñ	/ð 
r   z--- <exception caught here> ---c                   ó   — e Zd ZdZy)Ú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   r.   r.   Z   s   „ òr   r.   c                 óö   — t        |«      dkD  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<   a   sœ   € ô ˆx‹=˜1ÒÐ5Ð5Ó5Ðð €EØò "ˆÜ�r˜5Ó!‰ð"ô �8˜A‘; Ó&€EÜ" 5Ó)Ð)€GˆbØ�q�rˆlò ˆÜ�r˜5Ó!ˆÜ$ UÓ+ˆŒ
Ø�Z‰Z‰ðð €Nr   c                   ó   — e Zd ZdZd„ Zy)r4   zq
    Fake traceback object which can be passed to functions in the standard
    library L{traceback} module.
    c                 ód   — || _         |j                  | _        |j                  | _        d| _        y)z-
        @param frame: _Frame object
        N)Útb_frameÚf_linenoÚ	tb_linenoÚf_lastiÚtb_lastir5   )ÚselfÚframes     r   Ú__init__z_TracebackFrame.__init__�   s(   € ð ˆŒØŸ™ˆŒØŸ™ˆŒØˆ�r   N©r   r   r   r/   rF   r   r   r   r4   r4   Š   s   „ ñó
r   r4   c                   ó   — e Zd ZdZd„ Zy)r3   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        |xs i «      | _        t        |xs i «      | _        || _        d| _        t        t        «      j                  «       | _        d| _        y)z¢
        @param frameinfo: (methodname, filename, lineno, locals, globals)
        @param back: previous (older) stack frame
        @type back: C{frame}
        r   N)Ú_CodeÚf_coder@   ÚdictÚ	f_globalsÚf_localsÚf_backrB   ÚvarsÚbuiltinsÚcopyÚ
f_builtinsÚf_trace)rD   Ú	frameinfoÚbackr*   r&   r'   ÚlocalzÚglobalzs           r   rF   z_Frame.__init__¥   sr   € ð 3<Ñ/ˆˆh˜ ¨Ü˜D (Ó+ˆŒØˆŒÜ˜gšm¨Ó,ˆŒÜ˜Vš\ rÓ*ˆŒØˆŒØˆŒÜœx›.×-Ñ-Ó/ˆŒØˆ�r   NrG   r   r   r   r3   r3   š   s   „ ñór   r3   c                   ó   — e Zd ZdZd„ Zd„ Zy)rJ   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| _        y )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)rD   r*   r&   s      r   rF   z_Code.__init__¾   s{   € ØˆŒØ#ˆÔØˆŒØˆÔØˆÔØˆÔØˆŒØˆÔØˆŒØˆŒØˆÔØ"#ˆÔØ!"ˆÔØˆŒØˆŒØˆÕr   c                  ó   — y)N))NNNNr   ©rD   s    r   Úco_positionsz_Code.co_positionsÐ   s   € Ø*r   N)r   r   r   r/   rF   rm   r   r   r   rJ   rJ   ¶   s   „ ñòó$+r   rJ   ÚfÚreturnc                 óD   — t         j                  | 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__)rn   s    r   Ú_extraneousrt   ×   s   € ô ×%Ñ% a§j¡jÔ1Ø€Hr   c                   óì   — e Zd ZdZdZdZej                  d   Zdd„Z	d„ Z
d„ Zd„ Zd	efd
„Zed„ «       Zed„ «       Zd	efd„Zd	efd„Zd„ Zd„ Zd„ Zd	efd„Zd	efd„Zddeded	efd„Zdd„Zdd„Zdd„Zy)Ú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_VALUEc                 ó¾  — t         dz   a t         | _         dx| _        x| _        }|| _        t	        |t
        «      r|€t        d«      ‚d}|€| j                  «       }|€;t        j                  «       \  | _        | _        }| j                  €
t        «       ‚d}nJ|€:t	        |t        «      r|j                  | _        nt        |«      | _        || _        n|| _        || _        t	        | j                  t        «      r| j                  | j                  «       yt        | j                  d«      r2| j                  | j                  j                   «       | j                  `y|€2|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Œ	rß|r�|	j0                  j3                  «       }
|	j0                  |	j4                  u ri }n|	j4                  j3                  «       }||
fD ]
  }d|v sŒ|d= Œ |
j7                  «       }
|j7                  «       }ndx}
}|j9                  d|	j:                  j<                  |	j:                  j>                  |	j@                  |
|f«       |	j.                  }	|	rŒß|�ü|j,                  }	|r“|	j0                  j3                  «       }
|	j0                  |	j4                  u ri }n|	j4                  j3                  «       }||
fD ]
  }d|v sŒ|d= Œ tC        |
j7                  «       «      }
tC        |j7                  «       «      }ndx}
}|jE                  |	j:                  j<                  |	j:                  j>                  |jF                  |
|f«       |jH                  }|�ŒütK        jL                  | j                  «      rXtO        | j                  t        «      r>tQ        | j                  «      }tC        tS        tT        jV                  |«      «      | _,        y| j                  g| _,        y)	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}.
        r1   Nz$Strings are not supported by Failurer   Ú__failure__Ú__traceback__Ú__builtins__r   )-ÚcountÚtypeÚvalueÚcaptureVarsÚ
isinstanceÚstrÚ	TypeErrorÚ_findFailureÚsysÚexc_infor.   Ú	ExceptionÚ	__class__rv   Ú_extrapolateÚhasattrry   Úgetattrrz   r!   r8   r;   r?   rO   rN   rR   rM   ÚitemsÚinsertrK   r[   r\   r@   Úlistrr   rA   r5   ÚinspectÚisclassÚ
issubclassr   Úmapr   ÚqualÚparents)rD   Ú	exc_valueÚexc_typeÚexc_tbr   r;   ÚstackOffsetr!   r8   rn   rW   rX   ÚdÚparentCss                 r   rF   zFailure.__init__  sÇ  € ô2 ˜‘	ˆÜˆŒ
Ø&*Ð*ˆŒ	Ð*�D”J Ø&ˆÔä�i¤Ô%¨(Ð*:ÜÐBÓCÐCàˆàÐØ×)Ñ)Ó+ˆIàÐÜ(+¯©«Ñ%ˆDŒI�t”z 2Ø�y‰yÐ Ü-Ó/Ð/Ø‰KØÐÜ˜)¤YÔ/Ø%×/Ñ/�•	ô ! ›O�”	Ø"ˆD�Jà ˆDŒIØ"ˆDŒJä�d—j‘j¤'Ô*Ø×Ñ˜dŸj™jÔ)Øä�4—:‘:˜}Ô-ð ×Ñ˜dŸj™j×4Ñ4Ô5ð —
‘
Ð&Øàˆ:ÙØ‘Ü˜Ÿ™ _°dÔ;à—Z‘Z×-Ñ-�à!Ð!ˆ�”ØÐˆ�”
ð
 ˆŒáØ—‘‰AÜ˜DŸJ™J¬Ô0ð #Ð"ˆA�á™að —‘ˆAØ˜1ÑˆKñ	 šañ ÙØŸ™Ÿ™Ó*�Ø—:‘: §¡Ñ,Ø ‘GàŸk™k×.Ñ.Ó0�GØ  &˜ò .�AØ%¨Ò*Ø˜nÑ-ð.ð  Ÿ™›�Ø!Ÿ-™-›/‘à#%Ð%�˜Ø�L‰LØà—H‘H×$Ñ$Ø—H‘H×(Ñ(Ø—J‘JØØðô	ð —‘ˆAò1 ð4 ˆnØ—‘ˆAÙØŸ™Ÿ™Ó*�Ø—:‘: §¡Ñ,Ø ‘GàŸk™k×.Ñ.Ó0�GØ  &˜ò .�AØ%¨Ò*Ø˜nÑ-ð.ô ˜fŸl™l›nÓ-�Ü˜wŸ}™}›Ó/‘à#%Ð%�˜Ø�M‰Mà—H‘H×$Ñ$Ø—H‘H×(Ñ(Ø—L‘LØØðôð —‘ˆBð1 ‰nô2 �?‰?˜4Ÿ9™9Ô%¬*°T·Y±YÄ	Ô*JÜ˜dŸi™iÓ(ˆHÜ¤¤G§L¡L°(Ó ;Ó<ˆD�Là ŸI™I˜;ˆD�Lr   c                 ó²  — t        j                   |j                  «      | _        t        j                  «       \  }}}g }|�u|j                  }|j
                  t        vrH|j                  |j
                  j                  |j
                  j                  |j                  ddf«       |j                  }|�Œu|j                  | j                  «       || _        y)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   )rR   Ú__dict__r„   r…   r?   rK   rq   rr   r[   r\   rA   r5   Úextendr!   )rD   ÚotherFailureÚ_r;   r!   rn   s         r   rˆ   zFailure._extrapolateª  sª   € ô Ÿ	™	 ,×"7Ñ"7Ó8ˆŒô —<‘<“>‰ˆˆ1ˆbØˆØˆnØ—‘ˆAØ�x‰xÔ9Ñ9Ø—‘Ø—X‘X×%Ñ% q§x¡x×';Ñ';¸R¿\¹\È2ÈrÐRôð —‘ˆBð ‰nð 	�‰�d—k‘kÔ"Øˆ�r   c                 óH   —  | j                   |Ž }|s| j                  «        |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)rD   Ú
errorTypesÚerrors      r   ÚtrapzFailure.trapÇ  s(   € ð0 �—
‘
˜JÐ'ˆÙØ×ÑÔ!Øˆr   c                 ó®   — |D ]P  }|}t        j                  |«      r%t        |t        «      rt	        j
                  |«      }|| j                  v sŒN|c S  y)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“   )rD   r¢   r£   Úerrs       r   r    zFailure.checkä  sQ   € ð  ò 	ˆEØˆCÜ�‰˜uÔ%¬*°U¼IÔ*FÜ—l‘l 5Ó)�Ø�d—l‘lÒ"Ø’ð	ð r   ro   c                 óL   — | j                   j                  | j                  «      ‚)zf
        raise the original exception, preserving traceback
        information if available.
        )r~   Úwith_tracebackr;   rl   s    r   r¡   zFailure.raiseExceptionô  s   € ð
 �j‰j×'Ñ'¨¯©Ó0Ð0r   c                 ój   — |j                  | j                  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;   )rD   Úgs     r   ÚthrowExceptionIntoGeneratorz#Failure.throwExceptionIntoGeneratorû  s&   € ð �w‰w�t—z‘z×0Ñ0°·±Ó9Ó:Ð:r   c                 óð  — t        j                  «       d   }|syd}|}|j                  r|}|j                  }|j                  rŒ|j                  }|j                  | j
                  j                  u r|j                  j                  d«      S |j                  j                  r0|j                  j                  |j                     | j                  k7  ry|rI|j                  }|j                  | j                  j                  u r|j                  j                  d«      S |j                  j                  }|r>|j                  | j                  j                  u r|j                  j                  d«      S yy)zV
        Find the failure that represents the exception currently in context.
        éÿÿÿÿNrD   )r„   r…   r5   r?   rK   r¡   rs   rN   Úgetra   rC   Ú_yieldOpcoder¬   rO   )Úclsr;   ÚsecondLastTbÚlastTbÚ	lastFramerE   s         r   rƒ   zFailure._findFailure	  sC  € ô
 �\‰\‹^˜BÑˆÙØàˆØˆØ�nŠnØ!ˆLØ—^‘^ˆFð �n‹nð —O‘Oˆ	ð ×Ñ˜s×1Ñ1×:Ñ:Ñ:Ø×%Ñ%×)Ñ)¨&Ó1Ð1ð × Ñ ×(Ò(¨Y×-=Ñ-=×-EÑ-EØ�O‰Oñ.
à×Ñò.ð ñ
 Ø ×)Ñ)ˆEØ�|‰|˜s×>Ñ>×GÑGÑGØ—~‘~×)Ñ)¨&Ó1Ð1ð —‘×"Ñ"ˆÙ�U—\‘\ S×%DÑ%D×%MÑ%MÑMØ—>‘>×%Ñ% fÓ-Ð-ð Nˆ5r   c                 ó¸   — dj                  t        j                  | j                  «      t        j                  | j                  «      | j                  «       «      S )Nz<{} {}: {}>)Úformatr   r’   r‡   r}   ÚgetErrorMessagerl   s    r   Ú__repr__zFailure.__repr__D  sA   € Ø×#Ñ#Ü�L‰L˜Ÿ™Ó(Ü�L‰L˜Ÿ™Ó#Ø× Ñ Ó"ó
ð 	
r   c                 ó(   — d| j                  «       z  S )Nz[Failure instance: %s])ÚgetBriefTracebackrl   s    r   Ú__str__zFailure.__str__K  s   € Ø'¨$×*@Ñ*@Ó*BÑBÐBr   c                 ó¶  — | j                   r| j                  S | j                  j                  «       }| j                  D �cg c]*  }|d   |d   |d   t	        |d   «      t	        |d   «      g‘Œ, c}|d<   d|d<   | j
                  �C| j
                  D �cg c]*  }|d   |d   |d   t	        |d   «      t	        |d   «      g‘Œ, c}|d	<   d|d
<   |S c c}w c c}w )z(Avoid pickling objects in the traceback.r   r1   é   é   r   r!   Nr;   r8   Úpickled)r¿   r›   rR   r!   Ú_safeReprVarsr8   )rD   ÚcÚvs      r   Ú__getstate__zFailure.__getstate__N  sú   € à�<Š<Ø—=‘=Ð Ø�M‰M×ÑÓ ˆð —[‘[ö	
ð ð �!‘Ø�!‘Ø�!‘Ü˜a ™dÓ#Ü˜a ™dÓ#òò	
ˆˆ(‰ð ˆˆ$‰à�:‰:Ð!ð Ÿ™ö	ð ð �a‘DØ�a‘DØ�a‘DÜ! ! A¡$Ó'Ü! ! A¡$Ó'òò	ˆAˆg‰Jð ˆˆ)‰Øˆùò;	
ùò"	s   Á/CÂ/Cc                 ó€   — | j                  «       | _        t        | j                  dd«      rd| j                  _        yy)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}.
        rz   N)rÃ   r›   rŠ   r~   rz   rl   s    r   ÚcleanFailurezFailure.cleanFailures  s5   € ð ×)Ñ)Ó+ˆŒÜ�4—:‘:˜°Ô5à'+ˆD�J‰JÕ$ð 6r   c                 ó¤   — | j                   �| j                   S t        | j                  «      dkD  r t        | j                  | j                  «      S y)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;   r2   r!   r<   r8   rl   s    r   ÚgetTracebackObjectzFailure.getTracebackObject  s@   € ð �7‰7ÐØ—7‘7ˆNÜ�—‘Ó Ò!Ü˜dŸj™j¨$¯+©+Ó6Ð6àr   c                 ó¨   — t        | j                  t        «      r| j                  j                  «       S t	        j
                  | j                  «      S )zJ
        Get a string of the exception which caused this Failure.
        )r€   r~   rv   r·   r   Úsafe_strrl   s    r   r·   zFailure.getErrorMessage�  s:   € ô �d—j‘j¤'Ô*Ø—:‘:×-Ñ-Ó/Ð/Ü×Ñ §
¡
Ó+Ð+r   c                 óZ   — t        «       }| j                  |¬«       |j                  «       S )N)Úfile)r   ÚprintBriefTracebackÚgetvalue)rD   Úios     r   rº   zFailure.getBriefTraceback˜  s&   € Ü‹ZˆØ× Ñ  bÐ Ô)Ø�{‰{‹}Ðr   ÚelideFrameworkCoder#   c                 ó^   — t        «       }| j                  |||¬«       |j                  «       S )N)rË   rÏ   r#   )r   ÚprintTracebackrÍ   )rD   rÏ   r#   rÎ   s       r   ÚgetTracebackzFailure.getTraceback�  s2   € Ü‹ZˆØ×ÑØÐ(:À6ð 	ô 	
ð �{‰{‹}Ðr   c           	      óÄ  — |€ddl m} |j                  }|j                  }|dk(  r| j                  sd}n|}|dk(  r* |d| j
                  | j                  xr dxs dfz  «       nj|d	k(  r]| j                  rd
}nd} ||›dt        j                  | j                  «      ›dt        j                  | j                  «      ›d�«       n |d«       | j                  rH|s.t        | j                  t         d ||«        |t        › d�«       t        | j                  ||«       n|d	k(  s |d«       |d	k(  sH |t        j                   | j                  «      › dt        j                  | j                  «      › d�«       t#        | j                  t$        «      r.|j                  d«       | j                  j'                  |||«       |dk(  r |d| j
                  z  «       yy)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,   r8   ÚtraceupLengthÚEXCEPTION_CAUGHT_HEREr’   r€   rv   rÑ   )rD   rË   rÏ   r#   rÔ   r$   ÚformatDetailÚ	hasFramess           r   rÑ   zFailure.printTraceback¤  s­  € ð ˆ<Ý*à—:‘:ˆDØ�J‰Jˆà�YÒ t×'7Ò'7ð 7‰Là!ˆLð �YÒÙØ)Ø—:‘: §¡Ò >°ÒFÀ3ÐGñHõð �wÒØ�{Š{Ø'‘	à@�	Ùâœg×.Ñ.¨t¯y©yÕ9¼7×;KÑ;KÈDÏJÉJÕ;WðYõñ
 Ð4Ô5ð �;Š;Ù%Ü˜dŸj™j¬-¨¨Ð9¸1¸lÔKÙÔ*Ð+¨2Ð.Ô/Ü˜$Ÿ+™+ q¨,Õ7Ø˜7Ò"áˆkŒNð ˜Ò Ù”—‘˜dŸi™iÓ(Ð)¨¬G×,<Ñ,<¸T¿Z¹ZÓ,HÐ+IÈÐLÔMô �d—j‘j¤'Ô*à�J‰JÐ-Ô.Ø�J‰J×%Ñ% dÐ,>ÀÔGØ�YÒÙÐ-°·
±
Ñ:Õ;ð r   c                 ó,   — | j                  ||d¬«       y)z;
        Print a traceback as densely as possible.
        r   ©r#   N©rÑ   ©rD   rË   rÏ   s      r   rÌ   zFailure.printBriefTracebacké  s   € ð 	×Ñ˜DÐ"4¸WÐÕEr   c                 ó,   — | j                  ||d¬«       y)zQ
        Print a traceback with detailed locals and globals information.
        r   rÞ   Nrß   rà   s      r   ÚprintDetailedTracebackzFailure.printDetailedTracebackï  s   € ð 	×Ñ˜DÐ"4¸YÐÕGr   )NNNF)r   r   )NFr   )Nr   ) r   r   r   r/   r¿   r8   ÚopcodeÚopmapr°   rF   rˆ   r¤   r    r   r¡   rt   r¬   Úclassmethodrƒ   r�   r¸   r»   rÃ   rÅ   rÇ   r·   rº   ÚintrÒ   rÑ   rÌ   râ   r   r   r   rv   rv   ç   sÞ   „ ñð$ €GØ€Eð —<‘< Ñ.€Lóc'òJò:ò:ð 1 ó 1ð ñ;ó ð;ð ñ8.ó ð8.ðt
˜#ó 
ðC˜ó Cò#òJ
,òð", ó ,ð 3ó ñ
¨sð Àð ÐTWó óC<óJFôHr   rv   c                 ób   — | D ��cg c]  \  }}|t        j                  |«      f‘Œ c}}S c c}}w )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.
    )r   Ú	safe_repr)ÚvarsDictItemsr*   Úobjs      r   rÀ   rÀ   ö  s-   € ð ?L×L©{°°cˆT”7×$Ñ$ SÓ)Ò*ÓLÐLùÓLs   †!+TFc                 ó(  — |||fdk(  rmt        j                  «       }|d   | j                  k(  sGt        rA	 t	        |d   «      }t        dj                  |«      «       ddl}|j                  |d   «        || ||||«       y# t
        $ r d}Y ŒLw xY w)z;
    Initialize failure object, possibly spawning pdb.
    )NNNr   r1   z
broken strz8Jumping into debugger for post-mortem of exception '{}':Nr½   )
r„   r…   r‡   ÚDO_POST_MORTEMr�   ÚBaseExceptionÚprintr¶   ÚpdbÚpost_mortem)	rD   r”   r•   r–   r   ÚFailure__init__ÚexcÚstrreprrï   s	            r   Ú
_debuginitrô   	  s™   € ð 	�8˜VÐ$Ð(:Ò:Ü�l‰l‹nˆØ�1‰v˜Ÿ™Ò'­Nð'Ü˜c !™f›+�ô ØJ×QÑQØóôó
 à�O‰O˜C ™FÔ#Ù�D˜) X¨v°{ÕCøô !ò 'Ø&’ð'ús   ¶B ÂBÂBc                  ó"   — t         t        _        y)z*
    Enable debug hooks for Failures.
    N)rô   rv   rF   r   r   r   ÚstartDebugModerö   &  s   € ô "„GÕr   )r   )&r/   rQ   rR   rŽ   r   r„   r   rÎ   r   Útypingr   r   r   rã   r×   r   Úobjectr	   r|   rÙ   r†   r   r,   rÚ   r.   r<   r4   r3   rJ   rq   rt   rí   rv   rÀ   rì   rF   rô   rö   r   r   r   ú<module>rù      sñ   ðñó Û Û Û Û 
Ý Ý ß .Ñ .ã å "á�m¨8°C¸°KÑ+@ÔA€à	€Ø€ô	�yô 	ó+/ð` :Ð ô˜iô ò#÷Rñ ÷ ñ ÷8+ñ +ð<  Ð ð�;ð  ;ó ô LHˆmô LHò^Mð  €ð
 ØØØØ×$Ñ$óDó:"r   