Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit be80e9d

Browse files
committed
Reify colors from debugger.
1 parent a3074b8 commit be80e9d

3 files changed

Lines changed: 48 additions & 27 deletions

File tree

IPython/core/debugger.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,6 @@ def BdbQuit_excepthook(et, ev, tb, excepthook=None):
159159
"`BdbQuit_excepthook` is deprecated since version 5.1",
160160
)
161161

162-
163-
def BdbQuit_IPython_excepthook(self, et, ev, tb, tb_offset=None):
164-
raise ValueError(
165-
"`BdbQuit_IPython_excepthook` is deprecated since version 5.1",
166-
DeprecationWarning, stacklevel=2)
167-
168-
169162
RGX_EXTRA_INDENT = re.compile(r'(?<=\n)\s+')
170163

171164

@@ -270,21 +263,6 @@ def __init__(self, completekey=None, stdin=None, stdout=None, context=5, **kwarg
270263
C = coloransi.TermColors
271264
cst = self.color_scheme_table
272265

273-
cst['NoColor'].colors.prompt = C.NoColor
274-
cst['NoColor'].colors.breakpoint_enabled = C.NoColor
275-
cst['NoColor'].colors.breakpoint_disabled = C.NoColor
276-
277-
cst['Linux'].colors.prompt = C.Green
278-
cst['Linux'].colors.breakpoint_enabled = C.LightRed
279-
cst['Linux'].colors.breakpoint_disabled = C.Red
280-
281-
cst['LightBG'].colors.prompt = C.Blue
282-
cst['LightBG'].colors.breakpoint_enabled = C.LightRed
283-
cst['LightBG'].colors.breakpoint_disabled = C.Red
284-
285-
cst['Neutral'].colors.prompt = C.Blue
286-
cst['Neutral'].colors.breakpoint_enabled = C.LightRed
287-
cst['Neutral'].colors.breakpoint_disabled = C.Red
288266

289267
# Add a python parser so we can syntax highlight source while
290268
# debugging.

IPython/core/excolors.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ def exception_colors():
3434
>>> ec.active_scheme_name
3535
'NoColor'
3636
>>> sorted(ec.active_colors.keys())
37-
['Normal', 'caret', 'em', 'excName', 'filename', 'filenameEm', 'line',
38-
'lineno', 'linenoEm', 'name', 'nameEm', 'normalEm', 'topline', 'vName',
39-
'val', 'valEm']
37+
['Normal', 'breakpoint_disabled', 'breakpoint_enabled', 'caret', 'em',
38+
'excName', 'filename', 'filenameEm', 'line', 'lineno', 'linenoEm', 'name',
39+
'nameEm', 'normalEm', 'prompt', 'topline', 'vName', 'val', 'valEm']
40+
4041
"""
4142

4243
ex_colors = ColorSchemeTable()
@@ -70,6 +71,10 @@ def exception_colors():
7071
"line": C.NoColor,
7172
"caret": C.NoColor,
7273
"Normal": C.NoColor,
74+
# debugger
75+
"prompt": C.NoColor,
76+
"breakpoint_enabled": C.NoColor,
77+
"breakpoint_disabled": C.NoColor,
7378
},
7479
)
7580
)
@@ -99,6 +104,10 @@ def exception_colors():
99104
"line": C.Yellow,
100105
"caret": C.White,
101106
"Normal": C.Normal,
107+
# debugger
108+
"prompt": C.Green,
109+
"breakpoint_enabled": C.LightRed,
110+
"breakpoint_disabled": C.Red,
102111
},
103112
)
104113
)
@@ -132,6 +141,10 @@ def exception_colors():
132141
"line": C.Red,
133142
"caret": C.Normal,
134143
"Normal": C.Normal,
144+
# debugger
145+
"prompt": C.Blue,
146+
"breakpoint_enabled": C.LightRed,
147+
"breakpoint_disabled": C.Red,
135148
},
136149
)
137150
)
@@ -161,6 +174,10 @@ def exception_colors():
161174
"line": C.Red,
162175
"caret": C.Normal,
163176
"Normal": C.Normal,
177+
# debugger
178+
"prompt": C.Blue,
179+
"breakpoint_enabled": C.LightRed,
180+
"breakpoint_disabled": C.Red,
164181
},
165182
)
166183
)

IPython/utils/coloransi.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,34 @@ class TermColors:
7171
Normal = '\033[0m' # Reset normal coloring
7272
_base = '\033[%sm' # Template for all other colors
7373

74-
# Build the actual color table as a set of class attributes:
75-
make_color_table(TermColors)
74+
Black = "0;30"
75+
Red = "0;31"
76+
Green = "0;32"
77+
Brown = "0;33"
78+
Blue = "0;34"
79+
Purple = "0;35"
80+
Cyan = "0;36"
81+
LightGray = "0;37"
82+
# Light colors
83+
DarkGray = "1;31"
84+
LightRed = "1;32"
85+
LightGreen = "1;33"
86+
Yellow = "1;34"
87+
LightBlue = "1;35"
88+
LightPurple = "1;36"
89+
LightCyan = "1;37"
90+
White = "1;38"
91+
# Blinking colors. Probably should not be used in anything serious.
92+
BlinkBlack = "5;30"
93+
BlinkRed = "5;31"
94+
BlinkGreen = "5;32"
95+
BlinkYellow = "5;33"
96+
BlinkBlue = "5;34"
97+
BlinkPurple = "5;35"
98+
BlinkCyan = "5;36"
99+
BlinkLightGray = "5;37"
100+
101+
76102

77103
class InputTermColors:
78104
"""Color escape sequences for input prompts.

0 commit comments

Comments
 (0)