File: //usr/lib/python3/dist-packages/twisted/python/__pycache__/failure.cpython-310.pyc
o
�bi � @ s d Z ddlZddlZddlZddlZddlmZ ddlmZ ddlZddl m
Z
dadZG dd� de
�Zd#d
d�ZdZG d
d� de
�Zdd� ZG dd� d�ZG dd� d�ZG dd� d�Zg Zdd� ZG dd� de�Zdd� ZdZddddejfdd �Zd!d"� ZdS )$z9
Asynchronous-friendly error mechanism.
See L{Failure}.
� N)�getmro)�StringIO)�reflect� c @ s e Zd ZdS )�DefaultExceptionN)�__name__�
__module__�__qualname__� r
r
�8/usr/lib/python3/dist-packages/twisted/python/failure.pyr s r �defaultc C sx |dvrt d|f ��|}|dkr*| D ]\}}}}}||� d|� d|� d�� qdS |dkrT| D ]!\}}}}}|d|� d|� d |� d�� |d
t�||��� � q0dS |dkrq| D ]\}}}}}|d|||f � qZ|d
� dS |dkr�| D ]B\}}}}}|d|||f � |d� |D ]\} }
|d| � dt|
�� d�� q�|d� |D ]\} }
|d| � dt|
�� d�� q�qwdS dS )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-capturedzNDetail must be default, brief, verbose, or verbose-vars-not-captured. (not %r)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�valr
r
r �
format_frames# s@ ������r"