Format: application/x-python-code
1 o
2
3 ��h{* � @ s" d Z ddgZdZddlZddlZddlZddlZddlZejZddl m
4 Z
5 mZmZm
6 Z
7 ddlmZ dd lmZ ejd Zejd
8 Ze
9 Zedi dej�ejej�ejej�ejej�ejej�ejej�ejej�eej�eej�d
10 ej�dej�dej�dej�dej�dej�dej��Zedi dej�ejej�ejej�ejej �ejej�ejej!�ejej"�eej#�eej�d
11 ej$�dej#�dej$�dej!�dej"�dej�dej!��Z%edi dej"�ejej&�ejej'�ejej'�ejej"�ejej!�ejej"�eej$�eej'�d
12 ej'�dej �dej'�dej!�dej"�dej�dej!��Z(ej)dk�r0e%j*dd�Z(edi dej"�ejej&�ejej'�ejej'�ejej"�ejej!�ejej"�eej$�eej'�d
13 ej'�dej �dej'�dej!�dej"�dej�dej!��Z+e
14 ee%e+e(ge�Z,e-� Z.G dd� de�Z/dS )a]
15 Class and program to colorize python source code for ANSI terminals.
16
17 Based on an HTML code highlighter by Jurgen Hermann found at:
18 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52298
19
20 Modifications by Fernando Perez (fperez@colorado.edu).
21
22 Information on the original HTML highlighter follows:
23
24 MoinMoin - Python Source Parser
25
26 Title: Colorize Python source using the built-in tokenizer
27
28 Submitter: Jurgen Hermann
29 Last Updated:2001/04/06
30
31 Version no:1.2
32
33 Description:
34
35 This code is part of MoinMoin (http://moin.sourceforge.net/) and converts
36 Python source code to HTML markup, rendering comments, keywords,
37 operators, numeric and string literals in different colors.
38
39 It shows how to use the built-in keyword, token and tokenize modules to
40 scan Python source code and re-emit it with no changes to its original
41 formatting (which is the hard part).
42 �ANSICodeColors�Parser�Linux� N)�
43 TermColors�InputTermColors�ColorScheme�ColorSchemeTable� )� Colorable)�StringIO� �NoColor�headerZ in_promptZ in_numberZ
44 in_prompt2Z in_normalZ
45 out_promptZ
46 out_number�normalZNeutral�nt)�nameZLightBGc sT e Zd ZdZdejddf� fdd� Zdefdd�Zd
47 dd�Z d d
48 � Z
49 dd� Z� ZS )r z# Format colored Python source.
50 Nc sR t t| �j|d� |r
51 |nt| _|| _d| _d| _d| _|s$| j | _
52 dS || _
53 dS )zr Create a parser with a specified color table and output channel.
54
55 Call format() to process code.
56 )�parentN)�superr �__init__r �color_table�out�pos�lines�raw�
57 default_style�style)�selfr r r r �� __class__� �Nc:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/utils/PyColorize.pyr � s
58 zParser.__init__c C s. dd l }|tur|jddd� | �||�d S )Nr z�The `scheme` argument of IPython.utils.PyColorize:Parser.format is deprecated since IPython 6.0.It will have no effect. Set the parser `style` directly.r )�
59 stacklevel)�warnings� Undefined�warn�format2)r r r �schemer"