Your IP : 216.73.216.213
B
�d{T� � @ s� d Z ddlmZ dZyddlZW n ek
r8 dZY nX ddlZddlmZ ddl
Z
ddlmZ ddl
Z
ddlmZ yddlmZ W n$ ek
r� dd � Zd
d� ZY nX dd � Zd
d� Zdd� ZG dd� de�Zdd� Zdd� ZdS )z�Customized version of pdb's default debugger.
- sets up a history file
- uses ipython if available to colorize lines of code
- overrides list command to search for current block instead
of using 5 lines of context
� )�print_functionzrestructuredtext enN)�Pdb)�StringIO)�
PyColorizec G s | S )zfallback colorize function� )�source�argsr r �H/opt/alt/python37/lib/python3.7/site-packages/logilab/common/debugger.py�colorize1 s r
c G s | S )Nr )r r r r r �colorize_source4 s r c C s| t �� }t� }|�| |� g }xRt|�� �� �D ]>\}}|| }||kr\|�d||f � q0|�d||f � q0W d�|�S )zUcolorize and annotate source with linenos
(as in pdb's list command)
z %4s -> %sz%4s %s�
) r �Parserr �format� enumerate�getvalue�
splitlines�append�join) r �start_linenoZ curlineno�parser�outputZ annotated�index�line�linenor r r r
7 s c C s"