File: //usr/local/lib/python3.10/dist-packages/pip/_vendor/rich/__pycache__/traceback.cpython-310.pyc
o
��h� � # @ s d dl Z d dlZd dlZd dlZd dlmZmZ d dlmZ d dl m
Z
d dlmZm
Z
d dlmZmZmZmZmZmZmZmZmZmZmZ d dlmZ d dlmZmZmZm Z m!Z!m"Z" d d lm#Z$ d d
lm%Z% d dl&m'Z' dd
l(m)Z) ddl*m+Z+m,Z, ddl-m.Z. ddl/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5 ddl6m7Z7 ddl8m9Z9m:Z: ddl;m<Z< ddl=m>Z> ddl?m@Z@ ddlAmBZBmCZC dd lDm#Z# ddlEmFZF ejGdkZHdZIdZJdeCdeCdeeeKeKeKf fdd�ZLdd d!d"dd#d#eIeJd$dd$d%d d&�d'ee0 d(eeK d)eeK d*eKd+eeM d,eNd-eNd.eKd/eKd0eNd1eeN d2eNd3eeeMef d4eKdeeeO eOee
gef fd5d6�ZPeG d7d8� d8��ZQeG d9d:� d:��ZReG d;d<� d<��ZSeG d=d>� d>��ZTG d?d@� d@e9�ZUG dAdB� dB�ZVeWdCk�r�ePd$dD� d dlZdEeddfdFdG�ZXdEeddfdHdI�ZYdLdJdK�ZZeZ� dS dS )M� N)� dataclass�field)�islice)�walk_tb)�
ModuleType�
TracebackType)�Any�Callable�Dict�Iterable�List�Optional�Sequence�Set�Tuple�Type�Union)�guess_lexer_for_filename)�Comment�Keyword�Name�Number�Operator�String)�Text)�Token)�
ClassNotFound� )�pretty)�loop_first_last� loop_last)�Columns)�Console�ConsoleOptions�ConsoleRenderable�Group�RenderResult�group)� Constrain)�RegexHighlighter�ReprHighlighter)�Panel)�render_scope)�Style)�Syntax�SyntaxPosition)�Theme�win32�
�P �start�end�returnc c s| � | \}}|\}}||kr|||fV dS t t||d ��D ]\}}}|r,||dfV q|r5|d|fV q|ddfV qdS )z�Yield start and end positions per line.
Args:
start: Start position.
end: End position.
Returns:
Iterable of (LINE, COLUMN1, COLUMN2).
r ���r N)r �range) r4 r5 �line1�column1�line2�column2�first�last�line_no� r@ �E/usr/local/lib/python3.10/dist-packages/pip/_vendor/rich/traceback.py�_iter_syntax_lines7 s �
�rB �d �X � FTr@ )�console�width�
code_width�extra_lines�theme� word_wrap�show_locals�locals_max_length�locals_max_string�locals_hide_dunder�locals_hide_sunder�
indent_guides�suppress�
max_framesrF rG rH rI rJ rK rL rM rN rO rP rQ rR rS c s� | du r t dd�n| ��jr�du rdn��dtt dtdtt ddf� �������� �
���
�fdd ��d
tddf�fdd�}zt� }||� tj W S t
y] tj }�t_ | Y S w )
a� Install a rich traceback handler.
Once installed, any tracebacks will be printed with syntax highlighting and rich formatting.
Args:
console (Optional[Console], optional): Console to write exception to. Default uses internal Console instance.
width (Optional[int], optional): Width (in characters) of traceback. Defaults to 100.
code_width (Optional[int], optional): Code width (in characters) of traceback. Defaults to 88.
extra_lines (int, optional): Extra lines of code. Defaults to 3.
theme (Optional[str], optional): Pygments theme to use in traceback. Defaults to ``None`` which will pick
a theme appropriate for the platform.
word_wrap (bool, optional): Enable word wrapping of long lines. Defaults to False.
show_locals (bool, optional): Enable display of local variables. Defaults to False.
locals_max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
Defaults to 10.
locals_max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to 80.
locals_hide_dunder (bool, optional): Hide locals prefixed with double underscore. Defaults to True.
locals_hide_sunder (bool, optional): Hide locals prefixed with single underscore. Defaults to False.
indent_guides (bool, optional): Enable indent guides in code and locals. Defaults to True.
suppress (Sequence[Union[str, ModuleType]]): Optional sequence of modules or paths to exclude from traceback.
Returns:
Callable: The previous exception handler that was replaced.
NT)�stderr�type_�value� tracebackr6 c s<