Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/IPython/core/__pycache__/ultratb.cpython-39.pyc
Ðазад
a o�h�� � @ s d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl mZ ddlm Z mZmZmZ ddlZddlmZ ddlmZ ddlm mZ ddlmZ dd lmZ dd lmZ ddlm Z ddl!m"Z" dd l!m#Z$ ddl!m%Z% ddl&m'Z' dZ(dZ)dZ*e�+� e,e-d�dd��Z.e j/e-d�dd�Z0e,fdd�Z1e2d�dd�Z3dd� Z4dd �d!d"�Z5G d#d$� d$ej6�Z7G d%d&� d&e7�Z8G d'd(� d(�Z9G d)d*� d*e7�Z:G d+d,� d,e:e8�Z;G d-d.� d.e;�Z<G d/d0� d0e;�Z=G d1d2� d2e8�Z>d3d4� Z?e?fd5d6�Z@e?fd7d8�ZAdS )9a] Verbose and colourful traceback formatting. **ColorTB** I've always found it a bit hard to visually parse tracebacks in Python. The ColorTB class is a solution to that problem. It colors the different parts of a traceback in a manner similar to what you would expect from a syntax-highlighting text editor. Installation instructions for ColorTB:: import sys,ultratb sys.excepthook = ultratb.ColorTB() **VerboseTB** I've also included a port of Ka-Ping Yee's "cgitb.py" that produces all kinds of useful info when a traceback occurs. Ping originally had it spit out HTML and intended it for CGI programmers, but why should they have all the fun? I altered it to spit out colored text to the terminal. It's a bit overwhelming, but kind of neat, and maybe useful for long-running programs that you believe are bug-free. If a crash *does* occur in that type of program you want details. Give it a shot--you'll love it or you'll hate it. .. note:: The Verbose mode prints the variables currently visible where the exception happened (shortening their strings if too long). This can potentially be very slow, if you happen to have a huge data structure whose string representation is complex to compute. Your computer may appear to freeze for a while with cpu usage at 100%. If this occurs, you can cancel the traceback with Ctrl-C (maybe hitting it more than once). If you encounter this kind of situation often, you may want to use the Verbose_novars mode instead of the regular Verbose, which avoids formatting variables (but otherwise includes the information and context given by Verbose). .. note:: The verbose mode print all variables in the stack, which means it can potentially leak sensitive information like access keys, or unencrypted password. Installation instructions for VerboseTB:: import sys,ultratb sys.excepthook = ultratb.VerboseTB() Note: Much of the code in this module was lifted verbatim from the standard library module 'traceback.py' and Ka-Ping Yee's 'cgitb.py'. Color schemes ------------- The colors are defined in the class TBTools through the use of the ColorSchemeTable class. Currently the following exist: - NoColor: allows all of this module to be used in any terminal (the color escapes are just dummy blank strings). - Linux: is meant to look good in a terminal like the Linux console (black or very dark background). - LightBG: similar to Linux but swaps dark/light colors to be more readable in light background terminals. - Neutral: a neutral color scheme that should be readable on both light and dark background You can implement other color schemes easily, the syntax is fairly self-explanatory. Please send back new schemes you develop to the author for possible inclusion in future releases. Inheritance diagram: .. inheritance-diagram:: IPython.core.ultratb :parts: 3 � )�SequenceN)� TracebackType)�Any�List�Optional�Tuple)�Terminal256Formatter)�get_style_by_name)�get_ipython)�debugger)�DisplayTrap)�exception_colors)� PyColorize)�path)� py3compat)�get_terminal_size� �NoColori'